-
Type:
Bug
-
Resolution: Gone away
-
Priority:
Major - P3
-
None
-
Affects Version/s: 1.5.0, 1.6.0
-
Component/s: None
-
None
-
Environment:OSX: MongoDB Server 4.4 + PHP 7.4 + MongoDB Driver 1.6.1
WIN: MongoDB Server 3.4 + PHP 7.1 + MongoDB Driver 1.5.3
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Everytime I launch this script, more or less, it creates 5 new connections to my MongoDB server.
<?php $command = new \MongoDB\Driver\Command(['ping' => 1]); $manager = new \MongoDB\Driver\Manager(); $manager->executeCommand('admin', $command); $manager = new \MongoDB\Driver\Manager('mongodb://127.0.0.1:27017'); $manager->executeCommand('admin', $command); $manager = new \MongoDB\Driver\Manager('mongodb://127.0.0.1:27017/'); $manager->executeCommand('admin', $command); $manager = new \MongoDB\Driver\Manager('mongodb://localhost:27017'); $manager->executeCommand('admin', $command); $manager = new \MongoDB\Driver\Manager('mongodb://localhost:27017/'); $manager->executeCommand('admin', $command);
According to the documentation, the driver keep the connections opened but why it can't match the old ones and get the previous connection when I'm using the same connection string ?
The fact is my MongoDB Server is currently limited to 100 connections and it seems that when the server is at 100 (or 101), all the connections are closed even the active one (currently working).
Is there a way to prevent this or did I misunderstand something in the documentation ?