php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30052 segmentation fault when script finished
Submitted: 2004-09-10 17:20 UTC Modified: 2005-07-03 00:58 UTC
From: tho at e-dict dot net Assigned:
Status: Closed Package: ODBC related
PHP Version: 4.3.8 OS: Linux
Private report: No CVE-ID:
 [2004-09-10 17:20 UTC] tho at e-dict dot net
Description:
------------
Some of our database scripts produce segfaults when they are done. It is difficult to supply sample code since the segfault depends at least on the following:

* a successful call to odbc_pconnect('host:node','user', 'pass'); 

if odbc_pconnect fails there is no segfault

* some (included?) code before odbc_pconnect

While trying to reduce the code i noticed, that include(_once?) is needed to trigger the problem. That's meant with "some _included_ code" in the sample below.

* filename

"/var/home/tho/oss/sbwi/bin/php -c /var/home/tho/oss/sbwi/conf -f /var/home/tho/oss/sbwi/dump1.php"
cores while the similar code in
"/var/home/tho/oss/sbwi/bin/php -c /var/home/tho/oss/sbwi/conf -f /var/home/tho/oss/sbwi/dump.php"
does not core

The code itself works fine. The segfault always happens after the last line.

We are connecting to ADABAS using ODBC

configure:

./configure\
         --prefix=$(PREFIX)\
         --with-adabas=$(adabas_dir)\
         --with-openssl=$(PREFIX) \
         --disable-session\
         --with-db\
         --without-gd\
         --with-config-file-path=$(PREFIX)/conf


Reproduce code:
---------------
<?
[...some _included_ code...]
$dbhandle = @odbc_pconnect('host:node','user', 'pass');
exit;
?>

Expected result:
----------------
no segfault :-)

Actual result:
--------------
(gdb) run -c /var/home/tho/oss/sbwi/conf -f /var/home/tho/oss/sbwi/dump1.php
Starting program: /var/home/tho/oss/sbwi/bin/php -c /var/home/tho/oss/sbwi/conf -f /var/home/tho/oss/sbwi/dump1.php

Program received signal SIGSEGV, Segmentation fault.
zend_hash_index_find (ht=0x82cece0, h=7, pData=0xbffff3f8) at /var/home/tho/oss/sbwi/src/software/php-4.3.8/Zend/zend_hash.c:967
967                     if ((p->h == h) && (p->nKeyLength == 0)) {
(gdb) bt
#0  zend_hash_index_find (ht=0x82cece0, h=7, pData=0xbffff3f8) at /var/home/tho/oss/sbwi/src/software/php-4.3.8/Zend/zend_hash.c:967
#1  0x081518af in _zend_list_find (id=7, type=0xbffff428) at /var/home/tho/oss/sbwi/src/software/php-4.3.8/Zend/zend_list.c:70
#2  0x080a212d in _close_odbc_pconn (rsrc=0x83071a0) at /var/home/tho/oss/sbwi/src/software/php-4.3.8/ext/odbc/php_odbc.c:250
#3  0x08151b1e in plist_entry_destructor (ptr=0x83071a0) at /var/home/tho/oss/sbwi/src/software/php-4.3.8/Zend/zend_list.c:203
#4  0x0815091a in zend_hash_apply_deleter (ht=0x82ced08, p=0x8323cb0) at /var/home/tho/oss/sbwi/src/software/php-4.3.8/Zend/zend_hash.c:611
#5  0x08150a5b in zend_hash_graceful_reverse_destroy (ht=0x82ced08) at /var/home/tho/oss/sbwi/src/software/php-4.3.8/Zend/zend_hash.c:677
#6  0x08151bc2 in zend_destroy_rsrc_list (ht=0x82ced08) at /var/home/tho/oss/sbwi/src/software/php-4.3.8/Zend/zend_list.c:233
#7  0x0814bfb3 in zend_shutdown () at /var/home/tho/oss/sbwi/src/software/php-4.3.8/Zend/zend.c:554
#8  0x081262fe in php_module_shutdown () at /var/home/tho/oss/sbwi/src/software/php-4.3.8/main/main.c:1286
#9  0x08164319 in main (argc=5, argv=0xbffff694) at /var/home/tho/oss/sbwi/src/software/php-4.3.8/sapi/cgi/cgi_main.c:1685
#10 0x401027ee in __libc_start_main () from /lib/libc.so.6


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-10-01 17:38 UTC] tho at e-dict dot net
Still cores :-(

(gdb) run  -c /var/home/tho/oss/sbwi/conf -f dump.php
Starting program: /var/home/tho/oss/sbwi/bin/php -c /var/home/tho/oss/sbwi/conf -f dump.php

Program received signal SIGSEGV, Segmentation fault.
zend_hash_index_find (ht=0x50, h=7, pData=0x50)
    at /var/home/tho/oss/sbwi/src/software/php4-STABLE-200409301630/Zend/zend_hash.c:967
967                     if ((p->h == h) && (p->nKeyLength == 0)) {
(gdb) bt
#0  zend_hash_index_find (ht=0x50, h=7, pData=0x50)
    at /var/home/tho/oss/sbwi/src/software/php4-STABLE-200409301630/Zend/zend_hash.c:967
#1  0x0814d09b in _zend_list_find (id=7, type=0xbffff298)
    at /var/home/tho/oss/sbwi/src/software/php4-STABLE-200409301630/Zend/zend_list.c:70
#2  0x080a1659 in _close_odbc_pconn (rsrc=0x50)
    at /var/home/tho/oss/sbwi/src/software/php4-STABLE-200409301630/ext/odbc/php_odbc.c:250
#3  0x0814d33f in plist_entry_destructor (ptr=0x83c7f50)
    at /var/home/tho/oss/sbwi/src/software/php4-STABLE-200409301630/Zend/zend_list.c:198
#4  0x0814c079 in zend_hash_apply_deleter (ht=0x82d02e8, p=0x8539b40)
    at /var/home/tho/oss/sbwi/src/software/php4-STABLE-200409301630/Zend/zend_hash.c:611
#5  0x0814c109 in zend_hash_graceful_reverse_destroy (ht=0x82d02e8)
    at /var/home/tho/oss/sbwi/src/software/php4-STABLE-200409301630/Zend/zend_hash.c:677
#6  0x08147af0 in zend_shutdown () at /var/home/tho/oss/sbwi/src/software/php4-STABLE-200409301630/Zend/zend.c:554
#7  0x08122600 in php_module_shutdown () at /var/home/tho/oss/sbwi/src/software/php4-STABLE-200409301630/main/main.c:1286
#8  0x0815829f in main (argc=5, argv=0xbffff4f4)
    at /var/home/tho/oss/sbwi/src/software/php4-STABLE-200409301630/sapi/cgi/cgi_main.c:1685
 [2004-10-01 21:00 UTC] sniper@php.net
Do you load any extensions in your php.ini ??
(including any zend extensions, like the optimizer)
 [2004-10-01 22:20 UTC] tho at e-dict dot net
No extensions are loaded. This is our php.ini:

register_globals = On
variables_order = "EGPCS"
uodbc.allow_persistent = 1
uodbc.max_persistent = 500
uodbc.max_links = 500
track_vars=1
log_errors=1
display_errors=0
html_errors=0
error_log=/var/home/tho/oss/sbwi/logs/php_error.log
include_path=.:/var/home/tho/oss/sbwi/lib/php:/var/home/tho/oss/sbwi/web/include
error_reporting=15
 [2004-12-12 02:03 UTC] sniper@php.net
Does it happen when you change odbc_pconnect() to odbc_connect() ??
 [2004-12-21 07:41 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 [2005-01-12 16:03 UTC] tho at e-dict dot net
Works fine with odbc_connect.
 [2005-01-18 17:27 UTC] tony2001@php.net
Are you still able to reproduce it with latest PHP 4.3.x snapshot ?
 [2005-01-26 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2005-07-03 00:58 UTC] edink@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Sat Apr 19 09:02:28 2014 UTC