|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2011-05-05 12:52 UTC] luminarior at gmail dot com
Description:
------------
(I selected PHP 5.3.5 version in your form because you don't have 5.3.6.)
I wrote a php script (See link below) wich uses imagick (PHP wrapper for the ImageMagick library) to draw some logos for my site. The script executes and draws images OK, but in the end it generates segfaults. I think that you have some problems in your garbage collector because this script doesn't generate segfault in the end in case you use just one cycle of "for" or just one function "draw()".
I tried to compile php and imagick in debug mode and generate you some backtrace in gdb (see below):
#CFLAGS="-ggdb3" CXXFLAGS="${CFLAGS}" LDFLAGS="-Wl,-O1 -Wl,--as-needed" FEATURES="nostrip" USE="debug" emerge -1 dev-lang/php
These are the packages that would be merged, in reverse order:
Calculating dependencies... done!
[ebuild R ] dev-lang/php-5.3.6 USE="apache2 berkdb bzip2 cjk cli crypt ctype debug* exif fileinfo filter ftp gd gdbm hash iconv ipv6 json ldap mysql mysqli nls phar posix readline session simplexml spell ssl threads tokenizer truetype unicode xml zlib (-adabas) -bcmath (-birdstep) -calendar -cdb -cgi -curl -curlwrappers -db2 (-dbmaker) -doc -embed (-empress) (-empress-bcs) -enchant (-esoob) -firebird -flatfile -fpm (-frontbase) -gd-external -gmp -imap -inifile -interbase -intl -iodbc -kerberos -kolab -ldap-sasl -libedit -mhash -mssql -mysqlnd -oci8 -oci8-instant-client -odbc -pcntl -pdo -pic -postgres -qdbm -recode -sapdb -sharedext -sharedmem -snmp -soap -sockets (-solid) -sqlite -sqlite3 (-sybase-ct) -sysvipc -tidy -wddx -xmlreader -xmlrpc -xmlwriter -xpm -xsl -zip" 0 kB
# CFLAGS="-ggdb3" CXXFLAGS="${CFLAGS}" LDFLAGS="-Wl,-O1 -Wl,--as-needed" FEATURES="nostrip" USE="debug" emerge -1 dev-php5/pecl-imagick
These are the packages that would be merged, in reverse order:
Calculating dependencies... done!
[ebuild R ] dev-php5/pecl-imagick-3.0.1-r1 USE="-examples" PHP_TARGETS="php5-3 -php5-2" 0 kB
Total: 1 package (1 reinstall), Size of downloads: 0 kB
I have the following system:
# uname -a
Linux ddd 2.6.37-gentoo-r4 #2 SMP Fri Apr 29 20:19:52 MSD 2011 x86_64 AMD Phenom(tm) II X3 710 Processor AuthenticAMD GNU/Linux
Reproduce code:
---------------
This is my PHP script:
http://pastebin.com/x67mn6NL
Expected result:
----------------
Without segfaults in the end.
Actual result:
--------------
# gdb /usr/bin/php
GNU gdb (Gentoo 7.2 p1) 7.2
Copyright (C) 2010 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-pc-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.gentoo.org/>...
Reading symbols from /usr/bin/php...done.
(gdb) set args /var/www/myhost/htdocs/imr/update-test.php
(gdb) r
Starting program: /usr/bin/php /var/www/myhost/htdocs/imr/update-test.php
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
[New LWP 7617]
[LWP 7617 exited]
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
[Thu May 5 19:37:06 2011] Script: '/var/www/myhost/htdocs/imr/update-test.php'
/var/tmp/portage/dev-lang/php-5.3.6/work/sapis-build/cli/Zend/zend_vm_execute.h(475) : Freeing 0x012F2DD8 (32 bytes), script=/var/www/myhost/htdocs/imr/update-test.php
Last leak repeated 41 times
[Thu May 5 19:37:06 2011] Script: '/var/www/myhost/htdocs/imr/update-test.php'
/var/tmp/portage/dev-lang/php-5.3.6/work/sapis-build/cli/Zend/zend_vm_execute.h(300) : Freeing 0x012F46A8 (32 bytes), script=/var/www/myhost/htdocs/imr/update-test.php
Last leak repeated 41 times
=== Total 84 memory leaks detected ===
[New LWP 7626]
[New LWP 7625]
Program received signal SIGSEGV, Segmentation fault.
[Switching to LWP 7625]
0x00007ffff70f1fda in ?? ()
(gdb) bt full
#0 0x00007ffff70f1fda in ?? ()
No symbol table info available.
#1 0x00007ffff70f0906 in ?? ()
No symbol table info available.
#2 0x0000000000000000 in ?? ()
No symbol table info available.
(gdb) q
A debugging session is active.
Inferior 1 [process 7612] will be killed.
Quit anyway? (y or n) y
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 18:00:02 2025 UTC |
("Login" link on your site doesn't work. Only "Password:" form works for me.) I tried to do the following: CFLAGS="-ggdb3" CXXFLAGS="${CFLAGS}" LDFLAGS="-Wl,-O1 -Wl,--as-needed" FEATURES="nostrip" USE="debug -openmp" emerge -1 media-gfx/imagemagick After compilation I tried gdb again: # gdb /usr/bin/php GNU gdb (Gentoo 7.2 p1) 7.2 Copyright (C) 2010 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-pc-linux-gnu". For bug reporting instructions, please see: <http://bugs.gentoo.org/>... Reading symbols from /usr/bin/php...done. (gdb) set args /var/www/myhost/htdocs/imr/update-test.php (gdb) r Starting program: /usr/bin/php /var/www/myhost/htdocs/imr/update-test.php warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. [New LWP 26223] [LWP 26223 exited] warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. [Fri May 6 19:22:19 2011] Script: '/var/www/myhost/htdocs/imr/update-test.php' /var/tmp/portage/dev-lang/php-5.3.6/work/sapis-build/cli/Zend/zend_vm_execute.h(475) : Freeing 0x016F7F18 (32 bytes), script=/var/www/myhost/htdocs/imr/update-test.php Last leak repeated 41 times [Fri May 6 19:22:19 2011] Script: '/var/www/myhost/htdocs/imr/update-test.php' /var/tmp/portage/dev-lang/php-5.3.6/work/sapis-build/cli/Zend/zend_vm_execute.h(300) : Freeing 0x016F97E8 (32 bytes), script=/var/www/myhost/htdocs/imr/update-test.php Last leak repeated 41 times === Total 84 memory leaks detected === Program exited normally. (gdb) bt full No stack. (gdb) qThen I tried to recompile imagemagick with openmp again: CFLAGS="-ggdb3" CXXFLAGS="${CFLAGS}" LDFLAGS="-Wl,-O1 -Wl,--as-needed" FEATURES="nostrip" USE="debug" emerge -1 media-gfx/imagemagick These are the packages that would be merged, in reverse order: Calculating dependencies... done! [ebuild R ] media-gfx/imagemagick-6.6.8.5 USE="X bzip2 corefonts cxx djvu jpeg jpeg2k lcms lzma openmp* perl png svg tiff truetype webp wmf xml zlib -autotrace -fftw -fontconfig -fpx -graphviz -gs -hdri -jbig -lqr -openexr -q32 -q8 -raw -static-libs" VIDEO_CARDS="nvidia" 0 kB Total: 1 package (1 reinstall), Size of downloads: 0 kB It generates segfaults and doesn't give more useful debugging info unfortunatelly despite the fact that I tried to compile php, imagick and imagemagick with debug symbols: # gdb /usr/bin/php GNU gdb (Gentoo 7.2 p1) 7.2 Copyright (C) 2010 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-pc-linux-gnu". For bug reporting instructions, please see: <http://bugs.gentoo.org/>... Reading symbols from /usr/bin/php...done. (gdb) set args /var/www/myhost/htdocs/imr/update-test.php (gdb) r Starting program: /usr/bin/php /var/www/myhost/htdocs/imr/update-test.php warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. [New LWP 14755] [LWP 14755 exited] warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. [Fri May 6 19:28:15 2011] Script: '/var/www/myhost/htdocs/imr/update-test.php' /var/tmp/portage/dev-lang/php-5.3.6/work/sapis-build/cli/Zend/zend_vm_execute.h(475) : Freeing 0x016F8DA8 (32 bytes), script=/var/www/myhost/htdocs/imr/update-test.php Last leak repeated 41 times [Fri May 6 19:28:15 2011] Script: '/var/www/myhost/htdocs/imr/update-test.php' /var/tmp/portage/dev-lang/php-5.3.6/work/sapis-build/cli/Zend/zend_vm_execute.h(300) : Freeing 0x016FA678 (32 bytes), script=/var/www/myhost/htdocs/imr/update-test.php Last leak repeated 41 times === Total 84 memory leaks detected === [New LWP 14757] [New LWP 14756] Program received signal SIGSEGV, Segmentation fault. [Switching to LWP 14756] 0x00007ffff5835fd8 in ?? () (gdb) bt full #0 0x00007ffff5835fd8 in ?? () No symbol table info available. #1 0x00007ffff5834906 in ?? () No symbol table info available. #2 0x0000000000000000 in ?? () No symbol table info available. (gdb) q A debugging session is active. Inferior 1 [process 14752] will be killed. Quit anyway? (y or n) yI tried to recompile glibc in debug mode: # CFLAGS="-ggdb3" CXXFLAGS="${CFLAGS}" LDFLAGS="-Wl,-O1 -Wl,--as-needed" FEATURES="nostrip" USE="debug" emerge -1 glibc These are the packages that would be merged, in reverse order: Calculating dependencies... done! [ebuild R ] sys-libs/glibc-2.11.3 USE="debug* glibc-omitfp (multilib) nls -gd (-hardened) -profile (-selinux) -vanilla" 0 kB Total: 1 package (1 reinstall), Size of downloads: 0 kB >>> Verifying ebuild manifests >>> Emerging (1 of 1) sys-libs/glibc-2.11.3 >>> Installing (1 of 1) sys-libs/glibc-2.11.3 >>> Jobs: 1 of 1 complete Load avg: 2.03, 4.28, 5.65 >>> Auto-cleaning packages... And Then I tried valgrind again. There's a log of # USE_ZEND_ALLOC=0 valgrind /usr/bin/php /var/www/myhost/htdocs/imr/update-test.php http://www.filefactory.com/file/cb2f107/n/valgrind_log_tar_lzma