php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71125 MongoDB Driver / pcntl_fork() problem
Submitted: 2015-12-15 08:38 UTC Modified: 2015-12-19 19:55 UTC
From: zorg at razza dot org Assigned:
Status: Closed Package: mongo (PECL)
PHP Version: 5.6.16 OS: Ubuntu
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: zorg at razza dot org
New email:
PHP Version: OS:

 

 [2015-12-15 08:38 UTC] zorg at razza dot org
Description:
------------
When using pcntl_fork() with the new MongoDB\Driver it is impossible to create a new MongoDB manager in the child process if one has been opened in the parent process.

Test script:
---------------
$manager1 = MongoDB\Driver\Manager('mongodb://localhost:27017');

$pid = pcntl_fork();

if ($pid == 0)
{
   // Child process, create a new manager here
   unset($manager1);
   $manager2 = MongoDB\Driver\Manager('mongodb://localhost:27017');

   // Perform queries with $manager2 here
}
else
{
   // Parent process, retain old manager
   // Perform queries with $manager1 here
}

Expected result:
----------------
Expected to have a new MongoDB connection in $manager2 that the child process can use.

Actual result:
--------------
Both managers, even the newly created on in the child process seem to share a socket to MongoDB and throw errors based on receiving each others responses.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-12-19 19:55 UTC] zorg at razza dot org
Reposted this here:
https://github.com/mongodb/mongo-php-driver/issues/174

As I guess that is where it should be.
 [2015-12-19 19:55 UTC] zorg at razza dot org
-Status: Open +Status: Closed
 [2015-12-19 19:55 UTC] zorg at razza dot org
Closing as moved report to github.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jan 15 08:01:29 2025 UTC