Skip to content

Conversation

@harshitkr12
Copy link

@harshitkr12 harshitkr12 commented Dec 15, 2025

Summary:

Why ?
When uploading blobs to Azure Storage over HTTPS (SSL/TLS), curl_easy_send() can return CURLE_OK with 0 bytes sent. This would lead to a retry without delay immediately, causing a tight CPU-spinning loop.

What ?
Added a 10ms sleep when curl_easy_send() returns CURLE_OK with 0 bytes sent to prevent rapid retries and allow the OS scheduler to run other threads.

Test Plan:

cmake --build .
ctest -R "azure-core" --output-on-failure
>> 100% tests passed, 0 tests failed out of 459

@github-actions github-actions bot added Azure.Core Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization. labels Dec 15, 2025
@github-actions
Copy link

Thank you for your contribution @harshitkr12! We will review the pull request and get back to you soon.

@harshitkr12 harshitkr12 changed the title Fix CPU spinning when curl_easy_send returns 0 bytes on SSL socket wr… Fix CPU spinning when curl_easy_send returns 0 bytes on SSL socket writes Dec 15, 2025
// without making progress. This allows the scheduler to run other threads.
std::this_thread::sleep_for(std::chrono::milliseconds(10));
} else {
sentBytesTotal += sentBytesPerRequest;

Choose a reason for hiding this comment

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

Given that the else case is only avoiding the 0 case anyways, might be easier (for code readability purposes), to omit this else part alltogether.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Azure.Core Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants