diff options
author | Gil Pedersen <git@gpost.dk> | 2013-03-17 18:04:01 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2013-03-22 04:49:12 +0400 |
commit | c3aae9cf95749949194f5288bad7468a995b1162 (patch) | |
tree | d21a4f308bd0e36f5598493f6825d6854b469f8c /lib | |
parent | bfd16de125020551bf6fac42c01bc63d5fab90f5 (diff) |
stream: Fix stall in Transform under very specific conditions
The stall is exposed in the test, though the test itself asserts before
it stalls.
The test is constructed to replicate the stalling state of a complex
Passthrough usecase since I was not able to reliable trigger the stall.
Some of the preconditions for triggering the stall are:
* rs.length >= rs.highWaterMark
* !rs.needReadable
* _transform() handler that can return empty transforms
* multiple sync write() calls
Combined this can trigger a case where rs.reading is not cleared when
further progress requires this. The fix is to always clear rs.reading.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/_stream_transform.js | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/_stream_transform.js b/lib/_stream_transform.js index 1b6bbb00c9d..ec2b46a9534 100644 --- a/lib/_stream_transform.js +++ b/lib/_stream_transform.js @@ -101,6 +101,7 @@ function afterTransform(stream, er, data) { cb(er); var rs = stream._readableState; + rs.reading = false; if (rs.needReadable || rs.length < rs.highWaterMark) { stream._read(rs.highWaterMark); } |