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
undici: public request crashes reading length from undefined after llhttp loads #10889
A clean public-entry undici@8.9.0 request fixture compiles and links all 111 source modules on current main (f88acdaa1b), including undici's llhttp WebAssembly dependency, but fails at runtime before completing the local request:
TypeError: Cannot read properties of undefined (reading 'length')
at <anonymous>
This is the current verified undici blocker.
Reproduction shape
Install undici@8.9.0.
Add undici to perry.compilePackages.
Import { request } from the public undici entry point.
Start a local node:http server and request it.
Compile and run with Perry.
The clean source graph contains 111 compiled modules. No partial-codegen flag or internal package import is used.
Expected
The request completes and exposes the local server response, as under Node.
Actual
The executable throws while reading .length from an undefined value before the request completes.
Corrected provenance
The initial version of this issue reported undefined reference to js_webassembly_module_new. A coherent current-main build with Cargo available to Perry's auto-provisioning path correctly detects WebAssembly, builds perry-wasm-host, enables perry-runtime/wasm-host, and links successfully. That linker error came from the earlier build environment/artifact set and is not reproducible. After linking coherently, the runtime failure above reproduces.
Split from #10797 so undici can be tracked independently.
changed the title [-]undici: llhttp WebAssembly dependency fails to link js_webassembly_module_new[/-][+]undici: public request crashes reading length from undefined after llhttp loads[/+]on Sep 21, 2026
Root cause localized and fixed: PoolBase's computed instance-field keys were being remapped from their class-definition scope to synthetic constructor capture parameters. Those parameters are unbound when the StaticFieldSet key snapshots run, so [kClients] = [] was installed under the wrong key and Pool later failed at this[kClients].length (pool.js:101).
With the fix applied, that site is gone. The public fixture advances into the HTTP/1 parser and exposes a separate stream-contract failure at client-h1.js:323: Socket.read() returns undefined instead of the null sentinel undici checks. That next blocker is tracked in #10908.
Fixed in v0.5.1633 (merge train 253, 0fa3915293) by #10909 — fix(hir): preserve computed field key scope. The undici crash was not in llhttp itself: computed instance-field keys in nested and CommonJS-wrapped classes were rewritten to unbound constructor-capture parameters, so undici's symbol-keyed pool state never initialised under the symbols its request path reads. Verified by running a_computed_instance_field_key_is_not_a_constructor_capture (passes), and the full perry-hir suite is 471/0.
Activity
[-]undici: llhttp WebAssembly dependency fails to link js_webassembly_module_new[/-][+]undici: public request crashes reading length from undefined after llhttp loads[/+]proggeramlug commentedon Sep 21, 2026
Root cause localized and fixed:
PoolBase's computed instance-field keys were being remapped from their class-definition scope to synthetic constructor capture parameters. Those parameters are unbound when theStaticFieldSetkey snapshots run, so[kClients] = []was installed under the wrong key andPoollater failed atthis[kClients].length(pool.js:101).With the fix applied, that site is gone. The public fixture advances into the HTTP/1 parser and exposes a separate stream-contract failure at
client-h1.js:323:Socket.read()returnsundefinedinstead of thenullsentinel undici checks. That next blocker is tracked in #10908.fix(hir): preserve computed field key scope (#10889)
proggeramlug commentedon Sep 21, 2026
Fixed in v0.5.1633 (merge train 253,
0fa3915293) by #10909 —fix(hir): preserve computed field key scope. The undici crash was not in llhttp itself: computed instance-field keys in nested and CommonJS-wrapped classes were rewritten to unbound constructor-capture parameters, so undici's symbol-keyed pool state never initialised under the symbols its request path reads. Verified by runninga_computed_instance_field_key_is_not_a_constructor_capture(passes), and the fullperry-hirsuite is 471/0.