nodejs / node-v0.x-archive

Moved to https://github.com/nodejs/node
34.42k stars 7.31k forks source link

emit('drain') is called from within write()'s path on TLS sockets #1841

Closed baudehlo closed 13 years ago

baudehlo commented 13 years ago

Example stacktrace:

[PROTOCOL] [queue/smtp_proxy] Error: Drained at pluggableStream. (queue/smtp_proxy:311:26) at pluggableStream.emit (events.js:81:20) at CleartextStream. (/Users/matt/Perl/Haraka/tls_socket.js:59:14) at CleartextStream.emit (events.js:61:17) at CleartextStream._pull (tls.js:374:10) at SecurePair._cycle (tls.js:558:20) at CleartextStream.write (tls.js:97:13) at pluggableStream.write (/Users/matt/Perl/Haraka/tls_socket.js:95:34) at Object.send_data (queue/smtp_proxy:150:47) at Plugin.hook_queue (queue/smtp_proxy:349:16)

The problem is the direct call to emit('drain') in _pull, which needs to be wrapped in a nextTick().

koichik commented 13 years ago

I think that it has fixed in 4cdf9d4 (v0.4 branch), but it is not yet released and merged to the master. Can you try the HEAD of v0.4 branch?

koichik commented 13 years ago

Closed by 493d3b9. Thanks for the report.