need help debugging server app that silently stops

97 views
Skip to first unread message

Mark Hahn

unread,
Sep 29, 2015, 8:13:03 AM9/29/15
to nodejs
I have a pretty simple server using the normal pattern containing `http.createServer`.  When testing, it works great.  But when the server has been sitting idle with no access for a few hours it behaves strangely.

After the idle time, when I try to load the site the server responds perfectly for one request.  The result gets back to the client.  On the second and later requests the client reports "net::ERR_CONNECTION_RESET".  The log on the server from my console.log statements shows the first interaction and then abruptly ends.  There is no error.  Looking at the process list shows the node process died silently with no exception printed out.

I have been going crazy trying to figure out how to debug this.  Peppering my code with debug logging shows nothing.  I put in memory/heap checking and gave the site some traffic and there was no memory leak.  Also, having a problem after being idle doesn't match any resource exhaustion I can think of.

Does anyone have any idea what can cause silent dying?  Is there some debug option I can enable inside of node?  It would be great to observe the last thing node executed.

Michael Mathy

unread,
Sep 29, 2015, 11:10:45 AM9/29/15
to nod...@googlegroups.com
Hello Mark

Could you post your code so that we can check ?


Michael Mathy
QuickelSoft
http://www.quickelsoft.com

--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 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 unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/b480e59d-9b95-4c4f-8494-a7f7645a9d7c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mark Hahn

unread,
Oct 1, 2015, 1:12:25 AM10/1/15
to nodejs
I found the problem.  I was calling result.writeHead and result.end in the callback from the static file server module "node-static", which had already called them.

I am blown away that this would work fine and then die when idle for a few hours.  Also I am surprised that node could silently close.  So there is an "irregularity", if not bug, in node.  It should never just disappear.

This was the hardest bug for me to chase down in 45 years of programming.  Of course it might be because I'm getting senile.  :-)

Matt

unread,
Oct 1, 2015, 1:12:32 AM10/1/15
to nod...@googlegroups.com

Mark Hahn

unread,
Oct 3, 2015, 10:30:58 PM10/3/15
to nodejs
> Have you tried setting NODE_DEBUG?

 No, but I'll remember that.  It seems a little limited but worth a try.
Reply all
Reply to author
Forward
0 new messages