According to the docs, POSIX signals are mapped to events. I was planning on just catching them. I assume that's how the "press ctrlC again to exit" is implemented for the REPL. Corrections? On Mar 21, 2012 6:04 AM, "Jorge" <jo...@jorgechamorro.com> wrote:
> On Mar 21, 2012, at 10:56 AM, billywhizz wrote: > > > could anyone enlighten me on why writing to stdout and stderr now > blocks? also, do we have a list somewhere of which methods in node.js block > by default? to start the ball rolling: > > > > process.stdout.write (unless stdout is a pipe) > > process.stderr.write (unless stderr is a pipe) > > process.setgid > > process.setuid > > util.debug > > console.log|warn|error|dir|timeEnd > > fs.*Sync > > I asked the same question recently : > "Now a simple control-S in the terminal can grind to a halt any node.js > server." > < > http://groups.google.com/group/nodejs-dev/browse_thread/thread/92333182b1fd237e# > > > > To think that a single control-S could halt my node server makes me feel > nervous. > OTOH, it's true that a control-C would be worse. > But even so... > > On Mar 14, 2012, at 10:46 AM, Jorge wrote: > > > Begin forwarded message: > > > >> From: Jorge Chamorro Bieling <biel...@terra.es> > >> Date: March 14, 2012 12:08:48 AM GMT+01:00 > >> To: Isaac Schlueter <i...@izs.me> > >> 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 < > biel...@terra.es> 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 > >>> nodejs-...@googlegroups.com 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. > > -- > Job Board: http://jobs.nodejs.org/ > Posting guidelines: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > You received this message because you are subscribed to the Google > Groups "nodejs" group. > To post to this group, send email to nodejs@googlegroups.com > To unsubscribe from this group, send email to > nodejs+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en > -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en