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