-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
Make sure we don't clean up an active handle during a next download. #101
Conversation
Codecov Report
@@ Coverage Diff @@
## master #101 +/- ##
==========================================
+ Coverage 92.96% 92.98% +0.02%
==========================================
Files 5 5
Lines 483 485 +2
==========================================
+ Hits 449 451 +2
Misses 34 34
Continue to review full report at Codecov.
|
Is any of the tests in #99 reproducible in CI? |
b8d1ea0
to
fa24496
Compare
Yes, I've added the MWE as a test. |
Does it also fix #95 or are they completely separate issues? Have you tried enabling HTTP/2 wich this patch? |
That seems very possible, but I couldn't reproduce with HTTP 2.0 re-enabled (and this patch either disabled or enabled). Could you try on your system? |
else | ||
# if reusing a multi, it's possible we had queued up a cleanup of the handle. | ||
# stop that timer so that we don't accidentaly clean up during another download. | ||
uv_timer_stop(multi.timer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems better to just hoist the uv_timer_stop(multi.timer)
call out of init!
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I.e. something like this:
diff --git a/src/Curl/Multi.jl b/src/Curl/Multi.jl
index f16e365..2a5f538 100644
--- a/src/Curl/Multi.jl
+++ b/src/Curl/Multi.jl
@@ -18,7 +18,6 @@ mutable struct Multi
end
function init!(multi::Multi)
- uv_timer_stop(multi.timer)
multi.handle = curl_multi_init()
add_callbacks(multi)
set_defaults(multi)
@@ -43,7 +42,12 @@ end
function add_handle(multi::Multi, easy::Easy)
lock(multi.lock) do
isempty(multi.easies) && preserve_handle(multi)
- multi.handle == C_NULL && init!(multi)
+ if multi.handle == C_NULL
+ init!(multi)
+ else
+ # stop grace timer
+ uv_timer_stop(multi.timer)
+ end
push!(multi.easies, easy)
@check curl_multi_add_handle(multi.handle, easy.handle)
end
The remaining question is whether the call to uv_timer_stop
should happen on every added handle or only the first one (when multi.handle == C_NULL
). I suspect the latter, but I'm not 100% sure. If so, then this code was calling uv_timer_stop
exactly when it shouldn't and not calling it when it should 😬
Fixes #99