From 7a21506b380b1ffd238a6bcabe45f4211bfecc91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ralph=20K=C3=BCpper?= Date: Fri, 3 Jul 2026 17:44:21 +0200 Subject: [PATCH] =?UTF-8?q?fix(link):=20#5892=20=E2=80=94=20keep=20perry?= =?UTF-8?q?=5Fffi=20test=20shims=20out=20of=20production=20ext=20archives?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit perry-ext-http and perry-ext-http-server compiled their test_async_shims modules (synchronous perry_ffi_* stand-ins for unit-test linking) into the production staticlib archives: the mod declaration was missing the #[cfg(test)] gate that perry-ext-net already has. The shims' own comment says 'Test-only; never shipped.' — but they shipped. Those shims define the same #[no_mangle] C symbols as perry-stdlib's real perry-ffi async bridge, with catastrophically different semantics: perry_ffi_spawn_blocking_with_reactor/spawn_blocking run the closure inline (no runtime context, no pump/wait-driver registration) and perry_ffi_spawn_async is a no-op that silently drops the task. Whenever the linker resolves these from an ext archive instead of libperry_stdlib.a (single-pass archive scanning: the reference and the shim live in the same archive), the #5831 current-thread runtime is never driven: the wait-driver never registers, js_wait_for_event falls back to the 1 s condvar park, and any program with in-process server+client I/O parks forever. This is the cargo-test hang in issue_4903_listen_callback_deferred (#5892) that has blocked nightlies and release tags since #5831 merged; the auto-opt path was immune because strip-dedup (#5000/#5685) localizes duplicate wrapper globals. Gate both modules with #[cfg(test)], matching perry-ext-net. Validation on the hang-lab branch (debug/5892-hang-lab): ungated cargo-test loop hung on iteration 1 in three consecutive runs; with the gate, single-run repro + 6/6 cargo-test iterations clean (run 28669296187). --- crates/perry-ext-http-server/src/lib.rs | 1 + crates/perry-ext-http/src/lib.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/crates/perry-ext-http-server/src/lib.rs b/crates/perry-ext-http-server/src/lib.rs index d949a3f4814..4ebfe4858f4 100644 --- a/crates/perry-ext-http-server/src/lib.rs +++ b/crates/perry-ext-http-server/src/lib.rs @@ -70,6 +70,7 @@ mod response; mod response_fast; mod server; #[cfg(test)] +#[cfg(test)] mod test_async_shims; mod tls; mod types; diff --git a/crates/perry-ext-http/src/lib.rs b/crates/perry-ext-http/src/lib.rs index 36467837956..d816401e4bf 100644 --- a/crates/perry-ext-http/src/lib.rs +++ b/crates/perry-ext-http/src/lib.rs @@ -1812,6 +1812,7 @@ mod tests; // Test-only `perry_ffi_*` async-bridge shims so the lib test links without the // host stdlib archive (mirrors perry-ext-net / perry-ext-http-server). #[cfg(test)] +#[cfg(test)] mod test_async_shims; // Suppress unused-import warnings for FFI-only types.