Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-473

Broken connection state raises "stopping only thread"

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 12_01_17
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      1.6.4 driver

      It looks like you can get your connection into a state where it raises the exception below when trying to perform a mongo operation, using something like the following:

      1. A surrounding piece of code set a Timeout.timeout
      2. This timeout expired while the socket checkin was in progress, and thus the checkin never completed.
      3. Thereafter, any time a socket checkout was attempted, the driver attempted to wait on a condition variable, causing the error.

      I observed this using the 1.6.4 driver. I did a brief scan of the 1.7.0 source, and I believe the relevant code hasn't been churned. I'm not sure what the right general fix would be here. One hacky specific fix would be that if there's only one thread, the driver should re-establish the connection rather than waiting on the condition variable (or perhaps just pretend the existing connection was checked in).

      Exception: stopping only thread
        note: use sleep to stop forever
      .../mongo-1.6.4/lib/mongo/util/pool.rb:297:in `wait'
      .../mongo-1.6.4/lib/mongo/util/pool.rb:297:in `checkout'
      .../mongo-1.6.4/lib/mongo/util/pool.rb:251:in `synchronize'
      .../mongo-1.6.4/lib/mongo/util/pool.rb:251:in `checkout'
      .../mongo-1.6.4/lib/mongo/util/pool.rb:244:in `loop'
      .../mongo-1.6.4/lib/mongo/util/pool.rb:244:in `checkout'
      .../mongo-1.6.4/lib/mongo/repl_set_connection.rb:439:in `get_socket_from_p
      ool'
      .../mongo-1.6.4/lib/mongo/repl_set_connection.rb:389:in `checkout_writer'
      .../mongo-1.6.4/lib/mongo/repl_set_connection.rb:337:in `call'
      .../mongo-1.6.4/lib/mongo/repl_set_connection.rb:337:in `checkout'
      .../mongo-1.6.4/lib/mongo/repl_set_connection.rb:388:in `checkout_writer'
      .../mongo-1.6.4/lib/mongo/networking.rb:77:in `send_message_with_safe_chec
      k'
      .../mongo-1.6.4/lib/mongo/collection.rb:441:in `update'
      .../mongo-1.6.4/lib/mongo/util/logging.rb:32:in `instrument'
      .../mongo-1.6.4/lib/mongo/collection.rb:439:in `update'
      .../mongo-1.6.4/lib/mongo/collection.rb:310:in `save'

            Assignee:
            emily.stolfo Emily Stolfo
            Reporter:
            gdb Greg Brockman
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: