Orange-OpenSource / YACassandraPDO

Cassandra PDO Driver fork
Apache License 2.0
84 stars 32 forks source link

"Invalid next size" Core dump #57

Open carlosdagos opened 10 years ago

carlosdagos commented 10 years ago

Hello. I made a wrapper over the extension that I simply called "Cql", when attempting to create a connection, I get this

php > require 'cassandra/Cql.php';
php > $cql = new cassandra\Cql('ads_statistics');
*** glibc detected *** php: realloc(): invalid next size: 0x0000000001ee00a0 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x7eb96)[0x7fa351ae0b96]
/lib/x86_64-linux-gnu/libc.so.6(+0x81ee7)[0x7fa351ae3ee7]
/lib/x86_64-linux-gnu/libc.so.6(realloc+0xee)[0x7fa351ae56fe]
/lib/x86_64-linux-gnu/libc.so.6(+0x33264)[0x7fa351a95264]
/lib/x86_64-linux-gnu/libc.so.6(+0x3345f)[0x7fa351a9545f]
/lib/x86_64-linux-gnu/libc.so.6(+0x31518)[0x7fa351a93518]
/lib/x86_64-linux-gnu/libc.so.6(+0x30c93)[0x7fa351a92c93]
/lib/x86_64-linux-gnu/libc.so.6(__strerror_r+0x5e)[0x7fa351aeaf4e]
/usr/lib/libthrift.so.0(_ZN6apache6thrift7TOutput10strerror_sEi+0x2b)[0x7fa3507ab20b]
/usr/lib/libthrift.so.0(_ZN6apache6thrift7TOutput6perrorEPKci+0x32)[0x7fa3507ab402]
/usr/lib/libthrift.so.0(_ZN6apache6thrift9transport7TSocket14openConnectionEP8addrinfo+0x186)[0x7fa3507d6976]
/usr/lib/libthrift.so.0(_ZN6apache6thrift9transport7TSocket10local_openEv+0xb5)[0x7fa3507d7715]
/usr/lib/libthrift.so.0(_ZN6apache6thrift9transport11TSocketPool4openEv+0x15d)[0x7fa3507d980d]
/usr/lib/php5/20090626/pdo_cassandra.so(+0x5b2f5)[0x7fa350a642f5]
/usr/lib/php5/20090626/pdo.so(+0x84cc)[0x7fa341cde4cc]
php[0x70fded]
php(execute+0x1fb)[0x6c095b]
php(zend_eval_stringl+0x144)[0x68f7c4]
php[0x42c816]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed)[0x7fa351a8376d]
php[0x42c9b5]
======= Memory map: ========
00400000-00b49000 r-xp 00000000 08:07 39323107                           /usr/bin/php5
00d48000-00dae000 r--p 00748000 08:07 39323107                           /usr/bin/php5
00dae000-00dba000 rw-p 007ae000 08:07 39323107                           /usr/bin/php5
00dba000-00dd6000 rw-p 00000000 00:00 0
01b5f000-01ee1000 rw-p 00000000 00:00 0                                  [heap]
7fa328000000-7fa328021000 rw-p 00000000 00:00 0
7fa328021000-7fa32c000000 ---p 00000000 00:00 0
7fa32f76f000-7fa32f779000 r-xp 00000000 08:07 68551330                   /lib/x86_64-linux-gnu/libnss_nis-2.15.so
7fa32f779000-7fa32f979000 ---p 0000a000 08:07 68551330                   /lib/x86_64-linux-gnu/libnss_nis-2.15.so
7fa32f979000-7fa32f97a000 r--p 0000a000 08:07 68551330                   /lib/x86_64-linux-gnu/libnss_nis-2.15.so
7fa32f97a000-7fa32f97b000 rw-p 0000b000 08:07 68551330                   /lib/x86_64-linux-gnu/libnss_nis-2.15.so
7fa32f97b000-7fa32f992000 r-xp 00000000 08:07 68551413                   /lib/x86_64-linux-gnu/libnsl-2.15.so
7fa32f992000-7fa32fb91000 ---p 00017000 08:07 68551413                   /lib/x86_64-linux-gnu/libnsl-2.15.so
7fa32fb91000-7fa32fb92000 r--p 00016000 08:07 68551413                   /lib/x86_64-linux-gnu/libnsl-2.15.so
7fa32fb92000-7fa32fb93000 rw-p 00017000 08:07 68551413                   /lib/x86_64-linux-gnu/libnsl-2.15.so
7fa32fb93000-7fa32fb95000 rw-p 00000000 00:00 0
7fa32fb95000-7fa32fb9d000 r-xp 00000000 08:07 68550800                   /lib/x86_64-linux-gnu/libnss_compat-2.15.so
7fa32fb9d000-7fa32fd9c000 ---p 00008000 08:07 68550800                   /lib/x86_64-linux-gnu/libnss_compat-2.15.so
7fa32fd9c000-7fa32fd9d000 r--p 00007000 08:07 68550800                   /lib/x86_64-linux-gnu/libnss_compat-2.15.so
7fa32fd9d000-7fa32fd9e000 rw-p 00008000 08:07 68550800                   /lib/x86_64-linux-gnu/libnss_compat-2.15.so
7fa32fd9e000-7fa32fd9f000 ---p 00000000 00:00 0
7fa32fd9f000-7fa33059f000 rw-p 00000000 00:00 0
7fa33059f000-7fa3305ab000 r-xp 00000000 08:07 68551104                   /lib/x86_64-linux-gnu/libnss_files-2.15.so
7fa3305ab000-7fa3307aa000 ---p 0000c000 08:07 68551104                   /lib/x86_64-linux-gnu/libnss_files-2.15.so
7fa3307aa000-7fa3307ab000 r--p 0000b000 08:07 68551104                   /lib/x86_64-linux-gnu/libnss_files-2.15.so
7fa3307ab000-7fa3307ac000 rw-p 0000c000 08:07 68551104                   /lib/x86_64-linux-gnu/libnss_files-2.15.so
7fa3307ac000-7fa3407ac000 rw-s 00000000 08:07 60426190                   /tmp/apc.rDnaqe (deleted)
7fa3407ac000-7fa3407e6000 r-xp 00000000 08:07 41288932                   /usr/lib/x86_64-linux-gnu/libxslt.so.1.1.26
7fa3407e6000-7fa3409e6000 ---p 0003a000 08:07 41288932                   /usr/lib/x86_64-linux-gnu/libxslt.so.1.1.26
7fa3409e6000-7fa3409e7000 r--p 0003a000 08:07 41288932                   /usr/lib/x86_64-linux-gnu/libxslt.so.1.1.26
7fa3409e7000-7fa3409e8000 rw-p 0003b000 08:07 41288932                   /usr/lib/x86_64-linux-gnu/libxslt.so.1.1.26
7fa3409e8000-7fa3409fc000 r-xp 00000000 08:07 41288933                   /usr/lib/x86_64-linux-gnu/libexslt.so.0.8.15
7fa3409fc000-7fa340bfb000 ---p 00014000 08:07 41288933                   /usr/lib/x86_64-linux-gnu/libexslt.so.0.8.15
7fa340bfb000-7fa340bfc000 r--p 00013000 08:07 41288933                   /usr/lib/x86_64-linux-gnu/libexslt.so.0.8.15
7fa340bfc000-7fa340bfd000 rw-p 00014000 08:07 41288933                   /usr/lib/x86_64-linux-gnu/libexslt.so.0.8.15
7fa340bfd000-7fa340c04000 r-xp 00000000 08:07 39583879                   /usr/lib/php5/20090626/xsl.so
7fa340c04000-7fa340e04000 ---p 00007000 08:07 39583879                   /usr/lib/php5/20090626/xsl.so
7fa340e04000-7fa340e05000 r--p 00007000 08:07 39583879                   /usr/lib/php5/20090626/xsl.so
7fa340e05000-7fa340e06000 rw-p 00008000 08:07 39583879                   /usr/lib/php5/20090626/xsl.so
7fa340e06000-7fa340e18000 r-xp 00000000 08:07 39583883                   /usr/lib/php5/20090626/xmlrpc.so
7fa340e18000-7fa341018000 ---p 00012000 08:07 39583883                   /usr/lib/php5/20090626/xmlrpc.so
7fa341018000-7fa341019000 r--p 00012000 08:07 39583883                   /usr/lib/php5/20090626/xmlrpc.so
7fa341019000-7fa34101a000 rw-p 00013000 08:07 39583883                   /usr/lib/php5/20090626/xmlrpc.so
7fa34101a000-7fa341025000 r-xp 00000000 08:07 39333697                   /usr/lib/libossp-uuid.so.16.0.22
7fa341025000-7fa341224000 ---p 0000b000 08:07 39333697                   /usr/lib/libossp-uuid.so.16.0.22
7fa341224000-7fa341225000 r--p 0000a000 08:07 39333697                   /usr/lib/libossp-uuid.so.16.0.22
7fa341225000-7fa341226000 rw-p 0000b000 08:07 39333697                   /usr/lib/libossp-uuid.so.16.0.22
7fa341226000-7fa341229000 r-xp 00000000 08:07 39586994                   /usr/lib/php5/20090626/uuid.so
7fa341229000-7fa341428000 ---p 00003000 08:07 39586994                   /usr/lib/php5/20090626/uuid.so
7fa341428000-7fa341429000 r--p 00002000 08:07 39586994                   /usr/lib/php5/20090626/uuid.so
7fa341429000-7fa34142a000 rw-p 00003000 08:07 39586994                   /usr/lib/php5/20090626/uuid.so
7fa34142a000-7fa341432000 r-xp 00000000 08:07 41289778                   /usr/lib/x86_64-linux-gnu/libgif.so.4.1.6
7fa341432000-7fa341631000 ---p 00008000 08:07 41289778                   /usr/lib/x86_64-linux-gnu/libgif.so.4.1.6
7fa341631000-7fa341632000 r--p 00007000 08:07 41289778                   /usr/lib/x86_64-linux-gnu/libgif.so.4.1.6
Aborted (core dumped)

Here's my version data

[carlos|server] ~ php -v
PHP 5.3.10-1ubuntu3.11 with Suhosin-Patch (cli) (built: Apr  4 2014 01:30:04)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies

Any clues? :smile:

LexLythius commented 10 years ago

It seems Thrift is trying to reallocate a big 32Mb chunk of memory and it choked. Would you mind sharing your wrapper's code? It might provide some clue.

carlosdagos commented 10 years ago

Hey there! It actually fails upon PDO instantiation. Example:

php > new PDO('cassandra:host=10.0.1.51;port=9160');
*** glibc detected *** php: malloc(): memory corruption: 0x00000000025d3060 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x7eb96)[0x7f6458726b96]
/lib/x86_64-linux-gnu/libc.so.6(+0x80d5b)[0x7f6458728d5b]
/lib/x86_64-linux-gnu/libc.so.6(__libc_malloc+0x75)[0x7f645872af95]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(_Znwm+0x1d)[0x7f6456a3fded]
/usr/lib/php5/20090626/pdo_cassandra.so(+0x5aa53)[0x7f645748fa53]
/usr/lib/php5/20090626/pdo.so(+0x84cc)[0x7f64577484cc]
php[0x70fded]
php(execute+0x1fb)[0x6c095b]
php(zend_eval_stringl+0x144)[0x68f7c4]
php[0x42c816]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed)[0x7f64586c976d]
php[0x42c9b5]
======= Memory map: ========
00400000-00b49000 r-xp 00000000 08:07 39323107                           /usr/bin/php5
00d48000-00dae000 r--p 00748000 08:07 39323107                           /usr/bin/php5
00dae000-00dba000 rw-p 007ae000 08:07 39323107                           /usr/bin/php5
00dba000-00dd6000 rw-p 00000000 00:00 0
022af000-025f2000 rw-p 00000000 00:00 0                                  [heap]
7f6430000000-7f6430021000 rw-p 00000000 00:00 0
7f6430021000-7f6434000000 ---p 00000000 00:00 0
7f64363b5000-7f64363bf000 r-xp 00000000 08:07 68551330                   /lib/x86_64-linux-gnu/libnss_nis-2.15.so
7f64363bf000-7f64365bf000 ---p 0000a000 08:07 68551330                   /lib/x86_64-linux-gnu/libnss_nis-2.15.so
7f64365bf000-7f64365c0000 r--p 0000a000 08:07 68551330                   /lib/x86_64-linux-gnu/libnss_nis-2.15.so
7f64365c0000-7f64365c1000 rw-p 0000b000 08:07 68551330                   /lib/x86_64-linux-gnu/libnss_nis-2.15.so
7f64365c1000-7f64365d8000 r-xp 00000000 08:07 68551413                   /lib/x86_64-linux-gnu/libnsl-2.15.so
7f64365d8000-7f64367d7000 ---p 00017000 08:07 68551413                   /lib/x86_64-linux-gnu/libnsl-2.15.so
7f64367d7000-7f64367d8000 r--p 00016000 08:07 68551413                   /lib/x86_64-linux-gnu/libnsl-2.15.so
7f64367d8000-7f64367d9000 rw-p 00017000 08:07 68551413                   /lib/x86_64-linux-gnu/libnsl-2.15.so
7f64367d9000-7f64367db000 rw-p 00000000 00:00 0
7f64367db000-7f64367e3000 r-xp 00000000 08:07 68550800                   /lib/x86_64-linux-gnu/libnss_compat-2.15.so
7f64367e3000-7f64369e2000 ---p 00008000 08:07 68550800                   /lib/x86_64-linux-gnu/libnss_compat-2.15.so
7f64369e2000-7f64369e3000 r--p 00007000 08:07 68550800                   /lib/x86_64-linux-gnu/libnss_compat-2.15.so
7f64369e3000-7f64369e4000 rw-p 00008000 08:07 68550800                   /lib/x86_64-linux-gnu/libnss_compat-2.15.so
7f64369e4000-7f64369e5000 ---p 00000000 00:00 0
7f64369e5000-7f64371e5000 rw-p 00000000 00:00 0
7f64371e5000-7f64371f1000 r-xp 00000000 08:07 68551104                   /lib/x86_64-linux-gnu/libnss_files-2.15.so
7f64371f1000-7f64373f0000 ---p 0000c000 08:07 68551104                   /lib/x86_64-linux-gnu/libnss_files-2.15.so
7f64373f0000-7f64373f1000 r--p 0000b000 08:07 68551104                   /lib/x86_64-linux-gnu/libnss_files-2.15.so
7f64373f1000-7f64373f2000 rw-p 0000c000 08:07 68551104                   /lib/x86_64-linux-gnu/libnss_files-2.15.so
7f64373f2000-7f64473f2000 rw-s 00000000 08:07 60424787                   /tmp/apc.EYUwo0 (deleted)
7f64473f2000-7f644742c000 r-xp 00000000 08:07 41288932                   /usr/lib/x86_64-linux-gnu/libxslt.so.1.1.26
7f644742c000-7f644762c000 ---p 0003a000 08:07 41288932                   /usr/lib/x86_64-linux-gnu/libxslt.so.1.1.26
7f644762c000-7f644762d000 r--p 0003a000 08:07 41288932                   /usr/lib/x86_64-linux-gnu/libxslt.so.1.1.26
7f644762d000-7f644762e000 rw-p 0003b000 08:07 41288932                   /usr/lib/x86_64-linux-gnu/libxslt.so.1.1.26
7f644762e000-7f6447642000 r-xp 00000000 08:07 41288933                   /usr/lib/x86_64-linux-gnu/libexslt.so.0.8.15
7f6447642000-7f6447841000 ---p 00014000 08:07 41288933                   /usr/lib/x86_64-linux-gnu/libexslt.so.0.8.15
7f6447841000-7f6447842000 r--p 00013000 08:07 41288933                   /usr/lib/x86_64-linux-gnu/libexslt.so.0.8.15
7f6447842000-7f6447843000 rw-p 00014000 08:07 41288933                   /usr/lib/x86_64-linux-gnu/libexslt.so.0.8.15
7f6447843000-7f644784a000 r-xp 00000000 08:07 39583879                   /usr/lib/php5/20090626/xsl.so
7f644784a000-7f6447a4a000 ---p 00007000 08:07 39583879                   /usr/lib/php5/20090626/xsl.so
7f6447a4a000-7f6447a4b000 r--p 00007000 08:07 39583879                   /usr/lib/php5/20090626/xsl.so
7f6447a4b000-7f6447a4c000 rw-p 00008000 08:07 39583879                   /usr/lib/php5/20090626/xsl.so
7f6447a4c000-7f6447a5e000 r-xp 00000000 08:07 39583883                   /usr/lib/php5/20090626/xmlrpc.so
7f6447a5e000-7f6447c5e000 ---p 00012000 08:07 39583883                   /usr/lib/php5/20090626/xmlrpc.so
7f6447c5e000-7f6447c5f000 r--p 00012000 08:07 39583883                   /usr/lib/php5/20090626/xmlrpc.so
7f6447c5f000-7f6447c60000 rw-p 00013000 08:07 39583883                   /usr/lib/php5/20090626/xmlrpc.so
7f6447c60000-7f6447c6b000 r-xp 00000000 08:07 39333697                   /usr/lib/libossp-uuid.so.16.0.22
7f6447c6b000-7f6447e6a000 ---p 0000b000 08:07 39333697                   /usr/lib/libossp-uuid.so.16.0.22
7f6447e6a000-7f6447e6b000 r--p 0000a000 08:07 39333697                   /usr/lib/libossp-uuid.so.16.0.22
7f6447e6b000-7f6447e6c000 rw-p 0000b000 08:07 39333697                   /usr/lib/libossp-uuid.so.16.0.22
7f6447e6c000-7f6447e6f000 r-xp 00000000 08:07 39586994                   /usr/lib/php5/20090626/uuid.so
7f6447e6f000-7f644806e000 ---p 00003000 08:07 39586994                   /usr/lib/php5/20090626/uuid.so
7f644806e000-7f644806f000 r--p 00002000 08:07 39586994                   /usr/lib/php5/20090626/uuid.so
7f644806f000-7f6448070000 rw-p 00003000 08:07 39586994                   /usr/lib/php5/20090626/uuid.so
7f6448070000-7f6448078000 r-xp 00000000 08:07 41289778                   /usr/lib/x86_64-linux-gnu/libgif.so.4.1.6
7f6448078000-7f6448277000 ---p 00008000 08:07 41289778                   /usr/lib/x86_64-linux-gnu/libgif.so.4.1.6
7f6448277000-7f6448278000 r--p 00007000 08:07 41289778                   /usr/lib/x86_64-linux-gnu/libgif.so.4.1.6
7f6448278000-7f6448279000 rw-p 00008000 08:07 41289778                   /usr/lib/x86_64-linux-gnu/libgif.so.4.1.6
7f6448279000-7f64482ab000 r-xp 00000000 08:07 39332694                   /usr/lib/libps.so.0.4.5
7f64482ab000-7f64484aa000 ---p 00032000 08:07 39332694                   /usr/lib/libps.so.0.4.5
7f64484aa000-7f64484ab000 r--p 00031000 08:07 39332694                   /usr/lib/libps.so.0.4.5
7f64484ab000-7f64484af000 rw-p 00032000 08:07 39332694                   /usr/lib/libps.so.0.4.5
7f64484af000-7f6448507000 rw-p 00000000 00:00 0
7f6448507000-7f6448513000 r-xp 00000000 08:07 39584886                   /usrAborted (core dumped)
kiwimartin commented 9 years ago

Hi! I've exact the same issue. Is there any solution?

Thank you! :)

My php info:

PHP 5.5.9-1ubuntu4.5 (cli) (built: Oct 29 2014 11:59:10) 
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