From:
Operating system: Gentoo Linux
PHP version: 5.3.6
Package: Reproducible crash
Bug Type: Bug
Bug description:Segmentation fault after execution of php script wich uses
imagick
Description:
------------
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
Test script:
---------------
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
--
Edit bug report at http://bugs.php.net/bug.php?id=54668&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=54668&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=54668&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=54668&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=54668&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=54668&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=54668&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=54668&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=54668&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=54668&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=54668&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=54668&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=54668&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=54668&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=54668&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54668&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=54668&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=54668&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=54668&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=54668&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=54668&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=54668&r=mysqlcfg