Comments (18)
Cross-referencing with @alcaeus' report: https://gist.github.com/alcaeus/754e1458352e5e872f3c
from mongo-php-driver.
I managed to reproduce this in the php-cli as well:
$ php -a
Interactive shell
php > $manager = new MongoDB\Driver\Manager('mongodb://localhost');
php > var_dump($manager);
Segmentation fault: 11
In this case, var_dumping the manager will cause the segfault. However, when adding arguments to the call it just segfaults right away:
$ php -a
Interactive shell
php > $manager = new \MongoDB\Driver\Manager("mongodb://localhost:27017", [], []);
Segmentation fault: 11
from mongo-php-driver.
I just upgraded to 1.1.1 and was able to partly fix the issue.
The error still occurs when creating the manager with empty arrays for arguments (2nd example). The segmentation fault from the first example however is gone.
from mongo-php-driver.
I can confirm as well @alcaeus 's result, that after upgrading to v1.1.1, still segfaults with empty arrays.
from mongo-php-driver.
@jeremyjannotta: Were you able to create a GDB backtrace of your segfault? @alcaeus is in the process of creating his own, but it would certainly be helpful to have both to compare/contrast.
from mongo-php-driver.
Cross-referencing with PHPC-493.
from mongo-php-driver.
Here goes:
$ gdb php
GNU gdb (GDB) 7.10.1
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin15.2.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from php...(no debugging symbols found)...done.
(gdb) run -r "new MongoDB\Driver\Manager('mongodb://localhost', [], []);"
Starting program: /usr/local/bin/php -r "new MongoDB\Driver\Manager('mongodb://localhost', [], []);"
Program received signal SIGSEGV, Segmentation fault.
0x00000001003cbb09 in zend_hash_num_elements ()
(gdb) bt full
#0 0x00000001003cbb09 in zend_hash_num_elements ()
No symbol table info available.
#1 0x0000000104c2de96 in zval_to_bson () from /usr/local/opt/php56-mongo/mongo.so
No symbol table info available.
#2 0x0000000104c855e3 in zim_Manager___construct () from /usr/local/opt/php56-mongodb/mongodb.so
No symbol table info available.
#3 0x00000001003b0ca9 in dtrace_execute_internal ()
No symbol table info available.
#4 0x00000001017c2776 in xdebug_execute_internal () from /usr/local/opt/php56-xdebug/xdebug.so
No symbol table info available.
#5 0x0000000100429fce in zend_do_fcall_common_helper_SPEC ()
No symbol table info available.
#6 0x00000001003e718e in execute_ex ()
No symbol table info available.
#7 0x00000001003b0be5 in dtrace_execute_ex ()
No symbol table info available.
#8 0x00000001017c245c in xdebug_execute_ex () from /usr/local/opt/php56-xdebug/xdebug.so
No symbol table info available.
#9 0x00000001003b2f4b in zend_eval_stringl ()
No symbol table info available.
#10 0x00000001003b328a in zend_eval_stringl_ex ()
No symbol table info available.
#11 0x000000010044aa82 in do_cli ()
No symbol table info available.
#12 0x0000000100449c8b in main ()
No symbol table info available.
from mongo-php-driver.
@jeremyjannotta Do you, by any chance, also have ext-mongo
installed next to ext-mongodb
? Working on that adapter between these two I removed ext-mongo
for testing purposes and all of a sudden the code used above no longer segfaulted.
from mongo-php-driver.
As I can't repro this, could you run it again in debug mode? -- It'll print out a little more info for debugging:
So in gdb run:
(gdb) run -dmongodb.debug=stderr -r "new MongoDB\Driver\Manager('mongodb://localhost', [], []);"
from mongo-php-driver.
@bjori Same result - there is no additional output and the trace is exactly the same.
from mongo-php-driver.
Heh. I see now why there is no additional output. It segfaults as soon as it tries to convert the options... Doesn't make any sense :|
Which PHP version is this? And you are running pecl/mongodb 1.1.1?
Could you just for completeness try without xdebug?
from mongo-php-driver.
As commented above, I have updated to 1.1.1 which solved one segfault I was experiencing.
I've previously tried running without xdebug after @jmikola suspected that and it didn't change a thing. Here's the output without xdebug:
(gdb) bt full
#0 0x00000001003cbb09 in zend_hash_num_elements ()
No symbol table info available.
#1 0x0000000104bf7e96 in zval_to_bson () from /usr/local/opt/php56-mongo/mongo.so
No symbol table info available.
#2 0x0000000104c4f5e3 in zim_Manager___construct () from /usr/local/opt/php56-mongodb/mongodb.so
No symbol table info available.
#3 0x00000001003b0ca9 in dtrace_execute_internal ()
No symbol table info available.
#4 0x0000000100429fce in zend_do_fcall_common_helper_SPEC ()
No symbol table info available.
#5 0x00000001003e718e in execute_ex ()
No symbol table info available.
#6 0x00000001003b0be5 in dtrace_execute_ex ()
No symbol table info available.
#7 0x00000001003b2f4b in zend_eval_stringl ()
No symbol table info available.
#8 0x00000001003b328a in zend_eval_stringl_ex ()
No symbol table info available.
#9 0x000000010044aa82 in do_cli ()
No symbol table info available.
#10 0x0000000100449c8b in main ()
No symbol table info available.
Again, disabling pecl/mongo fixes the issue.
Also:
$ php --version
PHP 5.6.16 (cli) (built: Nov 27 2015 10:28:34)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
from mongo-php-driver.
Bahhh. Sorry for being so daft. It even worked for me locally on PHP 5.6.16
with both pecl/mongo
and pecl/mongodb
loaded -- but now I see what the problem is, I wasn't reading the paths from your stack trace correctly.
There is a symbol clash between pecl/mongodb
and pecl/mongo
, more specifically zval_to_bson
is provided by both extensions.
In your case, the stacktrace shows the zim_Manager___construct()
executing the zval_to_bson()
function provided by mongo.so
-- not mongodb.so
.
These two functions don't share any implementation details and are not compatible with each other.
We'll have to rename the function provided by pecl/mongodb
to phongo_zval_to_bson
or something.
from mongo-php-driver.
Now that you mention it, yes, it does say mongo.so. I didn't catch that either. Well, at least we now know what the problem is! 👍
from mongo-php-driver.
@alcaeus I do indeed have ext-mongo installed next to ext-mongodb.
Also, here is my gdb backtrace, which has the same result:
Program received signal SIGSEGV, Segmentation fault.
0x0000000100473db4 in zend_hash_num_elements ()
(gdb) bt full
#0 0x0000000100473db4 in zend_hash_num_elements ()
No symbol table info available.
#1 0x0000000104c6f85a in zval_to_bson () from /usr/local/php5/lib/php/extensions/no-debug-non-zts-20131226/mongo.so
No symbol table info available.
#2 0x0000000104cd44cf in zim_Manager___construct ()
from /usr/local/php5/lib/php/extensions/no-debug-non-zts-20131226/mongodb.so
No symbol table info available.
#3 0x00000001004565de in dtrace_execute_internal ()
No symbol table info available.
#4 0x0000000101d9232f in xdebug_execute_internal ()
from /usr/local/php5/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so
No symbol table info available.
#5 0x00000001004d6c58 in zend_do_fcall_common_helper_SPEC ()
No symbol table info available.
#6 0x0000000100491918 in execute_ex ()
No symbol table info available.
#7 0x0000000100456512 in dtrace_execute_ex ()
No symbol table info available.
#8 0x0000000101d92060 in xdebug_execute_ex ()
from /usr/local/php5/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so
No symbol table info available.
#9 0x0000000100458cf4 in zend_eval_stringl ()
No symbol table info available.
#10 0x000000010045910c in zend_eval_string_ex ()
No symbol table info available.
#11 0x00000001004f80ed in do_cli ()
No symbol table info available.
#12 0x00000001004f72b8 in main ()
No symbol table info available.
from mongo-php-driver.
Confirmed as well that disabling ext-mongo fixes the segfault issue.
from mongo-php-driver.
Cross-referencing with PHPC-529. Thanks for following up with the traces, guys!
from mongo-php-driver.
1.1.2 has been released with a fix for this.
from mongo-php-driver.
Related Issues (20)
- apache stop when I added extension=mongodb.so to php.ini HOT 3
- `selectServer` takes too long on official php base image (connections opened sequentially) HOT 13
- libbson Bug Report : variable ret value type error HOT 8
- No suitable servers found (`serverSelectionTryOnce` set) when rs.initiate with localhost HOT 5
- Extract mongodb-1.6.2.tgz error HOT 5
- Sporadic "Authentication failed" errors HOT 8
- MongoDB PHP Driver 1.15+ increases PHP memory consumption HOT 7
- Error while compiling on macOS HOT 7
- Major slowdown since version 1.17.0 HOT 8
- PHP Warning: PHP Startup: Unable to load dynamic library 'mongodb.so' HOT 2
- MongoDB reporting "AuthenticationAbandoned: Overridden by new authentication session" for a PHP client HOT 14
- Windows build after 1.13.0 HOT 4
- linux general protection fault , sorry for my poor english HOT 1
- PHP refusing to load MongoDB PHP driver on Windows (on one machine but not another) HOT 1
- Can't download desired extension HOT 2
- Unable to install pecl mongodb-1.15.1 in php 8.2 HOT 1
- Bug & Question: How to compile mongodb statically into PHP? HOT 9
- PHPStorm Stub for Manager class has outdated signature HOT 1
- Cannot install with laravel 11 HOT 1
- Cannot run ./configure cmd - error: cannot find input file: 'config.h.in'
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-driver.