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

set option <30120> failed: <A libcurl function was given a bad argument> #2175

Closed
cnbleu opened this issue Jun 2, 2023 · 6 comments · Fixed by #2178
Closed

set option <30120> failed: <A libcurl function was given a bad argument> #2175

cnbleu opened this issue Jun 2, 2023 · 6 comments · Fixed by #2178
Labels
bug Something isn't working

Comments

@cnbleu
Copy link

cnbleu commented Jun 2, 2023

Hey all,

There is an error message ext\src\http\client\curl\http_operation_curl.cc:548 CURL, set option <30120> failed: <A libcurl function was given a bad argument> while running the example_otlp_http example with Win32 on my Windows 10. I have already debug it and found that after add these follow codes, it works well.

    #ifdef WIN32
    rc = SetCurlLongOption(CURLOPT_POSTFIELDSIZE, req_size);
    #else
    rc = SetCurlLongOption(CURLOPT_POSTFIELDSIZE_LARGE, req_size);
    #endif

It should be a 32-bit compatibility problem.

@cnbleu cnbleu added the bug Something isn't working label Jun 2, 2023
@owent
Copy link
Member

owent commented Jun 2, 2023

Maybe we can always use CURLOPT_POSTFIELDSIZE_LARGE .

@cnbleu
Copy link
Author

cnbleu commented Jun 5, 2023

Hi, ownet. Do you mean we can always use CURLOPT_POSTFIELDSIZE_LARGE ? This could be problematic. It not works on Win32, it will print 548 CURL, set option <30120> failed: <A libcurl function was given a bad argument>. We should use CURLOPT_POSTFIELDSIZE on Win32.

@owent
Copy link
Member

owent commented Jun 5, 2023

Hi, ownet. Do you mean we can always use CURLOPT_POSTFIELDSIZE_LARGE ? This could be problematic. It not works on Win32, it will print 548 CURL, set option <30120> failed: <A libcurl function was given a bad argument>. We should use CURLOPT_POSTFIELDSIZE on Win32.

Maybe it's better to add a SetCurlOffOption and take curl_off_t as value. According to https://curl.se/libcurl/c/CURLOPT_POSTFIELDSIZE_LARGE.html, CURLOPT_POSTFIELDSIZE_LARGE use curl_off_t . And there also are some other options use this type.
The long type is different on different platforms and environments, and we should let compiler to decide whether it's the same as curl_off_t.

@marcalff
Copy link
Member

marcalff commented Jun 5, 2023

This looks like a regression introduced by:

because the helper SetCurlLongOption() was used on a type curl_off_t.

We need a SetCurlOffOption() indeed.

marcalff added a commit to marcalff/opentelemetry-cpp that referenced this issue Jun 5, 2023
@marcalff
Copy link
Member

marcalff commented Jun 5, 2023

@cnbleu Thanks for the report.

Could you confirm if this fix works for you:

Thanks.

@cnbleu
Copy link
Author

cnbleu commented Jun 6, 2023

@cnbleu Thanks for the report.

Could you confirm if this fix works for you:

Thanks.

Hi @marcalff , i have re-compile with your branch and test it on my Windows, it works. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants