Reputation: 930
I've got a simple tracking app running on Node.JS which basically parses the URL it's given and returns a 1x1 pixel gif image. A couple of times per day I get the following error in the log:
Error: Socket is not writable
at Socket._writeOut (net.js:391:11)
at Socket.write (net.js:377:17)
at ServerResponse._writeRaw (http.js:392:28)
at ServerResponse._send (http.js:372:15)
at ServerResponse.write (http.js:622:16)
at ServerResponse.end (http.js:682:16)
at /var/www/app.js:221:7
at Server.<anonymous> (/var/www/app.js:234:3)
at Server.emit (events.js:67:17)
at HTTPParser.onIncoming (http.js:1124:12)
I have absolutely no clue what's causing this. Any ideas where to look? (it happens on different UAs although until now I've only seen it happen when the request is coming from a Windows machine but considering the vast majority of machines is Windows this doesn't have to mean anything).
Upvotes: 4
Views: 4622
Reputation: 11
This issue has been addresses, as it is actually likely due to the way you are using the pool (using a connection from the pool even after it was mean to be closed).
The fix is to use client.pauseDrain() to allow a single connection in the pool to be reused.
More information, and the source for this answer is here.
Upvotes: 1
Reputation: 13677
You should file a bug to https://github.com/joyent/node/issues?state=open
It could be a violation of the usual stream write protocol in your module or in system HTTP module: if write() fails, wait for drain() event. So you should look for failed writes in your code and HTTP javascript module compiled into /usr/bin/node binary and double-check that drain waiting is obeyed. Drain events are rare, so it's possible that this bug has been unnoticed for a long time.
Upvotes: 1