Closed udoless closed 8 years ago
I find that when occur an exception, at most time php was connecting a passive node then connection timed out.
@udoless: Last week, we diagnosed a bug in libmongoc that resulted in connection errors being incorrectly reported for available servers. The issue is closely related to libmongoc's stream handler API, which is used in versions of the PHP driver before 1.2.0alpha2. See CDRIVER-1571 and this reproduction test for more information.
I believe this may be related to your issue, since it is really just the passive node that timed out. In PHP driver 1.1.x, "Failed connecting to 'host:port': Connection timed out" is an exception from the PHP stream handler. The other "connection error" messages in the exception are evidence of the aforementioned bug, which also causes server selection to fail prematurely.
Separate from this issue, I'll also point out that those "connection error" messages should actually read "connection timeout" due to CDRIVER-1567.
Since this bug is being fixed in libmongoc 1.5.0, we won't be able to add it to a maintenance release for the 1.1.x PHP driver. I'd appreciate if you can test the latest 1.2.0 release and confirm that the issue is resolved. While our 1.2.0 alphas still don't include the libmongoc bug fix, we aren't using custom stream handlers, which I expect bypasses the bug entirely.
Since this bug is being fixed in libmongoc 1.5.0, we won't be able to add it to a maintenance release for the 1.1.x PHP driver.
The libmongoc team did end up back-porting their fix to 1.3.6, so we've released 1.1.9. This release should resolve the spurious timeouts ""No suitable servers found" exceptions when one or more replica sets nodes were inaccessible. The bug was specific to the PHP stream API integration, so it does not apply to version 1.2.0alpha2 and later.
I'm going to close this issue as resolved. Feel free to follow-up here or open a new issue as needed if the bug persists.
Description
I have a problem like issue374
Environment
php 7.0.7 mongo 3.0.12
Test Script
Exception(randomly)
Mongo Master Status