php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69239 MongoDB ReplicaSet unavailable when a server node goes down
Submitted: 2015-03-15 09:02 UTC Modified: 2015-04-03 17:13 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: gpavone at sixco dot it Assigned: jmikola (profile)
Status: Closed Package: mongo (PECL)
PHP Version: 5.4.38 OS: Debian 7 Wheezy
Private report: No CVE-ID: None
 [2015-03-15 09:02 UTC] gpavone at sixco dot it
Description:
------------
I have 3 different mongodb servers (v3.0) running in a replica set on a vlan, and 2 separate web servers running php/nginx on another vlan (php-mongo 1.6.5). 

If I just STOP the mongod process, all goes fine. If I kill one of the mongo servers (turn it off or unplug NIC) the replica set does a good job at picking a new master, but my PHP (v5.4.35) scripts seem to hang and that eventually just kills the web servers.

Test script:
---------------
function write($filepath, $metadata, $database, $collection)
{
   $mongo = new MongoClient("mongodb://stgndb01:27017,stgndb02:27017", array("replicaSet" => "stgndb00"));
   $db = $mongo->selectDB($database);
   $gridFS = new MongoGridFS($db, $collection);
   $result = $gridFS->storeFile($filepath, $metadata, array("w" => 0));
   if($result === FALSE) {
      echo 'KO';
   } else {
      echo 'OK';
   }
}


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-03-16 09:03 UTC] gpavone at sixco dot it
-PHP Version: Irrelevant +PHP Version: 5.4.38
 [2015-03-16 09:03 UTC] gpavone at sixco dot it
PHP version is 5.4.38
 [2015-03-16 14:14 UTC] gpavone at sixco dot it
-Operating System: Debian 3.2.63 +Operating System: Debian 7 Wheezy
 [2015-03-16 14:14 UTC] gpavone at sixco dot it
OS version is Debian 7 Wheezy
 [2015-04-03 17:13 UTC] jmikola@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: jmikola
 [2015-04-03 17:13 UTC] jmikola@php.net
Thanks for reporting this issue. Development for the "mongo" extension is primarily managed through our JIRA project, so I've opened https://jira.mongodb.org/browse/PHP-1429 to track this issue.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 12:01:27 2024 UTC