Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EXPORTERS] Fix curl calls from otlp_http_exporter for versions >=7.5 and <7.80 #2521

Closed

Conversation

ecourreges-orange
Copy link
Contributor

Fixes #2520

Changes

Just changed the #if from version 0x075000 to 0x078000

Trivial change, no changelog change

@ecourreges-orange ecourreges-orange requested a review from a team February 1, 2024 15:17
Copy link
Member

@marcalff marcalff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bonjour.

If I understand CURL correctly, LIBCURL_VERSION_NUM is encoded in hexadecimal, so that value 0x075000 represents 0x07 0x50 0x00 which means 7.80.0.

A better way is to use CURL_VERSION_BITS(7, 80, 0) instead for readability,
but the original code was correct.

I will double check on this LIBCURL_VERSION_NUM encoding.

Now, we also have seen this in the past:

  • code compiled against one version of curl headers
  • code linked against another version of the curl library

A good way to definitively get rid of these bugs would be to capture the curl version used at compile time and runtime, and print that in the log when opentelemetry is initialized, to help troubleshooting.

@marcalff
Copy link
Member

marcalff commented Feb 1, 2024

To confirm:

https://github.com/curl/curl/blob/9e560d11aad028de74addc0d1edfefa5667884f4/include/curl/curlver.h#L37-L60

#define LIBCURL_VERSION_MAJOR 7
#define LIBCURL_VERSION_MINOR 80
#define LIBCURL_VERSION_PATCH 0

/* This is the numeric version of the libcurl version number, meant for easier
parsing and comparisons by programs. The LIBCURL_VERSION_NUM define will
always follow this syntax:

     0xXXYYZZ

Where XX, YY and ZZ are the main version, release and patch numbers in
hexadecimal (using 8 bits each). All three numbers are always represented
using two digits. 1.2 would appear as "0x010200" while version 9.11.7
appears as "0x090b07".

This 6-digit (24 bits) hexadecimal number does not show pre-release number,
and it is always a greater number in a more recent release. It makes
comparisons with greater than and less than work.

Note: This define is the full hex number and does not use the
CURL_VERSION_BITS() macro since curl's own configure script greps for it
and needs it to contain the full number.
*/
#define LIBCURL_VERSION_NUM 0x075000

@ecourreges-orange
Copy link
Contributor Author

Thanks for your insights @marcalff , so what should we do next?

I can try adding a log and confirming this compilation/runtime discrepancy later this week, or I can close the issue.

I definitely wouldn't rule out that it picked up Ubuntu jammy's curl v 7.81.0 for compilation and then runs on Ubuntu focal with the older v7.68.0

@ecourreges-orange
Copy link
Contributor Author

ecourreges-orange commented Feb 5, 2024

Cf the issue, the problem doesn't have to do with my docker environment with two OSes, but the fact that the bazel build of opentelemetry compiles on curl 8.4.0 that it downloads from fresh source, and later on, my app is a shared library loaded by apache which loads the curl of the system which is 7.68.0 on Ubuntu focal 20.04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUILD] CURL versions discrepancies with bazel
2 participants