|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2016-02-12 07:27 UTC] johan at x-tnd dot be
Description: ------------ I'm running a symfony2 command line script that sometimes cause a segfault. It sounds like this is related to the pdo pgsql extension. I'm using PHP 7.0.3 and extensions (from Remi's SCL repository) ans PostgreSQL 9.2.14 (from centos updates repository). Unfortunately, I'm not able to provide a script that reproduce this random issue. My command line script is called every hour, it has failed 6 times on 3 days. Actually, it seems that I've 2 different backtraces: 1- % gdb php70 core.7101 GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-80.el7 Copyright (C) 2013 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-redhat-linux-gnu". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>... Reading symbols from /opt/remi/php70/root/usr/bin/php...Reading symbols from /usr/lib/debug/opt/remi/php70/root/usr/bin/php.debug...done. done. warning: core file may not match specified executable file. [New LWP 7101] [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". Core was generated by `php70 -d memory_limit=10G app/console tadaam:importfeed --no-agencies --source'. Program terminated with signal 11, Segmentation fault. #0 resetPQExpBuffer (str=str@entry=0x7fd86bcb5c18) at pqexpbuffer.c:149 149 str->data[0] = '\0'; Missing separate debuginfos, use: debuginfo-install bzip2-libs-1.0.6-13.el7.x86_64 cyrus-sasl-lib-2.1.26-19.2.el7.x86_64 expat-2.1.0-8.el7.x86_64 fontconfig-2.10.95-7.el7.x86_64 freetype-2.4.11-11.el7.x86_64 gd-last-2.1.1-2.el7.remi.x86_64 glibc-2.17-106.el7_2.1.x86_64 jbigkit-libs-2.0-11.el7.x86_64 keyutils-libs-1.5.8-3.el7.x86_64 krb5-libs-1.13.2-10.el7.x86_64 libX11-1.6.3-2.el7.x86_64 libXau-1.0.8-2.1.el7.x86_64 libXpm-3.5.11-3.el7.x86_64 libcom_err-1.42.9-7.el7.x86_64 libcurl-7.29.0-25.el7.centos.x86_64 libedit-3.0-12.20121213cvs.el7.x86_64 libgcc-4.8.5-4.el7.x86_64 libgcrypt-1.5.3-12.el7_1.1.x86_64 libgpg-error-1.12-3.el7.x86_64 libicu-50.1.2-15.el7.x86_64 libidn-1.28-4.el7.x86_64 libjpeg-turbo-1.2.90-5.el7.x86_64 libmcrypt-2.5.8-13.el7.x86_64 libpng-1.5.13-7.el7_2.x86_64 libselinux-2.2.2-6.el7.x86_64 libssh2-1.4.3-10.el7.x86_64 libstdc++-4.8.5-4.el7.x86_64 libtiff-4.0.3-14.el7.x86_64 libtool-ltdl-2.4.2-20.el7.x86_64 libvpx-1.3.0-5.el7_0.x86_64 libxcb-1.11-4.el7.x86_64 libxml2-2.9.1-6.el7_2.2.x86_64 libxslt-1.1.28-5.el7.x86_64 libzip-last-1.1-1.el7.remi.x86_64 ncurses-libs-5.9-13.20130511.el7.x86_64 nspr-4.10.8-2.el7_1.x86_64 nss-3.19.1-19.el7_2.x86_64 nss-softokn-freebl-3.16.2.3-13.el7_1.x86_64 nss-util-3.19.1-4.el7_1.x86_64 openldap-2.4.40-8.el7.x86_64 openssl-libs-1.0.1e-51.el7_2.2.x86_64 pcre-8.32-15.el7.x86_64 php70-php-pecl-apcu-5.1.3-1.el7.remi.x86_64 php70-php-pecl-apcu-bc-1.0.2-1.el7.remi.x86_64 php70-php-pecl-mysql-1.0.0-0.9.20151007git294ce3b.el7.remi.x86_64 php70-php-pecl-xdebug-2.4.0-0.8.RC4.el7.remi.x86_64 php70-php-pecl-zip-1.13.1-3.el7.remi.x86_64 sqlite-3.7.17-8.el7.x86_64 xz-libs-5.1.2-12alpha.el7.x86_64 zlib-1.2.7-15.el7.x86_64 (gdb) bt #0 resetPQExpBuffer (str=str@entry=0x7fd86bcb5c18) at pqexpbuffer.c:149 #1 0x00007fd870fed7ba in printfPQExpBuffer (str=str@entry=0x7fd86bcb5c18, fmt=0x7fd870ff494e "unexpected asyncStatus: %d\n") at pqexpbuffer.c:237 #2 0x00007fd870fe45b4 in PQgetResult (conn=conn@entry=0x7fd86bcb58c0) at fe-exec.c:1726 #3 0x00007fd870fe460f in PQexecStart (conn=conn@entry=0x7fd86bcb58c0) at fe-exec.c:1896 #4 0x00007fd870fe47c1 in PQexec (conn=0x7fd86bcb58c0, query=0x7fd86be208c0 "DEALLOCATE pdo_stmt_00000005") at fe-exec.c:1805 #5 0x00007fd86e10d698 in pgsql_stmt_dtor (stmt=0x7fd869362540) at /usr/src/debug/php-7.0.3/ext/pdo_pgsql/pgsql_statement.c:64 #6 0x00007fd871431b6a in php_pdo_free_statement (stmt=0x7fd869362540) at /usr/src/debug/php-7.0.3/ext/pdo/pdo_stmt.c:2315 #7 0x00007fd8852edbe0 in zend_objects_store_free_object_storage (objects=objects@entry=0x7fd885691bd0 <executor_globals+816>) at /usr/src/debug/php-7.0.3/Zend/zend_objects_API.c:103 #8 0x00007fd8852a4ac3 in shutdown_executor () at /usr/src/debug/php-7.0.3/Zend/zend_execute_API.c:357 #9 0x00007fd8852b395a in zend_deactivate () at /usr/src/debug/php-7.0.3/Zend/zend.c:967 #10 0x00007fd885253cc1 in php_request_shutdown (dummy=dummy@entry=0x0) at /usr/src/debug/php-7.0.3/main/main.c:1823 #11 0x00007fd88533c868 in do_cli (argc=10, argv=0x7fd885e1a4a0) at /usr/src/debug/php-7.0.3/sapi/cli/php_cli.c:1142 #12 0x00007fd88513a26a in main (argc=10, argv=0x7fd885e1a4a0) at /usr/src/debug/php-7.0.3/sapi/cli/php_cli.c:1345 2- % gdb php70 core.6209 GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-80.el7 Copyright (C) 2013 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-redhat-linux-gnu". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>... Reading symbols from /opt/remi/php70/root/usr/bin/php...Reading symbols from /usr/lib/debug/opt/remi/php70/root/usr/bin/php.debug...done. done. warning: core file may not match specified executable file. [New LWP 6209] [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". Core was generated by `php70 -d memory_limit=10G app/console tadaam:pige lbc -q --env=console'. Program terminated with signal 11, Segmentation fault. #0 resetPQExpBuffer (str=str@entry=0x7f3a5fab5ba8) at pqexpbuffer.c:149 149 str->data[0] = '\0'; Missing separate debuginfos, use: debuginfo-install bzip2-libs-1.0.6-13.el7.x86_64 cyrus-sasl-lib-2.1.26-19.2.el7.x86_64 expat-2.1.0-8.el7.x86_64 fontconfig-2.10.95-7.el7.x86_64 freetype-2.4.11-11.el7.x86_64 gd-last-2.1.1-2.el7.remi.x86_64 glibc-2.17-106.el7_2.1.x86_64 jbigkit-libs-2.0-11.el7.x86_64 keyutils-libs-1.5.8-3.el7.x86_64 krb5-libs-1.13.2-10.el7.x86_64 libX11-1.6.3-2.el7.x86_64 libXau-1.0.8-2.1.el7.x86_64 libXpm-3.5.11-3.el7.x86_64 libcom_err-1.42.9-7.el7.x86_64 libcurl-7.29.0-25.el7.centos.x86_64 libedit-3.0-12.20121213cvs.el7.x86_64 libgcc-4.8.5-4.el7.x86_64 libgcrypt-1.5.3-12.el7_1.1.x86_64 libgpg-error-1.12-3.el7.x86_64 libicu-50.1.2-15.el7.x86_64 libidn-1.28-4.el7.x86_64 libjpeg-turbo-1.2.90-5.el7.x86_64 libmcrypt-2.5.8-13.el7.x86_64 libpng-1.5.13-7.el7_2.x86_64 libselinux-2.2.2-6.el7.x86_64 libssh2-1.4.3-10.el7.x86_64 libstdc++-4.8.5-4.el7.x86_64 libtiff-4.0.3-14.el7.x86_64 libtool-ltdl-2.4.2-20.el7.x86_64 libvpx-1.3.0-5.el7_0.x86_64 libxcb-1.11-4.el7.x86_64 libxml2-2.9.1-6.el7_2.2.x86_64 libxslt-1.1.28-5.el7.x86_64 libzip-last-1.1-1.el7.remi.x86_64 ncurses-libs-5.9-13.20130511.el7.x86_64 nspr-4.10.8-2.el7_1.x86_64 nss-3.19.1-19.el7_2.x86_64 nss-softokn-freebl-3.16.2.3-13.el7_1.x86_64 nss-util-3.19.1-4.el7_1.x86_64 openldap-2.4.40-8.el7.x86_64 openssl-libs-1.0.1e-51.el7_2.2.x86_64 pcre-8.32-15.el7.x86_64 php70-php-pecl-apcu-5.1.3-1.el7.remi.x86_64 php70-php-pecl-apcu-bc-1.0.2-1.el7.remi.x86_64 php70-php-pecl-mysql-1.0.0-0.9.20151007git294ce3b.el7.remi.x86_64 php70-php-pecl-xdebug-2.4.0-0.8.RC4.el7.remi.x86_64 php70-php-pecl-zip-1.13.1-3.el7.remi.x86_64 sqlite-3.7.17-8.el7.x86_64 xz-libs-5.1.2-12alpha.el7.x86_64 zlib-1.2.7-15.el7.x86_64 (gdb) bt #0 resetPQExpBuffer (str=str@entry=0x7f3a5fab5ba8) at pqexpbuffer.c:149 #1 0x00007f3a64ded7ba in printfPQExpBuffer (str=str@entry=0x7f3a5fab5ba8, fmt=0x7f3a64df494e "unexpected asyncStatus: %d\n") at pqexpbuffer.c:237 #2 0x00007f3a64de45b4 in PQgetResult (conn=conn@entry=0x7f3a5fab5850) at fe-exec.c:1726 #3 0x00007f3a64de460f in PQexecStart (conn=conn@entry=0x7f3a5fab5850) at fe-exec.c:1896 #4 0x00007f3a64de47c1 in PQexec (conn=0x7f3a5fab5850, query=0x7f3a58a5e500 "DEALLOCATE pdo_stmt_00000004") at fe-exec.c:1805 #5 0x00007f3a61f0d698 in pgsql_stmt_dtor (stmt=0x7f3a5fc5d1c0) at /usr/src/debug/php-7.0.3/ext/pdo_pgsql/pgsql_statement.c:64 #6 0x00007f3a65231b6a in php_pdo_free_statement (stmt=0x7f3a5fc5d1c0) at /usr/src/debug/php-7.0.3/ext/pdo/pdo_stmt.c:2315 #7 0x00007f3a7913bfa1 in zend_objects_store_del (object=0x7f3a5fc5d310) at /usr/src/debug/php-7.0.3/Zend/zend_objects_API.c:182 #8 0x00007f3a79137474 in i_zval_ptr_dtor (zval_ptr=0x7f3a5fc19a38) at /usr/src/debug/php-7.0.3/Zend/zend_variables.h:58 #9 zend_object_std_dtor (object=0x7f3a5fc198c0) at /usr/src/debug/php-7.0.3/Zend/zend_objects.c:69 #10 0x00007f3a7913bbe0 in zend_objects_store_free_object_storage (objects=objects@entry=0x7f3a794dfbd0 <executor_globals+816>) at /usr/src/debug/php-7.0.3/Zend/zend_objects_API.c:103 #11 0x00007f3a790f2ac3 in shutdown_executor () at /usr/src/debug/php-7.0.3/Zend/zend_execute_API.c:357 #12 0x00007f3a7910195a in zend_deactivate () at /usr/src/debug/php-7.0.3/Zend/zend.c:967 #13 0x00007f3a790a1cc1 in php_request_shutdown (dummy=dummy@entry=0x0) at /usr/src/debug/php-7.0.3/main/main.c:1823 #14 0x00007f3a7918a868 in do_cli (argc=8, argv=0x7f3a7a1b44a0) at /usr/src/debug/php-7.0.3/sapi/cli/php_cli.c:1142 #15 0x00007f3a78f8826a in main (argc=8, argv=0x7f3a7a1b44a0) at /usr/src/debug/php-7.0.3/sapi/cli/php_cli.c:1345 Let me know if I can provide you more informations on this issue. Thank you very much! PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 15:00:01 2025 UTC |
now using a rebuilt non-stripped libpq, I started investigating the stack frames a bit more and it definitely looks like the connection object libpq is working on at this point is corrupt: (gdb) frame 0 #0 0x00007f250d6e2883 in pqGetc (result=0x7ffe6ad53527 "", conn=0x7f250e6ac498) at /home/crazyhat/postgresql-9.4-9.4.6/build/../src/interfaces/libpq/fe-misc.c:104 104 *result = conn->inBuffer[conn->inCursor++]; (gdb) p conn->pghost $7 = 0x7f250e6ac818 "\340\307j\016%\177" (gdb) p conn->dbName $8 = 0x0 (gdb) p conn->last_query $9 = 0x7f250e7fcab8 "\230\304\177\016%\177" (gdb) p conn->errorMessage $10 = {data = 0x7f250e6c4908 "\200<`\016%\177", len = 4294967297, maxlen = 16} (gdb) this doesn't look very... correct ? Also, that connection doesn't get corrupted inside of libpq - on frame 5 (the last one inside PHP), stuff already looks wahoonie-shaped: (gdb) frame 5 #5 0x00007f250d6dfe0b in PQexec (conn=0x7f250e6ac498, query=0x7f250e730730 "DEALLOCATE pdo_stmt_00000015") at /home/crazyhat/postgresql-9.4-9.4.6/build/../src/interfaces/libpq/fe-exec.c:1826 1826 if (!PQexecStart(conn)) (gdb) p conn->last_query $12 = 0x7f250e7fcab8 "\230\304\177\016%\177" (gdb) p conn $13 = (PGconn *) 0x7f250e6ac498 I'm not too well-versed with valgrind - can you give me some further hints in how I can get more information out of valgrind or with gdb?I've got it: $pdo = new PDO("pgsql:host=localhost;dbname=BASE", "USER", "PASS", []); $statement = $pdo->prepare('select *, ?, \'?\' from "text"'); $statement->execute([ 'test', 'test', 'test' ]);