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
streams: stream._readableState is undefined on every Readable (undici's BodyReadable writes _readableState.dataEmitted) #11197
stream._readableState is undefined on every Readable in Perry: a plain new Readable(), a bare class X extends Readable {}, and a subclass reading it in its own constructor after super(). Node gives every Readable a ReadableState object, and a lot of real stream code reads and writes it directly.
This is the next undici blocker (#11046). With #11176, #11194 and the #11193 fix, the real undici 8.9.0 fixture's first request() now gets a response and builds its body. undici's BodyReadable (lib/api/readable.js) then runs this._readableState.dataEmitted = false in its constructor, and request() rejects with:
TypeError: Cannot set properties of null or undefined (setting 'dataEmitted')
undici also reads _readableState.endEmitted, .closeEmitted, .ended, .destroyed, .encoding and .length (lib/api/readable.js, lib/api/api-pipeline.js, lib/core/util.js, lib/core/request.js). So a static placeholder would move the failure, not fix it: these need to reflect live stream state.
in ctor: object
after ctor: object
plain Readable: object 65536
bare subclass: object
Perry origin/main2762714 (+ the #11193 fix; perry-dev, Linux x64, both PERRY_NO_AUTO_OPTIMIZE=1 and auto-optimize, .ts and .cts):
in ctor: undefined
after ctor: undefined
plain Readable: undefined undefined
bare subclass: undefined
Notes
Perry's native streams keep their state internally (node_stream*.rs). There is already a serialized _readableState in node_stream_json.rs, but no live object on the instance. A fix probably needs _readableState (and _writableState, which undici's api-stream.js reads via ?.) as an accessor-backed view over the internal state, with at least the fields above live. The dataEmitted write must be accepted too.
Activity