-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MacOs M1 Cannot connect to Atlas After upgrade driver #1145
Comments
Thank you for reporting the issue and including a debug log from the driver. From it, I can see two connection attempts (both starting with the "Connection String [...]" line. The first one abruptly ends while encoding a document, but the second attempt starts right after that, so I assume the server was still alive. This second attempt continues further, and then abruptly stops when creating the TLS stream. Can you confirm that the time of that last log entry is consistent with when the php-fpm process crashes? Also, it would be helpful if you could try to reproduce it in the command-line. I ran a quick test with an Atlas cluster on my M1 Pro but couldn't reproduce a crash. |
Of course this is the test code: <?php
require __DIR__ . '/vendor/autoload.php';
use MongoDB\Client;
use MongoDB\Driver\ServerApi;
ini_set('mongodb.debug', '1');
$uri ="mongodb+srv://<url>/?retryWrites=true&w=majority;";
// Specify Stable API version 1
$apiVersion = new ServerApi(ServerApi::V1);
// Create a new client and connect to the server
$client = new MongoDB\Client($uri, [], ['serverApi' => $apiVersion]);
try {
// Send a ping to confirm a successful connection
$client->selectDatabase('admin')->command(['ping' => 1]);
echo "Pinged your deployment. You successfully connected to MongoDB!\n";
} catch (Exception $e) {
printf($e->getMessage());
}
?> FROM COMMAND LINE: commandline.log IT'S WORKING FROM WEB: CREATE TWO LOGS web1.log AND THIS ONE web2.log php error log :
PHP FPM LOG
if you need anything else just ask me |
Hi @samuelexyz, sorry for the lack of reply. I managed to reproduce the issue on my machine and have created PHPC-2280 to track this internally. I'm still investigating why the crash happens, as it is somewhere within system libraries and only triggered when connecting through FPM, but not through the CLI SAPI. |
Hi @samuelexyz, the segmentation fault happens due to the driver being compiled with Secure Transport as SSL library but php-fpm being compiled with OpenSSL. Compiling the driver using OpenSSL fixes the issue. Please note that until we get to PHPC-1017, specifying these options when running
I've created mongodb/mongo-php-driver#1463, which targets the v1.16 branch and will be released in an upcoming patch release. With the steps above, you should be able to work around the issue in the meantime; the changes merely change the detection mechanism to prefer OpenSSL over Secure Transport. |
Just a minor update: we're releasing the fix in the 1.17 version of the driver. After consideration, we decided that this was too big a change for a 1.16 patch release. I expect 1.17 to be released in the near future, but in the meantime you can use the instructions above to work around the issue. |
Closing as this has been released in 1.17.0. |
Bug Report
When I try to connect no exception is raised but the php-fpm job is closed and I have a return status of 502 Bad Gateway
Environment
phpinfo()
Test Script
Expected and Actual Behavior
Expect to connect and query without error 502
Debug Log
The text was updated successfully, but these errors were encountered: