Skip to content

NTS-surfaced test failures #118

Closed
Closed

Description

@EdmondDantes

Tracking issue for three test failures surfaced once the NTS build was fixed
(commit a167a92 — before that, NTS jobs failed at build and never ran tests,
so these were latent). None are regressions from the spawn_thread shutdown
fix; all are pre-existing.

Run that exposed them: https://github.com/true-async/php-async/actions/runs/25852397574

1. cancel_during_io — getaddrinfo struct leak (NTS)

fuzzy-tests/_generated/cross_topic/cancel_during_io__00_cancel_a_coroutine_blocked_on_tcp_accept.phpt
fails on LINUX_X64_DEBUG_NTS with:

libuv_reactor.c(3010) : Freeing 0x... (288 bytes) ...
=== Total 1 memory leaks detected ===

This is the second half of #111. da62db4 fixed the leak of the libuv
addrinfo result buffer (event->result). The 288-byte block at
libuv_reactor.c:3010 is the pecalloc of the async_dns_addrinfo_t
event struct itself, which still leaks: in libuv_dns_getaddrinfo_dispose,
the !LIBUV_DNS_F_CALLBACK_DONE path sets LIBUV_DNS_F_DISPOSE_PENDING,
uv_cancels and returns without pefree. It relies on on_addrinfo_event
firing again to re-enter dispose and free the struct — but if the reactor is
torn down before that libuv callback fires, the struct leaks.

2. thread_pool/cancel — flake under tracing JIT (ZTS)

fuzzy-tests/_generated/thread_pool/cancel__00_submit_then_cancel_every_future_settles_cleanly.phpt
failed once on LINUX_X64_RELEASE_ZTS under the "Test Tracing JIT" step.
Passes 5/5 locally (ZTS debug + tracing JIT). Suspected flake; needs
repeated runs to characterise.

3. curl progress-callback exception (macOS)

tests/curl/035-progress_exception.phpt (and 056-multi_progress_exception.phpt)
fail on MACOS_ARM64_*_NTS with Fatal error: Uncaught RuntimeException: Progress callback error — the script dies before Done. Also failed on
macOS ZTS in the very first run, so it is macOS-specific and pre-existing.
An exception thrown from the CURLOPT_XFERINFOFUNCTION callback is not being
delivered to the awaiter on macOS.

Iteration workflow

.github/workflows/debug-bugfix.yml — manually-triggered (workflow_dispatch),
builds only the platform/build combos that reproduce each failure (Linux NTS

  • ASAN, Linux ZTS + tracing JIT, macOS NTS) and runs just these four tests
    with --repeat 5. Trigger with:
gh workflow run "Debug Bugfix (manual)" --repo true-async/php-async --ref main

Activity

  1. EdmondDantes commented on May 14, 2026

    @EdmondDantes
    ContributorAuthor

    Confirmed pre-existing — not regressions. Commit d1be46b (adds only the
    debug-bugfix.yml workflow file, zero code changes — byte-identical code
    to a167a92) still fails CI on curl/035-progress_exception and
    056-multi_progress_exception on macOS (NTS and ZTS). So #3 is a
    deterministic pre-existing macOS bug.

    The NTS build fix only made the NTS jobs run (they previously failed at the
    build step and never reached the test phase), which surfaced these latent
    failures.

    Status from the first Debug Bugfix run + local repro:

    debug-bugfix.yml updated: macOS bison PATH fix, --repeat raised to 30.

  2. changed the title [-]CI: NTS-surfaced test failures — cancel_during_io getaddrinfo struct leak, thread_pool/cancel flake, curl progress-exception[/-] [+]CI: NTS-surfaced test failures[/+] on May 15, 2026
  3. changed the title [-]CI: NTS-surfaced test failures[/-] [+]NTS-surfaced test failures[/+] on May 15, 2026
  4. self-assigned this
    on May 15, 2026
  5. added
    bug
    on May 15, 2026
  6. added theissue type on May 15, 2026
  7. added this to the TrueAsync 0.7.0 milestone on May 15, 2026
  8. added 3 commits that reference this issue on May 15, 2026
  9. added a commit that references this issue on May 15, 2026
  10. EdmondDantes commented on May 15, 2026

    @EdmondDantes
    ContributorAuthor

    All three NTS-surfaced test failures are now fixed and verified end-to-end.

    • 1. getaddrinfo event-struct leak (NTS). Two-phase shutdown drain in `libuv_reactor_shutdown` — bounded `UV_RUN_NOWAIT` for ready callbacks, then bounded `UV_RUN_ONCE` for threadpool cancel-completions. Per libuv docs `uv_cancel(uv_getaddrinfo_t*)` returns EBUSY for in-flight requests; we must wait for the worker rather than preempt it. Fix: `52604b6` (ext/async).
    • 2. thread_pool/cancel JIT SEGV (ZTS). Tracing-JIT stale FP-relative regalloc spill across inlined return. Clear callee STACK_REF before FP swap in `zend_jit_leave_func`. Fix: `9fe79f25141` (php-src) + `dc75feb` (ext/async CHANGELOG).
    • 3. curl XFERINFOFUNCTION / PROGRESSFUNCTION exception delivery (macOS NTS). `curl_xferinfo` / `curl_progress` in `ext/curl/interface.c` were missing the async exception-handoff pattern that `curl_prereqfunction` and `curl_debug` already had. When the user callback threw, `EG(exception)` was left set across libcurl iterations; on Linux the dangling exception happened to land on the awaiter's frame, but on macOS the libuv/kqueue reentry path delivered it as uncaught at engine top-level. Fix: in both callbacks, hand the exception off to `curl_async_event_set_callback_exception()`, clear it, and return 1 to abort the transfer. Captured exception then re-thrown through the normal `curl_async_event_t` delivery path. Fix: `ae2bd4fba38` (php-src, true-async → true-async-stable `6e349b5916c`) + PR #118: fix NTS test failures (getaddrinfo leak + macOS curl progress exception) #120 (ext/async).

    Verification:

    • `Debug Bugfix (manual)` run `25917156027` — MACOS_NTS, LINUX_NTS_ASAN, LINUX_ZTS_JIT all green.
    • Full post-merge build matrix on `main` (`228740f`) — Alpine, macOS, FreeBSD, Windows, Linux x64 all green.

    Follow-up (separate, non-blocking): `curl_fnmatch` (`CURLOPT_FNMATCH_FUNCTION`) and `curl_ssh_hostkeyfunction` still lack the same exception-handoff pattern. No FTP/SSH async integration or tests exist for them today; will revisit when those paths gain async support.

  11. added a commit that references this issue on May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions