crates/perry/tests/issue_4903_listen_callback_deferred.rs fails both its tests on main, and it is now the only thing keeping the sweep-tier cargo-test red (and therefore main-gate).
thread 'late_listening_listener_fires' panicked at issue_4903_listen_callback_deferred.rs:45
thread 'listen_callback_is_deferred_and_this_bound' panicked at issue_4903_listen_callback_deferred.rs:45
test result: FAILED. 0 passed; 2 failed
Line 45 is the "compiled binary failed" assertion, so this is a runtime failure, not a wrong value.
Reduced. http.createServer returns undefined in every form, while the export itself is a function:
const http = require('http');
console.log('no-arg :', typeof http.createServer()); // undefined
console.log('with-handler:', typeof http.createServer(function () {})); // undefined
console.log('arrow :', typeof http.createServer(() => {})); // undefined
console.log('createServer:', typeof http.createServer); // function
Node prints object for the first three. The test's own failure is downstream of this — .listen(0, cb) on undefined throws TypeError: Cannot read properties of undefined (reading 'listen').
Where it comes from. ("http", "createServer") in native_module_dispatch/dispatch_d_i.rs routes through JS_NATIVE_HTTP_DISPATCH, and returns undefined when that pointer is null:
let ptr = crate::value::JS_NATIVE_HTTP_DISPATCH.load(Ordering::SeqCst);
if ptr.is_null() { f64::from_bits(JSValue::undefined().bits()) } else { … }
That pointer is only installed by perry-stdlib's common/dispatch/init.rs:689, under #[cfg(feature = "external-http-server-pump")] — and that feature is not part of perry-stdlib's default/full set. So the question is whether the compile path that these tests exercise links a stdlib with the feature on. Locally the compile reports Linking (runtime-only), which is consistent with an http-using program being linked without the http implementation.
Two things I ruled out while narrowing, worth stating so the next person does not repeat them:
Repro: RUST_TEST_THREADS=1 cargo test --release -p perry --test issue_4903_listen_callback_deferred, or compile the four-line snippet above and run it.
crates/perry/tests/issue_4903_listen_callback_deferred.rsfails both its tests onmain, and it is now the only thing keeping the sweep-tiercargo-testred (and thereforemain-gate).Line 45 is the "compiled binary failed" assertion, so this is a runtime failure, not a wrong value.
Reduced.
http.createServerreturnsundefinedin every form, while the export itself is a function:Node prints
objectfor the first three. The test's own failure is downstream of this —.listen(0, cb)onundefinedthrowsTypeError: Cannot read properties of undefined (reading 'listen').Where it comes from.
("http", "createServer")innative_module_dispatch/dispatch_d_i.rsroutes throughJS_NATIVE_HTTP_DISPATCH, and returnsundefinedwhen that pointer is null:That pointer is only installed by
perry-stdlib'scommon/dispatch/init.rs:689, under#[cfg(feature = "external-http-server-pump")]— and that feature is not part ofperry-stdlib'sdefault/fullset. So the question is whether the compile path that these tests exercise links a stdlib with the feature on. Locally the compile reportsLinking (runtime-only), which is consistent with an http-using program being linked without the http implementation.Two things I ruled out while narrowing, worth stating so the next person does not repeat them:
PERRY_RUNTIME_DIRoverride. I first reproduced with the override pointing at locally-built archives (which legitimately lack the opt-in feature), which would have been a build-config artifact; re-running withenv -u PERRY_RUNTIME_DIR, exactly as the test does, reproduces identically.c721cb6a0,7c22189aaande5ebb82b8, i.e. it predates today's merges; it only became the visible blocker once the othercargo-testfailure (GC: defineProperty and Reflect/own-key paths use a stale receiver or value under forced evacuation #8507's suite, fixed by fix(gc): root defineProperty operands across exotic probes (#8507) #8526) and the twolintfailures (fixed by fix(ci): convert new raw-handle debt to the rooting combinators (main lint is red) #8541) were cleared.Repro:
RUST_TEST_THREADS=1 cargo test --release -p perry --test issue_4903_listen_callback_deferred, or compile the four-line snippet above and run it.