Summary
Binaries compiled with perry 0.5.18 that use http-server (Fastify) + database-mysql features segfault immediately on startup. The same source code compiles and runs correctly with perry 0.4.51.
Reproduction
Any TypeScript file that imports Fastify and mysql2, compiled on Linux x86_64:
perry compile main.ts -o my-server # with perry 0.5.18
./my-server # SIGSEGV immediately
The same file compiled with perry 0.4.51 runs fine.
Even a minimal Fastify-only app (no MySQL) fails to start when compiled with 0.5.18 — the binary exits silently with no output.
Environment
- Platform: Linux x86_64 (Ubuntu, Cherry Servers)
- Perry versions tested:
- 0.4.51 — works
- 0.5.18 (both release binary and source-built) — segfaults
- Runtime: Tested with both prebuilt libs and source-built (
cargo build --release -p perry-runtime -p perry-stdlib). Same result.
- Features used:
crypto, database-mysql, http-server, http-client, websocket
Additional detail
When the auto-optimize feature rebuilds the runtime with the exact feature set, compilation succeeds with no linker warnings, but the resulting binary still segfaults (signal 11 / SIGSEGV) on the first instruction.
Separate issue: gc() symbol mismatch
The runtime exports the manual GC trigger as js_gc_collect (gc.rs:326), and the codegen declares it as js_gc_collect (runtime_decls.rs:1450), but calling gc() from TypeScript emits a reference to the bare symbol gc — which doesn't exist in the linked runtime. This results in:
undefined reference to `gc'
The workaround is adding a #[no_mangle] pub extern "C" fn gc() alias in gc.rs, but the codegen should either emit js_gc_collect for gc() calls, or the runtime should export the bare gc symbol.
This matters for long-running servers: without periodic gc(), the runtime's memory tracking accumulates and RSS grows unbounded, eventually causing memory corruption and crashes.
Summary
Binaries compiled with perry 0.5.18 that use
http-server(Fastify) +database-mysqlfeatures segfault immediately on startup. The same source code compiles and runs correctly with perry 0.4.51.Reproduction
Any TypeScript file that imports Fastify and mysql2, compiled on Linux x86_64:
The same file compiled with perry 0.4.51 runs fine.
Even a minimal Fastify-only app (no MySQL) fails to start when compiled with 0.5.18 — the binary exits silently with no output.
Environment
cargo build --release -p perry-runtime -p perry-stdlib). Same result.crypto,database-mysql,http-server,http-client,websocketAdditional detail
When the auto-optimize feature rebuilds the runtime with the exact feature set, compilation succeeds with no linker warnings, but the resulting binary still segfaults (signal 11 / SIGSEGV) on the first instruction.
Separate issue:
gc()symbol mismatchThe runtime exports the manual GC trigger as
js_gc_collect(gc.rs:326), and the codegen declares it asjs_gc_collect(runtime_decls.rs:1450), but callinggc()from TypeScript emits a reference to the bare symbolgc— which doesn't exist in the linked runtime. This results in:The workaround is adding a
#[no_mangle] pub extern "C" fn gc()alias ingc.rs, but the codegen should either emitjs_gc_collectforgc()calls, or the runtime should export the baregcsymbol.This matters for long-running servers: without periodic
gc(), the runtime's memory tracking accumulates and RSS grows unbounded, eventually causing memory corruption and crashes.