marcello3d / node-mongolian

[project inactive] Mongolian DeadBeef is an awesome Mongo DB driver for node.js
https://groups.google.com/group/node-mongolian
zlib License
350 stars 50 forks source link

Inserting object fails on 'Connection closed' #95

Open yosefd opened 12 years ago

yosefd commented 12 years ago

On attempt to insert object after a period of time collection is not used, I experience failure with the error above.

It looks that mongolian keeps TCP connection to the server, but doesn't identify the connection was closed. On attempt to write into the socket, it probably identifies that the connection was closed and returns failure. It also takes time before error is returned (probably TCP resends timeout).

I run into this problem probably because of network components standing between client and mongo. I suspect that Azure load balancer closes TCP connections, though i am not sure.

Assuming server disconnects in such a way you don't get any notification from the network stack, I think you should attempt to reconnect and to fail only if reconnect fails.