I am using node 0.6.10 version and I got the error today while uploading a 
file to amazon S3.
I am using knox(@0.0.9) module with request(@2.9.153).

[2012-03-06 22:33:34.251] [ERROR] choicebeat - Error uploading to S3: 
Error: soc
ket hang up
    at createHangUpError (http.js:1104:15)
    at Socket.<anonymous> (http.js:1207:27)
    at Socket.emit (events.js:88:20)
    at Array.0 (net.js:320:10)
    at EventEmitter._tickCallback (node.js:192:40)

Looks like the issue was fixed. Am I using any older version ?

On Thursday, 23 June 2011 05:16:06 UTC+5:30, murvinlai wrote:
>
> You can try  (temporary ) edit the node.js library.   lib\http.js   
> search for socket.setTimeout    the default timeout should be 2 * 60 * 
> 1000 = 2 minutes , instead of 20 seconds.  You can change that value.
>
> however, if your remote client has a slow response, then you will get a 
> lot of timeout.  
>
> Also, a warning is that, if you let your process run for long time, and 
> the socket opened (for connection pool) is over your maxSockets, you may 
> not be able to establish any new http.request.   
>
> before a formal fix, I suggest the followings:
> 1) increase your maxSocket (and also your OS one.  ulimit -a   and use 
> ulimit -n   to increase it , or change the /etc/security/limits.conf 
>  Incraese soft and hard.  (where hard > soft). e.g   * soft  nofile  10000 
>     * hard nofile 12000
>
> 2) catch http.request error.  i.e.:
> var clientRequest = http.request (... );
> clientRequest.on ('error', function() {  clientRequest.abort() } );
>
> Although socket timeout will kill and free up the socket, but I find out 
> doing that will save you more socket.
>
> 3) lower your socket timeout. change the http.js  and then "Make" again. 
>
>
> On Wed, Jun 22, 2011 at 4:06 PM, Kiran <[email protected]> wrote:
>
>> Has anybody else solved this problem. I am having a similar issue.
>> When I am using Apache Bench to test my node server connecting to a
>> remote server, i occasionally get a hang of the entire Node process
>> for 20 seconds. THe number 20 is key because it is the default socket
>> timeout in Node so somehow having a bad socket is causing a real
>> problem with nodes ability to be fully async and performant. Is there
>> a way to reduce the timeout and/or is there a way to get this issue to
>> be resolved or at least a patch to the native code that shows were
>> this might be a problem.
>>
>> Kiran
>>
>> On Jun 20, 2:27 pm, murvinlai <[email protected]> wrote:
>> > I haven't heard any news yet.  Here is my post in github:
>> https://gist.github.com/1032413
>> > however, I get one of the core developers to take a look into this
>> > problem. :)
>> >
>> > What is "no route to host"?
>> >
>> > Please see my code in the link I provide.   I have a very controlled
>> > testing.   I think when doing remote call, no matter how many socket
>> > you set (e.g. maxSockets= 1000), socket will break /hangupbecause
>> > of the client's side response being timeout by whatever reason.  Then
>> > once that socket has problem, it will never be recovered.   If you 
>> useupall the good sockets, then your program cannot make any
>> > http.request and you can declare your node die.
>> >
>> > There is a get around solution I'm using before they comeupwith the
>> > correct solution.
>> > 1)  use Agent, and set Agent.maxSockets = big number that matches with
>> > your ulimit.   And http.options.headers.Connection:'keep-alive'
>> > 2) Make your own timeout route.  If it times out, make sure to call
>> > http.clientRequest.abort();   But, your socket still die, just that it
>> > won't timeout and the socket timeout again.
>> > 3) When timeout or on.('error') with error message is "sockethangup"
>> > more than certain number of times, (e.g. 100), then kill and restart
>> > node.  I don't know if just restart http.server will work, but I'm
>> > sure restarting node will work.
>> > 4) To restart node inside code, I use   pgte/fugue  .
>> https://github.com/pgte/fugue
>> > I have done some testings and it looks good.
>> >
>> > This workaround  seems to be promising.  But, if you use it, please
>> > let me know if you find out anything. :)  Thanks.
>> >
>> > On Jun 18, 11:55 pm, Luca922 <arne%[email protected]>
>> > wrote:
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > > Any news on this issue?
>> >
>> > > The sockethangupseems to happen on 0.5pre as well, usually in a
>> > > situation where a "no route to host" occurs.
>> >
>> > > The problem can be reproduced by us as we have one EC2 box constantly
>> > > doing http.requests to our own server. This worked perfectly fine
>> > > until we replaced our server with a more powerful box in a different
>> > > data center. For some reason, our monitoring reports that - only on
>> > > two or three requests a day - the EC2 cannot find the route to our new
>> > > server. No problems like that with the old server. Anyway, this is
>> > > when Node gets stuck.
>> >
>> > > Luca
>>
>> --
>> 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.
>>
>>
>

-- 
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

Reply via email to