Open areth opened 5 years ago
The root of the issue in this recursion: https://github.com/dignifiedquire/pull-length-prefixed/blob/27d9f420c684ac7589dbac1b6986b68c7fadff0f/src/decode.js#L23-L30 To resolve the issue I was thinking about asynchronous excecution, and it works:
function next () {
setImmediate(() => {
_decodeFromReader(reader, opts, (err, msg) => {
if (err) return p.end(err)
p.push(msg)
next()
})
})
}
But I strongly doubt that the implicit async is acceptable in the pull-stream ecosystem. It seems, that decode()
have to be rewritten with a loop.
I could do this. Please share your thoughts.
In this example stack explodes at about 500 values of source:
This produces:
Full log https://github.com/areth/lp-highload/blob/master/exceptions.log.bak Repo to reproduce https://github.com/areth/lp-highload