php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #4784 ocilogoff fails when using clobs and mod_perl
Submitted: 2000-06-02 17:57 UTC Modified: 2006-07-17 08:46 UTC
From: dave dot dunkin at vista dot com Assigned:
Status: Wont fix Package: OCI8 related
PHP Version: 3.0.16 OS: RH6.2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dave dot dunkin at vista dot com
New email:
PHP Version: OS:

 

 [2000-06-02 17:57 UTC] dave dot dunkin at vista dot com
We use mod_perl as well as PHP and access an Oracle8 database from both. We started getting segfaults from PHP when we started accessing the database from mod_perl. The problem occurs when a connection to the database is opened from mod_perl, then a LOB is accessed in PHP. When the PHP tries an ocilogoff, a segfault comes out of the Oracle library.

PHP 3.0.13-16
Apache 1.3.9
mod_perl 1.23-24
Linux 2.2.14
glibc 2.1.3
Oracle8i client 8.1.5.0.0 (with header patches so PHP compiles)



> [root@webserver004-bham apache]# gdb /usr/local/apache/bin/httpd
> GNU gdb 19991004
> Copyright 1998 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 "i386-redhat-linux"...
> (gdb) attach 25639
> Attaching to program: /usr/local/apache/bin/httpd, Pid 25639
> Reading symbols from /usr/oracle/lib/libclntsh.so.8.0...done.
> Reading symbols from /lib/libm.so.6...done.
> Reading symbols from /lib/libcrypt.so.1...done.
> Reading symbols from /lib/libdb.so.3...done.
> Reading symbols from /lib/libc.so.6...done.
> Reading symbols from /lib/libdl.so.2...done.
> Reading symbols from /lib/libpthread.so.0...done.
> Reading symbols from /lib/ld-linux.so.2...done.
> Reading symbols from /lib/libnss_files.so.2...done.
> Reading symbols from /usr/lib/gconv/ISO8859-1.so...done.
> Reading symbols from /usr/local/apache/libexec/mod_vhost_alias.so...done.
> Reading symbols from /usr/local/apache/libexec/mod_env.so...done.
> Reading symbols from /usr/local/apache/libexec/mod_log_config.so...done.
> Reading symbols from /usr/local/apache/libexec/mod_mime.so...done.
> Reading symbols from /usr/local/apache/libexec/mod_negotiation.so...done.
> Reading symbols from /usr/local/apache/libexec/mod_status.so...done.
> Reading symbols from /usr/local/apache/libexec/mod_include.so...done.
> Reading symbols from /usr/local/apache/libexec/mod_autoindex.so...done.
> Reading symbols from /usr/local/apache/libexec/mod_dir.so...done.
> Reading symbols from /usr/local/apache/libexec/mod_cgi.so...done.
> Reading symbols from /usr/local/apache/libexec/mod_asis.so...done.
> Reading symbols from /usr/local/apache/libexec/mod_imap.so...done.
> Reading symbols from /usr/local/apache/libexec/mod_actions.so...done.
> Reading symbols from /usr/local/apache/libexec/mod_userdir.so...done.
> ---Type <return> to continue, or q <return> to quit---
> Reading symbols from /usr/local/apache/libexec/mod_alias.so...done.
> Reading symbols from /usr/local/apache/libexec/mod_access.so...done.
> Reading symbols from /usr/local/apache/libexec/mod_auth.so...done.
> Reading symbols from /usr/local/apache/libexec/mod_setenvif.so...done.
> Reading symbols from /usr/local/apache/libexec/mod_rewrite.so...done.
> Reading symbols from /usr/local/apache/libexec/libphp3.so...done.
> Reading symbols from /usr/lib/libgd.so.1...done.
> Reading symbols from /usr/lib/libgdbm.so.2...done.
> Reading symbols from /lib/libpam.so.0...done.
> Reading symbols from /lib/libresolv.so.2...done.
> Reading symbols from /usr/local/apache/libexec/libperl.so...done.
> Reading symbols from /lib/libnsl.so.1...done.
> Reading symbols from /usr/local/apache/libexec/raven_ssl.so...done.
> Reading symbols from /usr/lib/perl5/5.00503/i386-linux/auto/Data/Dumper/Dumper.so...done.
> Reading symbols from /usr/lib/perl5/5.00503/i386-linux/auto/B/B.so...done.
> Reading symbols from /usr/lib/perl5/site_perl/5.005/i386-linux/auto/Apache/Symbol/Symbol.so...done.
> Reading symbols from /usr/lib/perl5/site_perl/5.005/i386-linux/auto/DBI/DBI.so...done.
> Reading symbols from /usr/lib/perl5/site_perl/5.005/i386-linux/auto/DBD/Oracle/Oracle.so...done.
> Reading symbols from /usr/oracle/lib/libskgxp8.so...done.
> Reading symbols from /usr/lib/perl5/site_perl/5.005/i386-linux/auto/Digest/MD5/M---Type <return> to continue, or q <return> to quit---
> D5.so...done.
> Reading symbols from /usr/lib/perl5/5.00503/i386-linux/auto/Socket/Socket.so...
> done.
> Reading symbols from /lib/libnss_nisplus.so.2...done.
> Reading symbols from /lib/libnss_nis.so.2...done.
> Reading symbols from /lib/libnss_dns.so.2...done.
> 0x4065317e in __select () from /lib/libc.so.6
> (gdb) c
> Continuing.
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x40169775 in kpufdesc () from /usr/oracle/lib/libclntsh.so.8.0
> (gdb) bt
> #0  0x40169775 in kpufdesc () from /usr/oracle/lib/libclntsh.so.8.0
> #1  0x40187946 in OCIDescriptorFree () from /usr/oracle/lib/libclntsh.so.8.0
> #2  0x4085b188 in _oci8_free_descr (descr=0x8d155f8) at functions/oci8.c:1894
> #3  0x408342ca in _php3_hash_destroy (ht=0x8d17e48) at php3_hash.c:668
> #4  0x40859a1c in _oci8_close_conn (connection=0x8d164d8)
>     at functions/oci8.c:632
> #5  0x4083b1c5 in list_entry_destructor (ptr=0x8d15e10) at list.c:96
> #6  0x408341c2 in _php3_hash_del_key_or_index (ht=0x408b8420, arKey=0x0,
>     nKeyLength=0, h=19, flag=1) at php3_hash.c:633
> #7  0x4083b139 in php3_list_do_delete (list=0x408b8420, id=19) at list.c:72
> #8  0x4085d581 in php3_oci8_logout (ht=0x8d161e0, return_value=0x408b6eb4,
>     list=0x408b8420, plist=0x408b83e0) at functions/oci8.c:3349
> #9  0x4087b7bd in phpparse () at control_structures_inline.h:929
> #10 0x40832e40 in php3_parse (yyin=0x87a6bf0) at main.c:1538
> #11 0x4083311c in apache_php3_module_main (r=0x87b2cb4, fd=27,
>     display_source_mode=0, preprocessed=0) at main.c:1892
> #12 0x4082fe81 in send_php3 () from /usr/local/apache/libexec/libphp3.so
> #13 0x4082ff07 in send_parsed_php3 () from /usr/local/apache/libexec/libphp3.so
> #14 0x8054553 in ap_invoke_handler ()
> #15 0x8067cb9 in process_request_internal ()
> #16 0x8067d1c in ap_process_request ()
> #17 0x805f62e in child_main ()
> #18 0x805f88c in make_child ()
> #19 0x805f939 in startup_children ()
> ---Type <return> to continue, or q <return> to quit---
> #20 0x805ff66 in standalone_main ()
> #21 0x80606e3 in main ()
> #22 0x405be9cb in __libc_start_main (main=0x80603ac <main>, argc=2,
>     argv=0xbffff9a4, init=0x804ea4c <_init>, fini=0x80962cc <_fini>,
>     rtld_fini=0x4000ae60 <_dl_fini>, stack_end=0xbffff99c)
>     at ../sysdeps/generic/libc-start.c:92

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-06-02 21:20 UTC] dave dot dunkin at vista dot com
The following scripts will reproduce the problem:
lobtest.php3:

<?php
//ociinternaldebug(1);
echo "connecting to the database<br>\n";
flush();
$conn = ociplogon("scott", "tiger", "dbhost");

echo "creating table 'lobs'<br>\n";
flush();
$sql = "create table lobs (lob CLOB)";
$stmt = ociparse($conn, $sql);
ociexecute($stmt);
ocifreestatement($stmt);

echo "inserting 'test' into 'lob' in 'lobs'<br>\n";
flush();
$sql = "insert into lobs (lob) values (EMPTY_CLOB()) returning lob into :lob";
$clob = ocinewdescriptor($conn, OCI_D_LOB);
$stmt = ociparse($conn, $sql);
ocibindbyname($stmt, ":lob", &$clob, -1, OCI_B_CLOB);
ociexecute($stmt, OCI_DEFAULT);
$clob->save("test");
ocicommit($conn);
flush();
ocifreedescriptor($clob);
ocifreestatement($stmt);

/*
echo "retreiving 'lob' from 'lobs'<br>\n";
flush();
$sql = "select lob from lobs";
$stmt = ociparse($conn, $sql);
ociexecute($stmt);
ocifetchinto($stmt, &$row, OCI_ASSOC);
$lob = $row["LOB"]->load();
ocifreestatement($stmt);

echo "value of 'lob':  ".$lob."<br>\n";
flush();
*/

echo "dropping table 'lobs'<br>\n";
flush();
$sql = "drop table lobs";
$stmt = ociparse($conn, $sql);
ociexecute($stmt);
ocifreestatement($stmt);

echo "disconnecting from the database<br>\n";
flush();
ocilogoff($conn);
ociinternaldebug(0);
?>



dbdconnect.cgi:

#!/usr/bin/perl

use DBI;
use DBD::Oracle;

$ENV{ORACLE_HOME} = "/usr/oracle";

print "Content-Type: text/plain\n\n";

print "Connecting to the database\n";

my $dbh = DBI->connect("dbi:Oracle:", "scott/tiger\@dbhost", "");

print "Connected.\n";

print "Disconnecting.\n";

$dbh->disconnect();
print "Disconnected.\n";

exit(0);

dbdconnect.cgi MUST be run in mod_perl for the failure to occur. It works okay as a CGI.
To reproduce the problem, run lobtest.php3 (to show that it works) then dbdconnect.cgi, then lobtest.php3 again.

mod_perl is compiled:
perl Makefile.PL ALL_HOOKS=1 EVERYTHING=1 USE_APXS=1 WITH_APXS=/usr/local/apache/bin/apxs

PHP is compiled:
./configure --with-oracle --with-apxs=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/apache

DBI version 1.13
DBD::Oracle version 1.03

We are also using Raven SSL 1.4.1.

 [2000-06-08 19:45 UTC] dave dot dunkin at vista dot com
Work-Around:

We found (with help from Tim Bunce) that both
DBD::Oracle and PHP's OCI8 call OCIInitialize(),
but with different parameters.  DBD::Oracle uses
OCI_OBJECT as the first parameter and PHP's OCI8 
uses OCI_DEFAULT as the first parameter.  If you
synchronize these either way there are no more
segmentation faults.

This isn't a fix, it's a work-around.  The bug
is either in PHP's OCI8 code or in the Oracle
client libraries.

-Chris Jensen (chris.jensen@vista.com)
 [2005-03-31 16:13 UTC] php-bugs at lists dot php dot net
We are sorry, but we do not support PHP 3 related problems anymore.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 06:01:30 2024 UTC