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

1.4.0 connection issue with the list of known unavailable hosts

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: 1.4.0
    • Fix Version/s: None
    • Component/s: pecl-mongo
    • Environment:
    • # Replies:
      2
    • Last comment by Customer:
      true

      Description

      Mr. H. Magnusson told me about a new feature: the list of know unavailable host, hoping to avoid losing time while trying to reconnect on each request to any unavalaible host.

      Before running a new test, I've reconfigure my servers from scratch and issued a 'pecl upgrade mongo' on my web server.

      I connect a mongoClient as following:

      <?php
      echo "<pre><p/> [Welcome in Test_Script] <br/>"; echo "<p/></pre>";
       
      $mongoClient = new MongoClient(
          "mongodb://192.168.36.107:20010,192.168.36.108:20010,192.168.36.109:20011",
          array("replicaSet" => "rs1")
      );	//MongoClient Object
      echo "<pre><p/> [dump mongoClient] : <br/>"; var_dump($mongoClient); echo "<p/></pre>";
      echo "<pre><p/> [dump mongoClient->hosts] : <br/>"; var_dump($mongoClient->getHosts()); echo "<p/></pre>";
       
      $currentDB = $mongoClient->selectDB('beGallery');	//MongoDB Object
      echo "<pre><p/> [dump currentDB] : <br/>"; var_dump($currentDB); echo "<p/></pre>";
       
      $grifs = $currentDB->getGridFS();	//GridFS Object
      echo "<pre><p/> [dump grifs] : <br/>"; var_dump($grifs); echo "<p/></pre>";
       
      $dataFilePath = '/var/www/shared/photos_en_commande/134070/dsc01300_4ngCPfCHZXAKBXjNlYJEX6GV1yajTuCw6HWsM9aL4A6e8EQGB8.jpg';
      $mongo_id = $grifs->storeFile($dataFilePath);	//MongoID
      echo "<pre><p/> [dump mongo_id] : <br/>"; var_dump($mongo_id); echo "<p/></pre>";
       
      ?>

      The result is an empty page with :

      Erreur 324 (net::ERR_EMPTY_RESPONSE)

      But, if I remove the second parametre in the connection method, as following:

      $mongoClient = new MongoClient("mongodb://192.168.36.107:20010,192.168.36.108:20010,192.168.36.109:20011");	//MongoClient Object

      I have:

       [Welcome in Test_Script] 
       
       [dump mongoClient] : 
      object(MongoClient)#1 (4) {
        ["connected"]=>
        bool(true)
        ["status"]=>
        NULL
        ["server":protected]=>
        NULL
        ["persistent":protected]=>
        NULL
      }
       
       [dump mongoClient->hosts] : 
      array(3) {
        ["192.168.36.107:20010;-;X;20244"]=>
        array(6) {
          ["host"]=>
          string(14) "192.168.36.107"
          ["port"]=>
          int(20010)
          ["health"]=>
          int(1)
          ["state"]=>
          int(0)
          ["ping"]=>
          int(0)
          ["lastPing"]=>
          int(1369390903)
        }
        ["192.168.36.108:20010;-;X;20244"]=>
        array(6) {
          ["host"]=>
          string(14) "192.168.36.108"
          ["port"]=>
          int(20010)
          ["health"]=>
          int(1)
          ["state"]=>
          int(0)
          ["ping"]=>
          int(0)
          ["lastPing"]=>
          int(1369390903)
        }
        ["192.168.36.109:20011;-;X;20244"]=>
        array(6) {
          ["host"]=>
          string(14) "192.168.36.109"
          ["port"]=>
          int(20011)
          ["health"]=>
          int(1)
          ["state"]=>
          int(0)
          ["ping"]=>
          int(0)
          ["lastPing"]=>
          int(1369390903)
        }
      }
       
       [dump currentDB] : 
      object(MongoDB)#2 (2) {
        ["w"]=>
        int(1)
        ["wtimeout"]=>
        int(10000)
      }
       
       [dump grifs] : 
      object(MongoGridFS)#3 (5) {
        ["w"]=>
        int(1)
        ["wtimeout"]=>
        int(10000)
        ["chunks"]=>
        object(MongoCollection)#4 (2) {
          ["w"]=>
          int(1)
          ["wtimeout"]=>
          int(10000)
        }
        ["filesName":protected]=>
        string(8) "fs.files"
        ["chunksName":protected]=>
        string(9) "fs.chunks"
      }
       
      Fatal error: Uncaught exception 'MongoGridFSException' with message 'Could not store file: 192.168.36.109:20011: not master' in /var/www/MongoDB/public/testDebug.php:16 Stack trace: #0 /var/www/MongoDB/public/testDebug.php(16): MongoGridFS->storeFile('/var/www/shared...') #1 {main} thrown in /var/www/MongoDB/public/testDebug.php on line 16

      It's seems I've a file in my DB, otherwise, I've nothing:

      May 24 14:21:45	519f3f39:3	8e4743debcd45169	d	beGallery.fs.chunks	v: 2 b: true o: { _id: ObjectId('519f3f3928d409144f8a4f0f') }

      Any idea ?

        Attachments

          Issue Links

            Activity

              People

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

                Dates

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