Forever not flushing logs it seems - has anyone seen this?

307 views
Skip to first unread message

Andrew Chilton

unread,
Jan 16, 2012, 5:21:54 PM1/16/12
to nod...@googlegroups.com
Hi all,

I've noticed that sometimes 'forever' outputs all, some or none of the
{forever,access,error} logs to file. I think it may just depend on
when things get flushed ... which is fine. However, when I tell
forever to stop my process, I'd expect it to flush the logs then and
there so that I have a complete copy of everything.

I've got a small example which recreates it on my machine and on a
server (with slightly different final file sizes). Clone the following
repo, run npm install and then run the test.sh file (making sure you
read it first so you can see I'm not doing anything crazy on your
machine). The README has more info.

* https://gist.github.com/1623039

$ git clone git://gist.github.com/1623039.git gist-1623039

If anyone gets similar, different or correct results I'd be keen to
know whether it is just me or whether it is a possible bug in forever
(unless this is actually expected).

Many thanks,
Andy

--
Andrew Chilton
e: chi...@appsattic.com
w: http://www.appsattic.com/

Charlie Robbins

unread,
Jan 17, 2012, 1:04:10 AM1/17/12
to nod...@googlegroups.com
The best way to get a response on this is to open an issue on forever: https://github.com/nodejitsu/forever/issues

That being said, I think I can shed some light on what's going on here. Forever stops processes by calling `child_process.kill()` which sends a signal to the process to shutdown. To my knowledge, the node.js event loop should wait for the streams to flush before shutting down. This appears to be not the case and indeterministic in nature. 

Not sure the best way to ensure that the tail of the log is always flushed on a `forever stop` command.

--
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 nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Andrew Chilton

unread,
Jan 17, 2012, 2:38:07 AM1/17/12
to nod...@googlegroups.com
On 17 January 2012 19:04, Charlie Robbins <charlie...@gmail.com> wrote:
> The best way to get a response on this is to open an issue on forever:
> https://github.com/nodejitsu/forever/issues

Ok, thanks Charlie. I'll write it up and put an issue in over there. I
just wanted to check with anyone first to see if it was just me or
other people were seeing the same things. :)

Cheers,

Reply all
Reply to author
Forward
0 new messages