Skip to content

$manager->selectServer($readPreference) fail to return a Server #863

Closed
@hesselprodigentia

Description

@hesselprodigentia

Bug Report

Instability to retry a Server instance, sometimes return well and another nothing (none expected exception at least).
I found this https://jira.mongodb.org/browse/PHPLIB-729.

Environment

PHP 8.0.10

Nginx 
CosmosDB connection
Laravel/lumen-framework 8.2.1

------------
mongodb
libbson bundled version => 1.18.0
libmongoc bundled version => 1.18.0
libmongoc SSL => enabled
libmongoc SSL library => OpenSSL
libmongoc crypto => enabled
libmongoc crypto library => libcrypto
libmongoc crypto system profile => disabled
libmongoc SASL => disabled
libmongoc ICU => enabled
libmongoc compression => enabled
libmongoc compression snappy => disabled
libmongoc compression zlib => enabled
libmongoc compression zstd => disabled
libmongocrypt bundled version => 1.2.1
libmongocrypt crypto => enabled
libmongocrypt crypto library => libcrypto
mongodb.debug => no value => no value


DB_MONGO_CONNECTION => "mongodb"
DB_COSMOS_DSN => "mongodb://xxxxxxxx/?ssl=true&replicaSet=globaldb&retrywrites=false&maxIdleTimeMS=120000&appName=xxxxxx"
DB_MONGO_DRIVER => "mongodb"
$_SERVER['DB_MONGO_CONNECTION'] => "mongodb"
$_SERVER['DB_COSMOS_DSN'] => "mongodb://xxxxxx/?ssl=true&replicaSet=globaldb&retrywrites=false&maxIdleTimeMS=120000&appName=xxxxxx"
$_SERVER['DB_MONGO_DRIVER'] => "mongodb"
$_ENV['DB_MONGO_CONNECTION'] => "mongodb"
$_ENV['DB_COSMOS_DSN'] => "mongodb://xxxxxxx/?ssl=true&replicaSet=globaldb&retrywrites=false&maxIdleTimeMS=120000&appName=xxxxxx"
$_ENV['DB_MONGO_DRIVER'] => "mongodb"
------------------
name     : mongodb/mongodb
descrip. : MongoDB driver library
keywords : database, driver, mongodb, persistence
versions : * 1.8.0
type     : library
license  : Apache License 2.0 (Apache-2.0) (OSI approved) https://spdx.org/licenses/Apache-2.0.html#licenseText
homepage : https://jira.mongodb.org/browse/PHPLIB
source   : [git] https://github.com/mongodb/mongo-php-library.git 953dbc19443aa9314c44b7217a16873347e6840d
dist     : [zip] https://api.github.com/repos/mongodb/mongo-php-library/zipball/953dbc19443aa9314c44b7217a16873347e6840d 953dbc19443aa9314c44b7217a16873347e6840d
path     : /var/www/code/vendor/mongodb/mongodb
names    : mongodb/mongodb

support
issues : https://github.com/mongodb/mongo-php-library/issues
source : https://github.com/mongodb/mongo-php-library/tree/1.8.0

autoload
psr-4
MongoDB\ => src/
files

requires
ext-hash *
ext-json *
ext-mongodb ^1.8.1
jean85/pretty-package-versions ^1.2
php ^7.0 || ^8.0
symfony/polyfill-php80 ^1.19

requires (dev)
squizlabs/php_codesniffer ^3.5, <3.5.5
symfony/phpunit-bridge 5.x-dev

Test Script

Expected and Actual Behavior

Expected to retrieve a MongoDB\Driver\Server
when \MongoDB\select_server function is called and execute line 431 $manager->selectServer($readPreference)

Behavior
Empty is returned

Debug Log

string(0) ""
string(4002) "#0 /var/www/code/vendor/mongodb/mongodb/src/functions.php(432): MongoDB\Driver\Manager->selectServer(Object(MongoDB\Driver\ReadPreference))
#1 /var/www/code/vendor/mongodb/mongodb/src/Collection.php(651): MongoDB\select_server(Object(MongoDB\Driver\Manager), Array)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions