Begin forwarded message:

> From: Jorge Chamorro Bieling <[email protected]>
> Date: March 14, 2012 12:08:48 AM GMT+01:00
> To: Isaac Schlueter <[email protected]>
> Subject: Re: Now a simple control-S in the terminal can grind to a halt any 
> node.js server.
> On Mar 13, 2012, at 11:56 PM, Isaac Schlueter wrote:
>> 
>> On Tue, Mar 13, 2012 at 15:04, Jorge Chamorro Bieling <[email protected]> 
>> wrote:
>>> Because now, it seems, that write()ing to stdout is blocking...
>>> 
>>> For example:
>>> 
>>> 1.- paste this in a shell:
>>> 
>>> node << EOF
>>> require('http').createServer(function(req, res) {
>>> res.end("FAST");
>>> process.stdout.write('.');
>>> }).listen(8000);
>>> EOF
>>> 
>>> 
>>> 2.- and hit control-S
>>> 
>>> 3.- then do an `ab -t 2 http://127.0.0.1:8000` in another shell, and all 
>>> you'll get is :
>>> 
>>> apr_poll: The timeout specified has expired (70007)
>>> 
>>> Why? Because the node server is totally blocked by the control-S!
>>> 
>>> Are you aware of that ?
>>> Isn't that something to be concerned about ?
>>> Why did you change write()ing to stdout to blocking ?
>>> 
>>> Cheers,
>>> --
>>> Jorge.
> 
> 
>> This API change was made quite some time ago.  It prevents a lot of
>> confusion and edge-case bugs.
>> 
>> If it causes problems for you, please bring it up on the
>> [email protected] mailing list, where API changes can be
>> discussed and explored from multiple angles.
>> 
>> In the meantime, I would not recommend writing to stdout on every
>> request if it might be blocked.
>> 
> 
> 
> Isaac,
> 
> It would be equally frozen whether it wrote on every request or just once.

A warning, a message, anything, just a single char written to stdout could now 
freeze a node.js server.
-- 
Jorge.

Reply via email to