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
Problem: Although duplexify auto-wraps readable streams that do not appear to be streams2 implementations, errors emitted by the streams2 wrap (e.g. bubbled up from the wrapped stream) are unhandled and will mostly likely crash the current process unless you're lucky enough for the current call stack to have a try/catch in it somewhere.
An example from my use case is in the Azure Storage SDK where most of its stream functions return a custom stream instance called a ChunkStream which, to duplexify, doesn't appear to be streams2.
Repro:
>process.version'v8.11.4'>through2=require("through2"),duplexify=require("duplexify"),ChunkStream=require("azure-storage/lib/common/common.node").ChunkStream...snip...// Streams2>thru=through2(),dup=duplexify(null,thru).on("error",console.log.bind(null,"dup caught it"))...snip...>thru.emit("error",newError("boo"))// OK; the only evidence of the error is through the handler I establisheddupcaughtit Error: boo...snip(callstack)...// Non-Streams2>chunk=newChunkStream(),dup=duplexify(null,chunk).on("error",console.log.bind(null,"dup caught it"))...snip...>chunk.emit("error",newError("boo"))
Error: boo// <<< OH NO! This is an unhandled error and may crash the process// The error handler on dup also runs because unhandled errors don't crash the REPLdupcaughtit{Error: boo...snip...
Suggested Fix: Apply equivalent "end-of-stream" behavior to this._readable2 as this._readable has.
The text was updated successfully, but these errors were encountered:
Problem: Although
duplexify
auto-wraps readable streams that do not appear to be streams2 implementations, errors emitted by the streams2 wrap (e.g. bubbled up from the wrapped stream) are unhandled and will mostly likely crash the current process unless you're lucky enough for the current call stack to have atry/catch
in it somewhere.An example from my use case is in the Azure Storage SDK where most of its stream functions return a custom stream instance called a ChunkStream which, to
duplexify
, doesn't appear to be streams2.Repro:
Suggested Fix: Apply equivalent "
end-of-stream
" behavior tothis._readable2
asthis._readable
has.The text was updated successfully, but these errors were encountered: