PHP Bugs  
php.net | support | documentation | report a bug | advanced search | search howto | statistics | login

go to bug id or search bugs for  

Bug #26393 Segfault during request shutdown in _oci_close_session() (oci8.c:2443)
Submitted:24 Nov 2003 11:19pm UTC Modified: 8 Sep 2005 11:45am UTC
From:troy dot tinnes at motorola dot com Assigned to:tony2001
Status:Closed Category:OCI8 related
Version:4.3.4 OS:Solaris 2.8
Votes:10 Avg. Score:4.9 ± 0.3 Reproduced:8 of 9 (88.9%)
Same Version:5 (62.5%) Same OS:5 (62.5%)
View/Vote Developer Edit Submission

[24 Nov 2003 11:19pm UTC] troy dot tinnes at motorola dot com
Description:
------------
Environment:
Sun Solaris 2.8
Sun Ultra Enterprise
PHP 4.3.4
Apache 2.0.47
Problem Description: On some HTML outputs, the page code stops
unexpectedly. There does not appear to be any real reason for halting
the execution - it stops generating code many times - midway through
displaying a record (1 HTML table row). For example if I have a query
that shows which people bought widget "a" in the past month - the output
might be ok. Use the same script and show which people bought widget "b"
- the script might stop 3/4 of the way down the page mid-record. One
thing that is consistent - is that it will always stop in the same
place. 2 days later, Widget "b" output might be fine - displaying Widget
"a" is now a problem. 

Reproduce code:
---------------
I use object-oriented code to do the database activities - example:
$db = new myDB ($db1);
$db->connect();
$db->query($sql1);

In the db.class file, I have functions like this:

function connect ()
   {
   $conn = ocilogon ($this->username, $this->password,
                     $this->hostspec);
   $this->conn = $conn;
   }

AND

function query ($sql)
   {
   $this->stmt = @ociparse ($this->conn, $sql);

   if (!$this->stmt) {
      return false;
   }
   else {
      @ociexecute($this->stmt, OCI_DEFAULT);
      return($this->rowcount());
        }
   }

As I said before, I do not use persistent connections because I have
several different database instances I connect to based on the type of
information requested. 

Expected result:
----------------
I am hoping to see complete HTML outputs!

Actual result:
--------------
BACKTRACE:
---------
solaris8:/opt/web/apache_php/apache2/bin# /usr/misc/bin/gdb
/opt/web/apache_php/apache2/bin/httpd
GNU gdb 5.3
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are welcome to change it and/or distribute copies of it under certain
conditions. Type "show copying" to see the conditions. There is
absolutely no warranty for GDB.  Type "show warranty" for details. This
GDB was configured as "sparc-sun-solaris2.8"...
(gdb) run -X
Starting program: /opt/web/apache_php/apache2/bin/httpd -X
[New LWP 1]
[New LWP 2]
[New LWP 3]
[New LWP 4]
[New LWP 5]

Program received signal SIGSEGV, Segmentation fault.
0xff0331f0 in strlen () from /usr/lib/libc.so.1
(gdb) bt
#0  0xff0331f0 in strlen () from /usr/lib/libc.so.1
#1  0xfe1e5918 in _oci_close_session (session=0x313bc8)
    at /opt/web/apache_php/source/php-4.3.4/ext/oci8/oci8.c:2443
#2  0xfe1e0ca8 in _oci_session_list_dtor (rsrc=0x200e30)
    at /opt/web/apache_php/source/php-4.3.4/ext/oci8/oci8.c:935
#3  0xfe36dcb0 in list_entry_destructor (ptr=0x200e30)
    at /opt/web/apache_php/source/php-4.3.4/Zend/zend_list.c:177
#4  0xfe36aa64 in zend_hash_apply_deleter (ht=0xfe3e13fc, p=0x2017b0)
    at /opt/web/apache_php/source/php-4.3.4/Zend/zend_hash.c:608
#5  0xfe36ae04 in zend_hash_graceful_reverse_destroy (ht=0xfe3e13fc)
    at /opt/web/apache_php/source/php-4.3.4/Zend/zend_hash.c:674
#6  0xfe36dee0 in zend_destroy_rsrc_list (ht=0xfe3e13fc)
    at /opt/web/apache_php/source/php-4.3.4/Zend/zend_list.c:233
#7  0xfe3501dc in shutdown_executor ()
    at /opt/web/apache_php/source/php-4.3.4/Zend/zend_execute_API.c:213
#8  0xfe3612f8 in zend_deactivate ()
    at /opt/web/apache_php/source/php-4.3.4/Zend/zend.c:665
#9  0xfe306904 in php_request_shutdown (dummy=0x0)
    at /opt/web/apache_php/source/php-4.3.4/main/main.c:998
#10 0xfe383be8 in php_apache_request_dtor (r=0x187dd0)
    at
/opt/web/apache_php/source/php-4.3.4/sapi/apache2handler/sapi_apache2.c:
449
#11 0xfe3840b8 in php_handler (r=0x187dd0)
---Type <return> to continue, or q <return> to quit---
    at
/opt/web/apache_php/source/php-4.3.4/sapi/apache2handler/sapi_apache2.c:
553
#12 0x0004a37c in ap_run_handler (r=0x187dd0) at config.c:195 #13
0x0004a950 in ap_invoke_handler (r=0x187dd0) at config.c:401 #14
0x00037d60 in ap_process_request (r=0x187dd0) at http_request.c:288 #15
0x00033274 in ap_process_http_connection (c=0x169220) at http_core.c:293
#16 0x00055740 in ap_run_process_connection (c=0x169220) at
connection.c:85 #17 0x00048b78 in child_main (child_num_arg=1470896) at
prefork.c:694 #18 0x00048d70 in make_child (s=0x9bb80, slot=0) at
prefork.c:734 #19 0x00048dfc in startup_children (number_to_start=4) at
prefork.c:806 #20 0x0004962c in ap_mpm_run (_pconf=0x1, plog=0xd1558,
s=0x9bb80)
    at prefork.c:1022
#21 0x0004f23c in main (argc=2, argv=0xffbefd1c) at main.c:660
(gdb) 

LOG ENTRY IN APACHE
----------------------
websrv01:/opt/web/apache_php/apache/logs% grep Segment error_log [Thu
Nov 20 20:31:59 2003] [error] [client 200.30.7.100] Segmentation Fault -
core dumped [Thu Nov 20 20:33:46 2003] [error] [client 200.30.7.100]
Segmentation Fault - core dumped [Thu Nov 20 20:33:55 2003] [error]
[client 200.30.7.100] Segmentation Fault - core dumped [Thu Nov 20
20:47:37 2003] [error] [client 200.30.7.100] Segmentation Fault - core
dumped [Sun Nov 23 19:55:45 2003] [notice] child pid 4946 exit signal
Segmentation fault (11) [Sun Nov 23 19:56:04 2003] [notice] child pid
6151 exit signal Segmentation fault (11) [Sun Nov 23 19:58:31 2003]
[notice] child pid 6536 exit signal Segmentation fault (11) [Sun Nov 23
20:05:13 2003] [notice] child pid 7172 exit signal Segmentation fault
(11) [Mon Nov 24 13:39:02 2003] [notice] child pid 27426 exit signal
Segmentation fault (11)

[25 Nov 2003 2:18pm UTC] sniper@php.net
Oops..I meant the Open reports.. :)
See bug #24531 which has some patch in it.
Try the patch..
[27 Nov 2003 12:28am UTC] sniper@php.net
User reported that patch produced exact same backtrace as before.
(PLEASE don't add that same bt anymore..)
[19 Dec 2003 12:18pm UTC] tony2001@php.net
yes, there is some troubles with thread safety in PHP_4_3 branch.
I'll ask Harald to port his changes from HEAD one more time.
could you, please, try latest PHP5 snapshot? it should be fixed there.
[15 Jan 2004 1:29am UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip

[15 Jan 2004 7:25am UTC] troy dot tinnes at motorola dot com
With the testing so far - PHP 5 installation appears to fix the problem.
[15 Jan 2004 8:32am UTC] tony2001@php.net
ok, I'll try to make it work with 4.3.x soon.
[22 Aug 2004 8:17am UTC] Troy dot Tinnes at motorola dot com
PHP 5 reduces the occurance of the problem - but problem still persists
[9 Feb 2005 1:28am UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

[17 Feb 2005 1:00am 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".
[8 Sep 2005 11:45am UTC] tony2001@php.net
The bug has been fixed in OCI8 v.1.1, which is available in CVS HEAD and
PECL (use `pear install oci8-beta` to install it).

RSS feed | show source 

PHP Copyright © 2001-2009 The PHP Group
All rights reserved.
Last updated: Sat Nov 21 10:30:49 2009 UTC