Am Mittwoch, den 04.04.2012, 08:12 -0700 schrieb Masiar:
>[ Seldom Pending connections ]
> My question is: where did this small percentage of clients got lost? I
> can see the log of the server and after the majority of connections
> finishes, the server doesn't log anything else, like it's not
> receiving anything. My thought is that the server lost some connection
> while dealing with the others. The server is not simply answering with
> hello world, it's performing operations and connecting to a database.
> Moreover every client does more than one connection to the server
> (once one finishes another one starts, it's the flow of my
> application, at least 2 connections per client).
>
> What do you guys think?
>
> Masiar
>
Very often this sounds like a forgotten callback call.
e.g.
var server = http.createServer (function (req, res) {
a.doSomething (function () {
b.doSomething (function () {
// reply request
});
});
})
Now if b.doSomething forgets to callback (happens often on error cases);
you are stuck with a pending connection.
What can you do?
- Check your code
(e.g. return "error"; instead of return callback (error))
- Check your libraries code (I had similar problems with older versions
of the mysql library)
- Do some monitoring:
function onRequest (req, response) {
var timeout = setTimeout (function () { console.log ("This call took
very long!"); }, 10000);
a.doSomeComplicatedOperations (function () {
clearTimeout (timeout))
// do the response
});
}
Greetings, nob
--
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