You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After PRs #1015 (small-handle pointer guard in native_object_to_v8) and #1016 (Response/Request/Headers globals in V8 fallback), hono's compat sweep fixture runs to completion under a TTY but SIGSEGVs (rc=139) when stdout is redirected. Same binary, identical command line — only the stdout target differs.
cd /tmp/perry-compat-sweep/hono
./out # exit=0, no visible output (TTY-attached, output may be buffered/lost)
./out > /tmp/x.txt 2> /tmp/y.txt # exit=139, empty files
./out | cat # exit=139
The compat sweep harness redirects stdout into perry-out.txt, which triggers the crash and flags hono as FAIL_RUNTIME.
Expected: body=pong. Actual under redirect: rc=139 with no output reaching the file.
Probable causes (untriaged)
The TTY-vs-redirect dependency points to one of:
stdout buffering at exit. When stdout is a TTY, libc flushes line-by-line; under redirect it's fully buffered and only flushes at exit. A destructor running between the final console.log and the actual flush is hitting an invalid pointer.
V8 cleanup ordering. The V8 isolate's exit-time teardown may free objects that something else still holds. The TTY path may give the runtime a chance to drain async work that the redirected path doesn't.
process.exit not being called. When stdout is a TTY, the runtime may rely on user-visible flush before the bad teardown runs; under redirect the teardown happens earlier in the lifecycle.
# Capture a backtrace via lldb when stdout is redirected:cd /tmp/perry-compat-sweep/hono
lldb -- ./out > /tmp/hono.log
# inside lldb: 'run' then 'bt' after crash# Or core-dump:ulimit -c unlimited
./out > /tmp/x.txt 2> /tmp/y.txt
ls /cores/
# Compare with diagnostics on:
RUST_BACKTRACE=full PERRY_LOG_TRACE=1 PERRY_DIAG=1 ./out > /tmp/x.txt 2> /tmp/y.txt
Look at:
crates/perry-jsruntime/src/lib.rs — process shutdown, isolate disposal
The Drop impls on JsRuntimeState, NodeModuleLoader, etc.
Relation to other issues
This may be a sibling of the busy-wait async lowering issue tracked as a separate parity issue (#1021): hono's await app.fetch(req) chain doesn't pump cleanly under the busy-wait, and the result might be that the program reaches "end of main" before the awaited continuation completes. Under TTY the buffering masks this; under redirect the cleanup races and segfaults.
If the async-lowering fix lands first, this issue might evaporate. Worth re-testing hono after any change to js_run_jsruntime_pump or native_callback_trampoline.
Workarounds in scope until fixed
Sweep harness could use script -q /dev/null ./out (give the program a pty) to mask the issue — discouraged because it hides the real bug.
Users hitting this manually can re-run with ./out | tee /tmp/out.log — same redirect crash, no escape.
Impact
Blocks hono from passing the sweep. Hono otherwise works end-to-end interactively. Once stdout-redirect crash is fixed, hono should be a clean PASS.
Summary
After PRs #1015 (small-handle pointer guard in
native_object_to_v8) and #1016 (Response/Request/Headers globals in V8 fallback), hono's compat sweep fixture runs to completion under a TTY but SIGSEGVs (rc=139) when stdout is redirected. Same binary, identical command line — only the stdout target differs.The compat sweep harness redirects stdout into
perry-out.txt, which triggers the crash and flags hono as FAIL_RUNTIME.Fixture
/tmp/perry-compat-sweep/hono/entry.ts:Expected:
body=pong. Actual under redirect: rc=139 with no output reaching the file.Probable causes (untriaged)
The TTY-vs-redirect dependency points to one of:
console.logand the actual flush is hitting an invalid pointer.process.exitnot being called. When stdout is a TTY, the runtime may rely on user-visible flush before the bad teardown runs; under redirect the teardown happens earlier in the lifecycle.Investigation starters
Look at:
crates/perry-jsruntime/src/lib.rs— process shutdown, isolate disposalcrates/perry-runtime/src/gc.rs— sweep at exitcrates/perry-jsruntime/src/interop.rs— pump exit pathDropimpls onJsRuntimeState,NodeModuleLoader, etc.Relation to other issues
This may be a sibling of the busy-wait async lowering issue tracked as a separate parity issue (#1021): hono's
await app.fetch(req)chain doesn't pump cleanly under the busy-wait, and the result might be that the program reaches "end of main" before the awaited continuation completes. Under TTY the buffering masks this; under redirect the cleanup races and segfaults.If the async-lowering fix lands first, this issue might evaporate. Worth re-testing hono after any change to
js_run_jsruntime_pumpornative_callback_trampoline.Workarounds in scope until fixed
script -q /dev/null ./out(give the program a pty) to mask the issue — discouraged because it hides the real bug../out | tee /tmp/out.log— same redirect crash, no escape.Impact
Blocks hono from passing the sweep. Hono otherwise works end-to-end interactively. Once stdout-redirect crash is fixed, hono should be a clean PASS.