mongoDB php driver "segmentation fault" with SSL

144 views
Skip to first unread message

Bodenhaltung

unread,
Mar 19, 2015, 7:08:19 AM3/19/15
to mongod...@googlegroups.com
Hi,

i have tryed the pecl-mongo Version (1.6.5) and the latest dev Version from Source (1.7.0dev) with the same results:

root@mdb30:~# php --ri mongo | grep Version
Version => 1.6.5

root@mdb30:~# php -v
PHP 5.5.9-1ubuntu4.7 (cli) (built: Mar 16 2015 20:47:39) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies

root@mdb30:~# uname -a
Linux mdb30 2.6.32-042stab094.8 #1 SMP Tue Dec 16 20:36:56 MSK 2014 x86_64 x86_64 x86_64 GNU/Linux

mongodb is 3.0.1 build with SSL and works fine.

mongo.tutorial.php:
$m = new MongoClient("mongodb://127.0.0.1:27017", array("ssl" => "true"));

root@mdb30:~# php mongo.tutorial.php 
Speicherzugriffsfehler

Valgrid output:
root@mdb30:~# valgrind php -n -dextension=mongo.so mongo.tutorial.php
==16976== Memcheck, a memory error detector
==16976== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==16976== Using Valgrind-3.10.0.SVN and LibVEX; rerun with -h for copyright info
==16976== Command: php -n -dextension=mongo.so mongo.tutorial.php
==16976== 
==16976== Invalid read of size 8
==16976==    at 0x6A7A4E: php_stream_context_get_option (in /usr/bin/php5)
==16976==    by 0x7975276: php_mongo_io_stream_connect (io_stream.c:186)
==16976==    by 0x798542A: mongo_connection_create (connections.c:88)
==16976==    by 0x7987643: mongo_get_connection_single (manager.c:94)
==16976==    by 0x79878E0: mongo_get_connection_multiple (manager.c:411)
==16976==    by 0x79886FD: mongo_get_read_write_connection (manager.c:553)
==16976==    by 0x795F8C1: php_mongo_connect (mongoclient.c:357)
==16976==    by 0x796009D: php_mongo_ctor (mongoclient.c:571)
==16976==    by 0x6DDA0A: dtrace_execute_internal (in /usr/bin/php5)
==16976==    by 0x79DA64: ??? (in /usr/bin/php5)
==16976==    by 0x717797: execute_ex (in /usr/bin/php5)
==16976==    by 0x6DD908: dtrace_execute_ex (in /usr/bin/php5)
==16976==  Address 0x8 is not stack'd, malloc'd or (recently) free'd
==16976== 
==16976== 
==16976== Process terminating with default action of signal 11 (SIGSEGV)
==16976==  Access not within mapped region at address 0x8
==16976==    at 0x6A7A4E: php_stream_context_get_option (in /usr/bin/php5)
==16976==    by 0x7975276: php_mongo_io_stream_connect (io_stream.c:186)
==16976==    by 0x798542A: mongo_connection_create (connections.c:88)
==16976==    by 0x7987643: mongo_get_connection_single (manager.c:94)
==16976==    by 0x79878E0: mongo_get_connection_multiple (manager.c:411)
==16976==    by 0x79886FD: mongo_get_read_write_connection (manager.c:553)
==16976==    by 0x795F8C1: php_mongo_connect (mongoclient.c:357)
==16976==    by 0x796009D: php_mongo_ctor (mongoclient.c:571)
==16976==    by 0x6DDA0A: dtrace_execute_internal (in /usr/bin/php5)
==16976==    by 0x79DA64: ??? (in /usr/bin/php5)
==16976==    by 0x717797: execute_ex (in /usr/bin/php5)
==16976==    by 0x6DD908: dtrace_execute_ex (in /usr/bin/php5)
==16976==  If you believe this happened as a result of a stack
==16976==  overflow in your program's main thread (unlikely but
==16976==  possible), you can try to increase the size of the
==16976==  main thread stack using the --main-stacksize= flag.
==16976==  The main thread stack size used in this run was 10485760.
==16976== 
==16976== HEAP SUMMARY:
==16976==     in use at exit: 3,607,507 bytes in 18,143 blocks
==16976==   total heap usage: 19,398 allocs, 1,255 frees, 3,836,272 bytes allocated
==16976== 
==16976== LEAK SUMMARY:
==16976==    definitely lost: 0 bytes in 0 blocks
==16976==    indirectly lost: 0 bytes in 0 blocks
==16976==      possibly lost: 0 bytes in 0 blocks
==16976==    still reachable: 3,607,507 bytes in 18,143 blocks
==16976==         suppressed: 0 bytes in 0 blocks
==16976== Rerun with --leak-check=full to see details of leaked memory
==16976== 
==16976== For counts of detected and suppressed errors, rerun with: -v
==16976== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Speicherzugriffsfehler

Without SSL Connection the Script and mongoDB works fine.

It there a Bug or a problem with me? ;-)


Thank you for your help,

Norbert

Derick Rethans

unread,
Mar 19, 2015, 7:44:21 AM3/19/15
to Bodenhaltung, mongod...@googlegroups.com
On Thu, 19 Mar 2015, Bodenhaltung wrote:

> i have tryed the pecl-mongo Version (1.6.5) and the latest dev Version from
> Source (1.7.0dev) with the same results:
>
> root@mdb30:~# php --ri mongo | grep Version
> Version => 1.6.5
>
> root@mdb30:~# php -v
> PHP 5.5.9-1ubuntu4.7 (cli) (built: Mar 16 2015 20:47:39)
> Copyright (c) 1997-2014 The PHP Group
> Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
> with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
>
> root@mdb30:~# uname -a
> Linux mdb30 2.6.32-042stab094.8 #1 SMP Tue Dec 16 20:36:56 MSK 2014 x86_64
> x86_64 x86_64 GNU/Linux
>
> mongodb is 3.0.1 build with SSL and works fine.
>
> mongo.tutorial.php:
> $m = new MongoClient("mongodb://127.0.0.1:27017", array("ssl" => "true"));
> The rest is from http://php.net/manual/de/mongo.tutorial.php.
>
> root@mdb30:~# php mongo.tutorial.php
> Speicherzugriffsfehler

<snip>

> Without SSL Connection the Script and mongoDB works fine.
>
> It there a Bug or a problem with me? ;-)

It crashes, so that's definitely a bug. Could you please file an issue
at https://jira.mongodb.org/browse/PHP so that we can track this
adequately? If you can add a "bt full" (made through GDB) as well,
that'd be great. You can create one by running:

gdb --args php mongo.tutorial.php

then on the gdb prompt run:
run

then when it crashes:
bt full

thanks for telling us!

cheers,
Derick

--
{
website: [ "http://mongodb.org", "http://derickrethans.nl" ],
twitter: [ "@derickr", "@mongodb" ]
}

Bodenhaltung

unread,
Mar 19, 2015, 8:42:39 AM3/19/15
to mongod...@googlegroups.com, bodenh...@gmail.com
Hi,


Am Donnerstag, 19. März 2015 12:44:21 UTC+1 schrieb Derick Rethans:
On Thu, 19 Mar 2015, Bodenhaltung wrote:

It crashes, so that's definitely a bug. Could you please file an issue
at https://jira.mongodb.org/browse/PHP so that we can track this
adequately? If you can add a "bt full" (made through GDB) as well,
that'd be great. 

Ok:
 
thanks for telling us!

:-) 

Thanks!


Best Regards,

Norbert
Reply all
Reply to author
Forward
0 new messages