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

core: Add support for retrieving CURL error messages, handle unexpected CURL return code on macOS, and log such codes in tests (fixes #519). #517

Merged
merged 20 commits into from
Aug 22, 2024

Conversation

LinZhihao-723
Copy link
Member

@LinZhihao-723 LinZhihao-723 commented Aug 15, 2024

Description

This PR fixes #519.
In recent workflows, we found that some macOS build failed because of the unit test failures. By further investigation, it is because HTTP error code 416 is not handled as CURL_HTTP_RETURNED_ERROR in the libcurl version of the GH macOS runner. The same issue won't be reproduced in ubuntu 20.04 or 22.04 even with the same version of libcurl. Therefore, this PR adds special handling for macOS to address the failure in the unit test cases.
In addition, as we were approaching the cause of the failure, we realized the CURL error message could be helpful. Therefore, we also add support for retrieving CURL error messages through the CurlDownloadHandler to improve the debugability of our CURL utilities. In the unit test, we add logs to print out the error messages when the CURL return code doesn't match the expected one.

Validation performed

  • Ensure workflow can be successfully built except on centOS, which is tracked by cent OS image fails to build #521 and is not related to this PR.
  • Unit tests all passed.

components/core/tests/test-NetworkReader.cpp Outdated Show resolved Hide resolved
"Unexpected CURL error code: " + std::to_string(actual)
+ "; expected: " + std::to_string(expected)
};
FAIL(error_message);
Copy link
Member

Choose a reason for hiding this comment

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

Based on https://curl.se/libcurl/c/libcurl-errors.html, can we also use CURLOPT_ERRORBUFFER so that we can get more details about the error (e.g., what specific HTTP error >= 400 it was)?

components/core/tests/test-NetworkReader.cpp Outdated Show resolved Hide resolved
components/core/tests/test-NetworkReader.cpp Outdated Show resolved Hide resolved
components/core/tests/test-NetworkReader.cpp Outdated Show resolved Hide resolved
components/core/tests/test-NetworkReader.cpp Outdated Show resolved Hide resolved
components/core/src/clp/NetworkReader.hpp Outdated Show resolved Hide resolved
components/core/src/clp/NetworkReader.cpp Outdated Show resolved Hide resolved
components/core/src/clp/CurlDownloadHandler.hpp Outdated Show resolved Hide resolved
components/core/src/clp/CurlDownloadHandler.hpp Outdated Show resolved Hide resolved
components/core/src/clp/CurlDownloadHandler.cpp Outdated Show resolved Hide resolved
components/core/src/clp/CurlDownloadHandler.cpp Outdated Show resolved Hide resolved
LinZhihao-723 and others added 2 commits August 21, 2024 20:10
Co-authored-by: kirkrodrigues <2454684+kirkrodrigues@users.noreply.github.com>
@LinZhihao-723 LinZhihao-723 changed the title core: Add logging in NetworkReader unit tests on unexpected CURL return code. core: Add logging in NetworkReader unit tests on unexpected CURL return code (fixes #519). Aug 22, 2024
Copy link
Member

@kirkrodrigues kirkrodrigues left a comment

Choose a reason for hiding this comment

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

For the PR title, how about:

core: Add support for retrieving CURL error messages, handle unexpected CURL return code on macOS, and log such codes in tests (fixes #519).

@kirkrodrigues
Copy link
Member

Can you:

  • Update the PR description
  • Comment on the workflow failures once they finish

@LinZhihao-723 LinZhihao-723 changed the title core: Add logging in NetworkReader unit tests on unexpected CURL return code (fixes #519). core: Add support for retrieving CURL error messages, handle unexpected CURL return code on macOS, and log such codes in tests (fixes #519). Aug 22, 2024
@LinZhihao-723
Copy link
Member Author

centOS build failed due to issue #521 which is not related to this PR.

@LinZhihao-723 LinZhihao-723 merged commit 54b832c into y-scope:main Aug 22, 2024
12 of 13 checks passed
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.

network_reader_illegal_offset unit test failure on macOS
2 participants