Skip to content

Make TimerCallbackTest match libcurl 8.5 timer updates - #1

Merged
projectsaturnstudios merged 1 commit into
0.10.xfrom
cursor/timer-callback-libcurl-8.5-637b
Oct 14, 2026
Merged

projectsaturnstudios merged 1 commit into
0.10.xfrom
cursor/timer-callback-libcurl-8.5-637b

Conversation

@projectsaturnstudios

Copy link
Copy Markdown
Contributor

Ubuntu 24.04 CI (libcurl 8.5.0) failed four TimerCallbackTest cases while macOS (Homebrew libcurl 8.22) was green. This is libcurl behavior, not a pcurl trampoline bug.

What failed. CURLMOPT_TIMERFUNCTION never ran when the tests called curlMultiSocketAction($multi, CURL_SOCKET_TIMEOUT, 0) after swapping the callback, and a completed localhost transfer never delivered -1. curl_multi_add_handle and curl_multi_exec still fired the callback on 8.5.

Why. libcurl only calls the timer callback when the timeout it wants changes. On 8.5, curl_multi_socket_action(CURL_SOCKET_TIMEOUT) memsets timer_lastcall to {0,0} first. Curl_update_timer then treats “new timeout is -1” as “already told the app there is no timer” and skips the callback. A localhost easy with no CURLOPT_TIMEOUT looks like that after EXPIRE_RUN_NOW is consumed: add_handle reports 0, the TIMEOUT action reports nothing, completion never sends -1.

libcurl 8.11 (a58b50f) split that bookkeeping into last_expire_ts (still cleared on TIMEOUT) and last_timeout_ms (kept). The same TIMEOUT call then reports -1. That is why Homebrew 8.22 and the Pi’s 8.14.1 were green.

Fix. The failing tests now set CURLOPT_TIMEOUT_MS on the easy so 8.5 still has an expire in the tree. TIMEOUT then reports the remaining ms; completion reports -1. C is unchanged.

Verified locally on Ubuntu 24.04 / PHP 8.3 NTS / libcurl 8.5.0: 72 passed, 1 skipped (the existing pre-8.16 add_handle abort skip).

Open in Web Open in Cursor 

Ubuntu 24.04's libcurl 8.5 does not invoke CURLMOPT_TIMERFUNCTION on every
curl_multi_socket_action(CURL_SOCKET_TIMEOUT): it clears timer_lastcall first,
then skips the callback when the new timeout is -1. Localhost transfers with
no CURLOPT_TIMEOUT look like that after EXPIRE_RUN_NOW is consumed, so the
suite's socket-action and completion-cancel assertions never saw a callback.

Give those easies CURLOPT_TIMEOUT_MS so 8.5 has an expire left to report
(and still reports -1 at completion). The C trampoline was already 1:1.

Co-authored-by: Angel Gonzalez <usftechacg@gmail.com>
@projectsaturnstudios
projectsaturnstudios marked this pull request as ready for review October 14, 2026 13:40
@projectsaturnstudios
projectsaturnstudios merged commit 5c2945b into 0.10.x Oct 14, 2026
16 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.

2 participants