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

Replica set seed connections cause ever-increasing socket usage

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 12_01_17
    • Affects Version/s: 1.8.2
    • Component/s: Replica Set
    • None
    • Environment:
      Ruby 1.9.3, Centos 5/Fedora 16

      I've been debugging Sidekiq workers eventually causing massive system issues due to hundreds of open sockets to my Mongo servers. I've managed to reproduce a failing case:

      require 'mongo'

      $client = Mongo::MongoReplicaSetClient.new(['192.168.4.139:27021'], :pool_size => 5)

      while true
      begin
      $stderr.puts $client["test"]["test"].find().first.inspect
      rescue
      ensure
      $stderr.puts "%s open file handles" % `lsof -p #

      {Process.pid}

      | grep 27021 | wc -l`.strip
      end
      end

      In this case, the given replica set seed node is up, but the other members are down. I'm not sure yet if replica set up/down state is relevant, but if you run that script, you'll notice that the number of open file descriptors rises (and will continue to until your system runs out of available FDs).

      I'm working on tracking down and patching it, but figured I'd report it anyhow.

            Assignee:
            brandon.black@10gen.com Brandon Black
            Reporter:
            cheald Chris Heald
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: