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
{{ message }}
Repository navigation
PERRY_NO_AUTO_OPTIMIZE: importing node:http makes String.prototype.match segfault in mi_free (stdlib rebuilt without the runtime) #11240
With PERRY_NO_AUTO_OPTIMIZE=1, a program that imports node:http and then calls String.prototype.match segfaults inside mi_free. It dies deterministically on the first regex match. The same program with node:net instead of node:http runs fine, and so does the same program without the import.
Reproduced on perrymaster (linux-x64), on main @ 19e7d4a plus #11235, and on main plus the mongodb binding removal branch. The mongodb change is not involved.
Likely mechanism (not verified)
The compile log shows that only the http case takes the extra step:
optimized_libs/no_auto.rs runs that rebuild as cargo build --release -p perry-stdlib-static -p perry-ext-http --features perry-stdlib/external-http-client-pump into target/perry-no-auto-http-pump/. perry-runtime-static is not in that invocation, so cargo can unify perry-runtime's features differently from the target/release/libperry_runtime.a that ends up in the same link. alloc-mimalloc is in perry-runtime's default features, and perry-runtime-static enables perry-runtime/default, so it is a feature that can differ between the two invocations. A mi_free on a pointer that was not allocated by mimalloc, reached from runtime code, fits an allocator split across the two archives. The existing link guard compares tokio compilations across archives (#10671, #507), but nothing compares the runtime's feature set.
Impact
A no-auto build of a program that pulls in node:http crashes on its first regex match. That includes the npm mongodb driver compiled from source: ConnectionString's constructor calls String.prototype.match on the URI inside new MongoClient(...). The auto-optimize build of the mongodb CRUD fixture links and matches Node byte for byte.
Possibly already fixed by #11226 (merged; Fixes #11174). With auto-optimize off, importing http rebuilt the stdlib without selecting perry-runtime in the same cargo invocation, so the runtime's default engines were dropped. That is the same cause suspected here. Needs a re-check on current main before anyone works on it.
Activity
proggeramlug commentedon Sep 24, 2026
Possibly already fixed by #11226 (merged; Fixes #11174). With auto-optimize off, importing http rebuilt the stdlib without selecting perry-runtime in the same cargo invocation, so the runtime's default engines were dropped. That is the same cause suspected here. Needs a re-check on current main before anyone works on it.
proggeramlug commentedon Sep 25, 2026
Fixed by #11226. Re-checked on current main by the #11263 agent: the repro matches Node.