0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/lib
isaacs cd2b9f542c stream: Avoid nextTick warning filling read buffer
In the function that pre-emptively fills the Readable queue, it relies
on a recursion through:

stream.push(chunk) ->
maybeReadMore(stream, state) ->
  if (not reading more and < hwm) stream.read(0) ->
stream._read() ->
stream.push(chunk) -> repeat.

Since this was only calling read() a single time, and then relying on a
future nextTick to collect more data, it ends up causing a nextTick
recursion error (and potentially a RangeError, even) if you have a very
high highWaterMark, and are getting very small chunks pushed
synchronously in _read (as happens with TLS, or many simple test
streams).

This change implements a new approach, so that read(0) is called
repeatedly as long as it is effective (that is, the length keeps
increasing), and thus quickly fills up the buffer for streams such as
these, without any stacks overflowing.
2013-03-10 11:04:48 -07:00
..
_debugger.js streams2: Call read(0) on resume() 2012-12-14 10:52:28 -08:00
_linklist.js
_stream_duplex.js stdio: Set readable/writable flags properly 2013-01-17 10:42:44 -08:00
_stream_passthrough.js stream: _write takes an encoding argument 2013-03-05 14:27:15 -08:00
_stream_readable.js stream: Avoid nextTick warning filling read buffer 2013-03-10 11:04:48 -07:00
_stream_transform.js stream: Emit error on stream object, not global 2013-03-08 07:35:41 -08:00
_stream_writable.js stream: Remove unnecessary nextTick usage in Writable 2013-03-06 11:44:29 -08:00
assert.js assert: improve support for new execution contexts 2012-12-29 11:19:14 -08:00
buffer.js buffer: check logic simplification 2013-02-20 20:34:34 +01:00
child_process.js child_process: support sending dgram socket 2013-03-07 17:51:17 +01:00
cluster.js cluster: Rename destroy() to kill(signal=SIGTERM) 2013-03-03 17:26:38 -08:00
console.js console: Support formatting options in trace() 2013-01-18 15:39:08 -08:00
constants.js
crypto.js stream: _write takes an encoding argument 2013-03-05 14:27:15 -08:00
dgram.js child_process: support sending dgram socket 2013-03-07 17:51:17 +01:00
dns.js DNS: Support NAPTR queries 2013-03-06 14:31:22 +04:00
domain.js process: separate nextTick domain logic 2013-02-27 16:37:10 -08:00
events.js events: Handle missing error obj when domains in use 2013-03-10 09:53:24 -07:00
freelist.js
fs.js stream: Remove bufferSize option 2013-03-06 11:44:30 -08:00
http.js http: ServerRequest does not timeout after 'end' 2013-03-10 20:14:43 +09:00
https.js https: optimize https.createConnection() 2012-12-28 16:42:51 +01:00
module.js core: Remove the nextTick for running the main file 2013-02-27 16:29:36 -08:00
net.js net: use close callback, not process.nextTick 2013-03-06 16:15:18 +01:00
os.js os: rename tmpDir() to tmpdir() for consistency 2013-01-30 04:24:58 +01:00
path.js lint 2013-02-22 16:30:27 -08:00
punycode.js punycode: update to v1.2.0 2013-01-16 16:53:11 +01:00
querystring.js
readline.js events: add check for listeners length 2013-03-01 17:36:47 -08:00
repl.js make repl compatible with domains 2013-03-03 15:28:45 -08:00
stream.js events: add check for listeners length 2013-03-01 17:36:47 -08:00
string_decoder.js Don't allow invalid encodings in StringDecoder class 2012-12-13 17:00:22 -08:00
sys.js
timers.js timers: consistent this keyword in setImmediate 2013-03-09 08:19:57 -08:00
tls.js stream: _write takes an encoding argument 2013-03-05 14:27:15 -08:00
tty.js lib, src: remove errno global 2013-02-28 23:11:47 +01:00
url.js url: make url.format escape delimiters in path and query 2012-10-30 09:16:13 -07:00
util.js node: Add --throw-deprecation 2013-03-06 11:44:29 -08:00
vm.js
zlib.js zlib: Manage flush flags appropriately 2013-03-08 18:56:31 -08:00