Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-34747

find() and findOne() hangs when invoked from mongos

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.6.4
    • Component/s: Sharding
    • None
    • ALL
    • Hide

      1) Connect to mongos

      2) select database

      3) invoke findOne()

      (it hangs and does not return result)

       

      The one that works:

      1) Connect to primary of any of the shards

      2) select database

      3) invoke findOne()

      (result is immediately returned)

      Show
      1) Connect to mongos 2) select database 3) invoke findOne() (it hangs and does not return result)   The one that works: 1) Connect to primary of any of the shards 2) select database 3) invoke findOne() (result is immediately returned)

      A MongoDB v3.6.4 database on Debian 9.4 with a large sharded collection with two shards and WiredTiger engine hangs when issuing a findOne() or find() command without any parameters. The collection has only the default index on the _id key.

      If findOne() or find() is invoked on any of the shards then it works immediately. If it is invoked on a mongos then it hangs.

      With db.currentOp() this can be seen after findOne() is invoked:

      { 
       "host" : "db1:27017",
       "desc" : "conn277",
       "connectionId" : 277,
       "client" : "10.240.137.10:57294",
       "appName" : "MongoDB Shell",
       "clientMetadata" : {
       "application" : {
       "name" : "MongoDB Shell"
       },
       "driver" : {
       "name" : "MongoDB Internal Client",
       "version" : "3.6.4"
       },
       "os" : {
       "type" : "Linux",
       "name" : "PRETTY_NAME=\"Debian GNU/Linux 9 (stretch)\"",
       "architecture" : "x86_64",
       "version" : "Kernel 4.9.0-6-amd64"
       },
       "mongos" : {
       "host" : "m1:27017",
       "client" : "10.240.0.0:38190",
       "version" : "3.6.4"
       }
       },
       "active" : true,
       "currentOpTime" : "2018-04-28T08:13:26.371+0200",
       "opid" : 2148656,
       "secs_running" : NumberLong(4),
       "microsecs_running" : NumberLong(4344989),
       "op" : "query",
       "ns" : "somedb.somecol",
       "command" : {
       "find" : "somecol",
       "limit" : NumberLong(1),
       "shardVersion" : [
       Timestamp(188696, 1),
       ObjectId("5ac6b2abbd8bbc9f42f34a39")
       ],
       "$clusterTime" : {
       "clusterTime" : Timestamp(1524896001, 1),
       "signature" : {
       "hash" : BinData(0,"RuV/v6Qm7H9AvPMVRNH0jkdIwRM="),
       "keyId" : NumberLong("6540622458888650772")
       }
       },
       "$client" : {
       "application" : {
       "name" : "MongoDB Shell"
       },
       "driver" : {
       "name" : "MongoDB Internal Client",
       "version" : "3.6.4"
       },
       "os" : {
       "type" : "Linux",
       "name" : "PRETTY_NAME=\"Debian GNU/Linux 9 (stretch)\"",
       "architecture" : "x86_64",
       "version" : "Kernel 4.9.0-6-amd64"
       },
       "mongos" : {
       "host" : "m1:27017",
       "client" : "10.240.0.0:38190",
       "version" : "3.6.4"
       }
       },
       "$configServerState" : {
       "opTime" : {
       "ts" : Timestamp(1524896001, 1),
       "t" : NumberLong(3)
       }
       },
       "$db" : "feedback"
       },
       "planSummary" : "COLLSCAN",
       "numYields" : 803,
       "locks" : {
       "Global" : "r",
       "Database" : "r",
       "Collection" : "r"
       },
       "waitingForLock" : false,
       "lockStats" : {
       "Global" : {
       "acquireCount" : {
       "r" : NumberLong(1608)
       }
       },
       "Database" : {
       "acquireCount" : {
       "r" : NumberLong(804)
       }
       },
       "Collection" : {
       "acquireCount" : {
       "r" : NumberLong(804)
       }
       }
       }
       },
      

            Assignee:
            kelsey.schubert@mongodb.com Kelsey Schubert
            Reporter:
            sasa.skevin@gmail.com Sasa Skevin
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: