Uploaded image for project: 'PHP Legacy Driver'
  1. PHP Legacy Driver
  2. PHP-927

Random Uncaught exception 'MongoConnectionException' with message 'No candidate servers found'

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical - P2
    • Resolution: Works as Designed
    • Affects Version/s: 1.4.3, 1.4.4
    • Fix Version/s: None
    • Component/s: pecl-mongo
    • Environment:
      CentOS release 6.4 (Final)
      PHP 5.4.19 (cli) (built: Aug 22 2013 08:03:53)
      Running with PHP-FPM
      Dual Quad Core L5520
      72 Gig Ram
    • # Replies:
      9
    • Last comment by Customer:
      true

      Description

      I'm getting this error randomly on both of my servers. I upgraded the php driver just in case, and it's still happening.

      There is no election going on. The other server keeps working fine when the other fails.

      Both servers are running php-fpm feeding a 3rd one running nginx to load balance. Both servers are members of the replicaset, one of them is primary. A 3rd replica member is in a different location.

      On the server that's secondary:
      [18-Oct-2013 11:21:33 America/Los_Angeles] PHP Fatal error: Uncaught exception 'MongoConnectionException' with message 'No candidate servers found' in mongo.php:24
      Stack trace:
      #0 /mongo.php(24): MongoCollection->findOne()
      #1 /search.php(3): require('/...')
      #2

      {main}
      thrown in /mongo.php on line 24

      On the server that's primary:
      [18-Oct-2013 11:14:08 America/Los_Angeles] PHP Fatal error: Uncaught exception 'MongoCursorException' with message 'mongoservers5:27017: Remote server has closed the connection' in /mongo.php:24
      Stack trace:
      #0 /mongo.php(24): MongoCollection->findOne()
      #1 /index.php(4): require('/...')
      #2 {main}

      thrown in /mongo.php on line 24

      As soon as the error occurs, I went on in the mongo shell and issued an rs.status() – no election going on, everything normal. And as mentioned above, the 2nd server is still working fine. They both get the issue randomly though, and lasts a few minutes.

      {
      "set" : "mo0",
      "date" : ISODate("2013-10-18T18:28:41Z"),
      "myState" : 1,
      "members" : [

      { "_id" : 2, "name" : "mongoservers5:27017", "health" : 1, "state" : 1, "stateStr" : "PRIMARY", "uptime" : 1522248, "optime" : Timestamp(1382119446, 13), "optimeDate" : ISODate("2013-10-18T18:04:06Z"), "self" : true }

      ,

      { "_id" : 3, "name" : "mongoserverm:27017", "health" : 1, "state" : 2, "stateStr" : "SECONDARY", "uptime" : 116877, "optime" : Timestamp(1382119446, 1), "optimeDate" : ISODate("2013-10-18T18:04:06Z"), "lastHeartbeat" : ISODate("2013-10-18T18:04:06Z"), "lastHeartbeatRecv" : ISODate("2013-10-18T18:04:06Z"), "pingMs" : 77, "syncingTo" : "mongoservers5:27017" }

      ,

      { "_id" : 4, "name" : "mongoservers6:27017", "health" : 1, "state" : 2, "stateStr" : "SECONDARY", "uptime" : 1380934, "optime" : Timestamp(1382119446, 5), "optimeDate" : ISODate("2013-10-18T18:04:06Z"), "lastHeartbeat" : ISODate("2013-10-18T18:04:06Z"), "lastHeartbeatRecv" : ISODate("2013-10-18T18:04:06Z"), "pingMs" : 0, "syncingTo" : "mongoservers5:27017" }

      ],
      "ok" : 1
      }

      ^ I edited the server names.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since reply:
                6 years, 25 weeks, 5 days ago
                Date of 1st Reply: