Repository navigation
Commit 26b7744
committed
[BUG] Stop the IO thread spinning when the multi handle cannot be created
Raised by @lalitb in review, who asked whether the case would hang rather than
fail if the recovery were broken. It would, and following that down found the
reason, which is not in the case.
curl_multi_perform does not write still_running when it rejects the handle, and
the loop initialises it to one. So a client whose multi handle is null keeps
reporting work it does not have: the loop takes the still_running > 0 branch
every pass, never reaches the shutdown check below it, and never waits, so the
thread spins a core and ~HttpClient blocks in join for good. Gating
curl_multi_init to fail persistently, the whole test binary hangs, twice out of
twice at sixty seconds and once at two minutes. With still_running cleared on
that branch it finishes in 521 ms, three runs out of three, and the case passes
rather than hanging, because the reset then cancels the session and the caller
is told.
A multi handle that fails once and then works is unaffected: the reset creates
one, doAddSessions puts the pending session on it and sets still_running again,
and the request completes with a response, three runs out of three with the
internal log confirming the first handle really was null.
The case also cancels before it finishes, so an assertion failure ends the case
rather than leaving FinishSession waiting on an operation nothing will complete.
Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com>1 parent 85e9a36 commit 26b7744
3 files changed
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
50 | 53 | | |
51 | 54 | | |
52 | 55 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
482 | 482 | | |
483 | 483 | | |
484 | 484 | | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
485 | 489 | | |
486 | 490 | | |
487 | 491 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1109 | 1109 | | |
1110 | 1110 | | |
1111 | 1111 | | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
1112 | 1116 | | |
1113 | 1117 | | |
1114 | 1118 | | |
| |||
0 commit comments