Comments (7)
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 pecl install
is impossible, so you'll have to configure the driver manually. Instructions for this can be found in the installation docs. Please note that due to an issue with homebrew (which I haven't been able to work around; see mongodb/mongo-php-driver#1405), you also need to specify the homebrew include directory using CFLAGS
. I used the following configure
call in my tests:
CFLAGS=-I/opt/homebrew/include ./configure --enable-mongodb-developer-flags --with-mongodb-ssl=openssl
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.
from mongo-php-library.
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.
from mongo-php-library.
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.
from mongo-php-library.
Hi @alcaeus Thank you i will follow PHPC-2280
from mongo-php-library.
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.
from mongo-php-library.
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 :
2023/08/22 15:18:34 [error] 32206#0: *1 kevent() reported about an closed connection (54: Connection reset by peer) while reading response header from upstream, client: 127.0.0.1, server: , request: "GET /index.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost:8083"
2023/08/22 15:18:34 [error] 32206#0: *1 kevent() reported about an closed connection (54: Connection reset by peer) while reading response header from upstream, client: 127.0.0.1, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost:8083", referrer: "http://localhost:8083/index.php"
2023/08/22 15:18:35 [error] 32206#0: *1 kevent() reported about an closed connection (54: Connection reset by peer) while reading response header from upstream, client: 127.0.0.1, server: , request: "GET /index.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost:8083"
2023/08/22 15:18:35 [error] 32206#0: *1 kevent() reported about an closed connection (54: Connection reset by peer) while reading response header from upstream, client: 127.0.0.1, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost:8083", referrer: "http://localhost:8083/index.php"
2023/08/22 15:18:37 [error] 32206#0: *7 kevent() reported about an closed connection (54: Connection reset by peer) while reading response header from upstream, client: 127.0.0.1, server: , request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost:8083"
2023/08/22 15:18:38 [error] 32206#0: *7 kevent() reported about an closed connection (54: Connection reset by peer) while reading response header from upstream, client: 127.0.0.1, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost:8083", referrer: "http://localhost:8083/"
2023/08/22 15:22:14 [error] 32206#0: *11 kevent() reported about an closed connection (54: Connection reset by peer) while reading response header from upstream, client: 127.0.0.1, server: , request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost:8083"
2023/08/22 15:22:14 [error] 32206#0: *11 kevent() reported about an closed connection (54: Connection reset by peer) while reading response header from upstream, client: 127.0.0.1, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost:8083", referrer: "http://localhost:8083/"
2023/08/22 15:23:05 [error] 32206#0: *19 kevent() reported about an closed connection (54: Connection reset by peer) while reading response header from upstream, client: 127.0.0.1, server: , request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost:8083"
2023/08/22 15:23:06 [error] 32206#0: *19 kevent() reported about an closed connection (54: Connection reset by peer) while reading response header from upstream, client: 127.0.0.1, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost:8083", referrer: "http://localhost:8083/"
2023/08/22 15:23:13 [error] 32206#0: *23 kevent() reported about an closed connection (54: Connection reset by peer) while reading response header from upstream, client: 127.0.0.1, server: , request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost:8083"
2023/08/22 15:23:13 [error] 32206#0: *23 kevent() reported about an closed connection (54: Connection reset by peer) while reading response header from upstream, client: 127.0.0.1, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost:8083", referrer: "http://localhost:8083/"
2023/08/22 15:23:46 [error] 32206#0: *27 kevent() reported about an closed connection (54: Connection reset by peer) while reading response header from upstream, client: 127.0.0.1, server: , request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost:8083"
2023/08/22 15:23:47 [error] 32206#0: *27 kevent() reported about an closed connection (54: Connection reset by peer) while reading response header from upstream, client: 127.0.0.1, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost:8083", referrer: "http://localhost:8083/"
PHP FPM LOG
[22-Aug-2023 15:17:37] WARNING: [pool www] child 31673 exited on signal 11 (SIGSEGV) after 28.652821 seconds from start
[22-Aug-2023 15:17:37] NOTICE: [pool www] child 31901 started
[22-Aug-2023 15:17:37] WARNING: [pool www] child 31674 exited on signal 11 (SIGSEGV) after 28.955554 seconds from start
[22-Aug-2023 15:17:37] NOTICE: [pool www] child 31902 started
[22-Aug-2023 15:17:39] WARNING: [pool www] child 31901 exited on signal 11 (SIGSEGV) after 2.173381 seconds from start
[22-Aug-2023 15:17:39] NOTICE: [pool www] child 31906 started
[22-Aug-2023 15:17:39] WARNING: [pool www] child 31902 exited on signal 11 (SIGSEGV) after 2.000508 seconds from start
[22-Aug-2023 15:17:39] NOTICE: [pool www] child 31907 started
[22-Aug-2023 15:17:46] WARNING: [pool www] child 31906 exited on signal 11 (SIGSEGV) after 6.970074 seconds from start
[22-Aug-2023 15:17:46] NOTICE: [pool www] child 31919 started
[22-Aug-2023 15:17:46] WARNING: [pool www] child 31907 exited on signal 11 (SIGSEGV) after 6.955088 seconds from start
[22-Aug-2023 15:17:46] NOTICE: [pool www] child 31920 started
[22-Aug-2023 15:18:34] WARNING: [pool www] child 31919 exited on signal 11 (SIGSEGV) after 47.763101 seconds from start
[22-Aug-2023 15:18:34] NOTICE: [pool www] child 32371 started
[22-Aug-2023 15:18:34] WARNING: [pool www] child 31920 exited on signal 11 (SIGSEGV) after 47.779048 seconds from start
[22-Aug-2023 15:18:34] NOTICE: [pool www] child 32374 started
[22-Aug-2023 15:18:35] WARNING: [pool www] child 32371 exited on signal 11 (SIGSEGV) after 0.979081 seconds from start
[22-Aug-2023 15:18:35] NOTICE: [pool www] child 32376 started
[22-Aug-2023 15:18:35] WARNING: [pool www] child 32374 exited on signal 11 (SIGSEGV) after 0.980579 seconds from start
[22-Aug-2023 15:18:35] NOTICE: [pool www] child 32377 started
[22-Aug-2023 15:18:37] WARNING: [pool www] child 32376 exited on signal 11 (SIGSEGV) after 2.492545 seconds from start
[22-Aug-2023 15:18:37] NOTICE: [pool www] child 32380 started
[22-Aug-2023 15:18:38] WARNING: [pool www] child 32377 exited on signal 11 (SIGSEGV) after 2.481370 seconds from start
[22-Aug-2023 15:18:38] NOTICE: [pool www] child 32381 started
[22-Aug-2023 15:22:14] WARNING: [pool www] child 32380 exited on signal 11 (SIGSEGV) after 216.656886 seconds from start
[22-Aug-2023 15:22:14] NOTICE: [pool www] child 32736 started
[22-Aug-2023 15:22:14] WARNING: [pool www] child 32381 exited on signal 11 (SIGSEGV) after 216.660919 seconds from start
[22-Aug-2023 15:22:14] NOTICE: [pool www] child 32738 started
[22-Aug-2023 15:23:05] WARNING: [pool www] child 32736 exited on signal 11 (SIGSEGV) after 51.378758 seconds from start
[22-Aug-2023 15:23:05] NOTICE: [pool www] child 32907 started
[22-Aug-2023 15:23:06] WARNING: [pool www] child 32738 exited on signal 11 (SIGSEGV) after 51.418109 seconds from start
[22-Aug-2023 15:23:06] NOTICE: [pool www] child 32910 started
[22-Aug-2023 15:23:13] WARNING: [pool www] child 32907 exited on signal 11 (SIGSEGV) after 7.557748 seconds from start
[22-Aug-2023 15:23:13] NOTICE: [pool www] child 32924 started
[22-Aug-2023 15:23:13] WARNING: [pool www] child 32910 exited on signal 11 (SIGSEGV) after 7.534901 seconds from start
[22-Aug-2023 15:23:13] NOTICE: [pool www] child 32925 started
[22-Aug-2023 15:23:46] WARNING: [pool www] child 32924 exited on signal 11 (SIGSEGV) after 33.374329 seconds from start
[22-Aug-2023 15:23:46] NOTICE: [pool www] child 32987 started
[22-Aug-2023 15:23:47] WARNING: [pool www] child 32925 exited on signal 11 (SIGSEGV) after 33.375672 seconds from start
[22-Aug-2023 15:23:47] NOTICE: [pool www] child 32990 started
if you need anything else just ask me
web2.log
web1.log
commandline.log
from mongo-php-library.
Closing as this has been released in 1.17.0.
from mongo-php-library.
Related Issues (20)
- PHP+MongoDB: "Return value must be of type MongoDB\Driver\Server, null returned" HOT 3
- Can we drop `jean85/pretty-package-versions:1.2`? HOT 4
- Decision about `mongo-orchestration` folder and `Makefile` HOT 3
- [Documentation] Syntax highlighting in the method reference is not ideal HOT 1
- A never-ending query after upgrade to MongoDB 6.0.3 HOT 6
- Memory leak on updateOne in the loop HOT 1
- Deprecated: Return type of MongoDB\Model\BSONDocument::bsonSerialize() HOT 2
- The StreamWrapper class is currently unusable without the bucket HOT 4
- Performance issue with PHP 8.2 HOT 2
- Extract mongodb-1.6.2.tgz error HOT 1
- This is a test
- $unset not properly work on multiple field? HOT 1
- Docs: missing `]` character in database->aggregate documentation HOT 1
- Question about fieldPaths (feature request?) HOT 1
- Non blocking io HOT 1
- $where is not allowed in this context HOT 2
- TLS connection with mongo cluster failed (while single host works) HOT 2
- getting result from mongodb with toArray() HOT 3
- Getting the error in driver version 1.14 HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mongo-php-library.