Repository navigation
Conversation
auvipy
left a comment
There was a problem hiding this comment.
we need tests to verify this change
|
@auvipy Added a test for the subsequent timer cancelation |
|
any relevant old issues or discussions for this fix? |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2567 +/- ##
=======================================
Coverage 85.12% 85.13%
=======================================
Files 80 80
Lines 11371 11376 +5
Branches 1363 1365 +2
=======================================
+ Hits 9680 9685 +5
Misses 1471 1471
Partials 220 220 ☔ View full report in Codecov by Harness. |
|
@auvipy Not that I saw, it's just something I noticed and monkey patched in our system, so figured I would try to fix upstream. |
There was a problem hiding this comment.
Pull request overview
This pull request fixes curl multi timeout scheduling in CurlClient by converting pycurl’s millisecond timeout value into the hub’s expected seconds and by cancelling the previously scheduled timeout to prevent timer buildup (and related memory/CPU growth) when an endpoint becomes unavailable.
Changes:
- Convert
_set_timeoutinput from milliseconds to seconds before callinghub.call_later. - Store the scheduled timer reference and cancel the previous one before scheduling a new timeout.
- Update/add unit tests to validate the new timeout unit and the timer-cancellation behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
kombu/asynchronous/http/curl.py |
Converts timeout units and tracks/cancels the outstanding hub timer to prevent accumulating scheduled timeouts. |
t/unit/asynchronous/http/test_curl.py |
Updates the unit expectation for _set_timeout and adds coverage for cancelling the previous scheduled timer. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| 1.0, self._timeout_check, | ||
| ) | ||
|
|
||
| self._tref = None |
| 1.0, self._timeout_check, | ||
| ) | ||
|
|
||
| self._tref = None |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
Suppressed comments (1)
kombu/asynchronous/http/curl.py:61
- The newly tracked one-shot timer is not cancelled by
close(). If the client closes while a curl timeout is pending, the hub retains the client until that deadline and then invokes_timeout_checkon the already-closedCurlMulti; cancel_trefalongside the existing repeated timer.
self._tref = None
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
First of all, sorry folks if this is unrelated, I came here from #2488.
+1 for this I've encountered an issue based on this: If a network interruption silently drops the response to an in-flight My investigation found out that I am aware that this is probably an edge case, but it happened in a production environment. |
|
thanks for the ping |
Issue
Hi, this is a small change that address two issues:
I reproduced this locally by stopping a running ElasticMQ server and then saw memory growth and high CPU usage.
Leads to
Which calls
call_afterin secondsFix
We should probably only keep the latest timer, so use return value instead of creating new, and cancels previous if it exists. Did unit conversion in-function to maintain contract.