-
Type: Bug
-
Resolution: Done
-
Priority: Minor - P4
-
Affects Version/s: None
-
Component/s: Implementation
-
Environment:Ubuntu 12.04 LTS 64-bit
The DBClientConnection::connect() call reports that it has a fixed 5-second timeout. On my system, this turns out to be 60 seconds.
Looking at the util/net/sock.cpp Socket::connect() call reveals the cause: the method used to enforce the 5 second timeout is a close() of the socket, which (on certain systems) causes the connect() to fail. At least on my system this is not the case. Instead, the connect() call continues and eventually times out with the system's timeout (60 seconds).
The appropriate way to do this timeout is using a select() call on the socket. Attached is a revised version of sock.cpp that implements the 5 second timeout appropriately, and works on my system.