mongo-php-driver: No suitable servers found (`serverselectiontryonce` set): [connection error calling ismaster on '114.225.125.126:27017']

My mongodb version is 3.2.7, I opened ipv6 in mongod config file by set net.ipv6: true

Although I know

net.ipv6
Type: boolean

Default: False

Removed in version 3.0.

Enable or disable IPv6 support and allows mongos or mongod to connect to the MongoDB instance using an IPv6 network. Prior to MongoDB 3.0, you had to specify net.ipv6 to use IPv6. In MongoDB 3.0 and later, IPv6 is always enabled.

But the error still occurred accidentally,I have no idea about this, I need your help, thank you.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 40 (13 by maintainers)

Most upvoted comments

Hi, everyone!

@slav123, that tip was so useful. But for me, use false in SSL option fixed the issue.

$options = ['ssl' => false ];

I didn’t see that message anymore.

when the error occur, the debug info as below:

[2016-09-27T01:39:39+00:00] socket: TRACE > TRACE: mongoc_socket_sendv():1134 Finished the iovecs [2016-09-27T01:39:39+00:00] socket: TRACE > EXIT: mongoc_socket_sendv():1165 [2016-09-27T01:39:39+00:00] socket: TRACE > TRACE: mongoc_socket_errno():307 Current errno: 0 [2016-09-27T01:39:39+00:00] stream: TRACE > EXIT: _mongoc_stream_socket_writev():208 [2016-09-27T01:39:39+00:00] stream: TRACE > EXIT: mongoc_stream_writev():164 [2016-09-27T01:39:39+00:00] stream: TRACE > ENTRY: _mongoc_stream_socket_poll():226 [2016-09-27T01:39:39+00:00] socket: TRACE > ENTRY: mongoc_socket_poll():217 [2016-09-27T01:39:39+00:00] stream: TRACE > EXIT: _mongoc_stream_socket_poll():252 [2016-09-27T01:39:39+00:00] stream: TRACE > ENTRY: mongoc_stream_failed():79 [2016-09-27T01:39:39+00:00] stream: TRACE > ENTRY: _mongoc_stream_socket_failed():89 [2016-09-27T01:39:39+00:00] stream: TRACE > ENTRY: _mongoc_stream_socket_destroy():71 [2016-09-27T01:39:39+00:00] socket: TRACE > ENTRY: mongoc_socket_close():531 [2016-09-27T01:39:39+00:00] socket: TRACE > EXIT: mongoc_socket_close():556 [2016-09-27T01:39:39+00:00] stream: TRACE > EXIT: _mongoc_stream_socket_destroy():82 [2016-09-27T01:39:39+00:00] stream: TRACE > EXIT: _mongoc_stream_socket_failed():93 [2016-09-27T01:39:39+00:00] stream: TRACE > EXIT: mongoc_stream_failed():89 [2016-09-27T01:39:39+00:00] mongoc: TRACE > ENTRY: mongoc_server_description_handle_ismaster():472 [2016-09-27T01:39:39+00:00] mongoc: TRACE > EXIT: mongoc_server_description_handle_ismaster():478 [2016-09-27T01:39:39+00:00] mongoc: TRACE > TRACE: mongoc_topology_description_handle_ismaster():1648 No transition entry to Single for Unknown [2016-09-27T01:39:39+00:00] mongoc: TRACE > ENTRY: mongoc_topology_description_select():669 [2016-09-27T01:39:39+00:00] mongoc: TRACE > EXIT: mongoc_topology_description_select():682 [2016-09-27T01:39:39+00:00] cluster: TRACE > EXIT: _mongoc_cluster_stream_for_optype():1817 [2016-09-27T01:39:39+00:00] cursor: TRACE > EXIT: _mongoc_cursor_fetch_stream():543 [2016-09-27T01:39:39+00:00] cursor: TRACE > GOTO: _mongoc_cursor_initial_query():574 done [2016-09-27T01:39:39+00:00] cursor: TRACE > EXIT: _mongoc_cursor_initial_query():603 [2016-09-27T01:39:39+00:00] cursor: TRACE > EXIT: _mongoc_cursor_next():1734 [2016-09-27T01:39:39+00:00] cursor: TRACE > EXIT: mongoc_cursor_next():1653 [2016-09-27T01:39:39+00:00] cursor: TRACE > ENTRY: mongoc_cursor_error():1568 [2016-09-27T01:39:39+00:00] cursor: TRACE > ENTRY: _mongoc_cursor_error():1586 [2016-09-27T01:39:39+00:00] cursor: TRACE > EXIT: _mongoc_cursor_error():1596 [2016-09-27T01:39:39+00:00] cursor: TRACE > EXIT: mongoc_cursor_error():1578 [2016-09-27T01:39:39+00:00] cursor: TRACE > ENTRY: mongoc_cursor_destroy():463 [2016-09-27T01:39:39+00:00] cursor: TRACE > ENTRY: _mongoc_cursor_destroy():480 [2016-09-27T01:39:39+00:00] cursor: TRACE > EXIT: _mongoc_cursor_destroy():517 [2016-09-27T01:39:39+00:00] cursor: TRACE > EXIT: mongoc_cursor_destroy():473 [2016-09-27T01:39:39+00:00] mongoc: DEBUG > Not destroying persistent client for Manager

below picture,left is the error debug info , right is correct debug info ! Is the pfm save the connect to mongodb service? can support the public api to manager ,which can close connected tcp .

1

I has same problem,No suitable servers found (serverselectiontryonce set). when restart php-fpm it can work well in period of time, then become random appear the error. But when i change php7 to php5, it alway work well . ( version mongodb 1.18 to 1.2.0alpha3 has same problem) ,who can solve the problem? is there persist connect mongdb server that not release? @bjori

1.2.0alpha2 has been released, which includes significant changes to our connection handling and persistence. We’ve entirely dropped PHP’s streams API and now rely on libmongoc for all socket communication, which I expect may resolve a number of outstanding connection handling and timeout issues.

@WenXuanYuan: Please attempt reproducing your original problem with 1.2.0alpha2 and let us know if the issue persists. Thanks!

I am thinking that IPv4 vs IPv6 is not a problem here. I think the problem is that you have high network latency, and that is why the connection sometimes gets made, and sometimes not.

Can you try playing with the connectTimeoutMS connection option (https://docs.mongodb.com/manual/reference/connection-string/#connection-options), to see whether increasing it fixes the problem?

You can set it in PHP through http://docs.php.net/manual/en/mongodb-driver-manager.construct.php#mongodb-driver-manager.construct-options