Hi Pedro,
Thank you for your input.

> You are probably triggering response.end() more than once.

Yes, that would be my guess as well.   However, in the code snippet below:

   var proxy = new httpProxy.HttpProxy({target: {host: ..., port: ...}});
   ...
   proxy.proxyRequest(req,res);

i simply proxy the HTTP request on via  "proxy.proxyRequest(req,res);" so i
don't explicitly invoke "response.end()".   That's where i'm stuck.  In
general, what is a surefire way to track down similar problems
deterministically?

A little background info here: my Node.js server is a reverse proxy (with
the http-proxy module) as stated earlier and has been running fine for more
than one year.  The recent crashes happened when someone carried out some
[stress|load] test against my server.  The server crashed in the middle of
the load test.

What i also noticed is when my Node.js server crashed, the response from
the target server is 405 (not sure that's true in all crashes since the
crash happened so rarely).   Since the crash rarely happens (only in the
load test), i can't conveniently resort to [Node.js | Google V8] debuggers.

Thanks.


On Sat, Mar 8, 2014 at 6:01 PM, Pedro Narciso García Revington <
[email protected]> wrote:

> You are probably triggering response.end() more than once.
> http://nodejs.org/api/http.html#http_class_http_serverresponse
>
> El sábado, 8 de marzo de 2014 04:16:29 UTC+1, ming escribió:
>
>> Hi,
>> i've been running a reverse proxy (with the http-proxy module) on Node.js
>> 0.10.24 for a while after i migrated from 0.8.22.    To my surprise, i
>> again ran into the annoying
>>    Error: Can't render headers after they are sent to the client.
>> so my Node.js server crashed (complete stack trace below in <1>):
>>
>> According to ChangeLog of 0.9.3 at
>>    http://nodejs.org/changelog.html
>> there is the following:
>>    http: add response.headersSent property (Pavel Lang)
>>
>> Should this error be squashed after 0.9.3 release with the headersSent
>> check?   What am i missing?
>>
>> <1>
>> ---------------------------------------------------------------
>>   Error: Can't render headers after they are sent to the client.
>>     at ServerResponse.OutgoingMessage._renderHeaders (http.js:733:11)
>>     at ServerResponse.writeHead (http.js:1150:20)
>>     at ClientRequest.proxyError (/.../node_modules/http-proxy/
>> lib/node-http-proxy/http-proxy.js:213:9)
>>     at ClientRequest.g (events.js:180:16)
>>     at ClientRequest.EventEmitter.emit (events.js:95:17)
>>     at Socket.socketErrorListener (http.js:1547:9)
>>     at Socket.EventEmitter.emit (events.js:95:17)
>>     at net.js:441:14
>>     at process._tickDomainCallback (node.js:459:13)
>> ---------------------------------------------------------------
>>
>> The pertinent code snippet is as follows:
>> ---------------------------------------------------------------
>>   var proxyDomain = domain.create();
>>   proxyDomain.on('error', ...);
>>   proxyDomain.on('proxyError', ...);
>>
>>   spdy.createServer
>>   (
>>     ...
>>     proxyDomain.run
>>     (
>>       function()
>>       {
>>         var proxy = new httpProxy.HttpProxy({target: {host: ..., port:
>> ...}});
>>         ...
>>         proxy.proxyRequest(req,res);
>>       }
>>     );
>>   );
>> ---------------------------------------------------------------
>>
>>
>> Anything blatantly wrong?
>>
>> Thanks for reading.
>>
>>
>>  --
> --
> 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 [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "nodejs" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/nodejs/FWcUXFAKqiY/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

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

--- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to