sometimes there is a bug (~30%):
Failed to connect to: IP:2333: Read timed out after reading 0 bytes, waited for 0.000000 seconds
In all cases. What is this?
When the client takes too much time to connect to MongodB server than the preset timeout value, it can result in error. And the fix involves in raising the timeout limits on the MongoDB client. For this, we first check with the customer on the settings that they use on their client. We then compare the values set in the MongoDB server.
When the client takes too much time to connect to MongodB server than the preset timeout value, it can result in error. And the fix involves in raising the timeout limits on the MongoDB client. For this, we first check with the customer on the settings that they use on their client.
This error is most common with MongoDB & happens when the connection gets dropped by the firewall. So, to solve the problem our Support Engineers opened the firewall settings on the server side and allowed the corresponding IP to allow connections.
It may be intermittent and not happen all the time. But from the drivers perspective it is timing out trying to select a server. The log message just shows you the current view of the servers after selection has failed, which is it is in the process of connecting to the mongo1 node.
I had the exact same bug. The solution is to set a timeout for your requests.
You can do a $cursor->timeout(-1);
on each of your cursors.
Or simply add MongoCursor::$timeout = -1;
in your index/connection file.
-1 is to set an infinite timeout. You can also put a value in milliseconds if you don't want infinite.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With