Uploaded image for project: 'C++ Driver'
  1. C++ Driver
  2. CXX-291

5 second connection timeout not working

      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.

        1. sock.cpp
          24 kB
          Lee Dixon

            Assignee:
            tyler@10gen.com Tyler Brock
            Reporter:
            jleedixon Lee Dixon
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: