php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32741 hang on ociexecute() with collections (only with 10g, works with 9i)
Submitted: 2005-04-18 13:10 UTC Modified: 2005-11-08 11:51 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: fsurleau at skyservices dot net Assigned: tony2001 (profile)
Status: Closed Package: OCI8 related
PHP Version: 4.3.11 OS: linux
Private report: No CVE-ID: None
 [2005-04-18 13:10 UTC] fsurleau at skyservices dot net
Description:
------------
PHP Version 4.3.11

System 	Linux dev1 2.4.9-e.48smp #1 SMP Fri Jul 30 18:52:05 EDT 2004 i686
Build Date 	Apr 17 2005 16:44:16
Configure Command 	'./configure' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-zlib-dir=/usr/local' '--without-mysql' '--with-dom=/usr/local' '--with-dom-xslt' '--with-dom-exslt' '--with-expat-dir=/usr/local' '--enable-xslt' '--with-xslt-sablot' '--with-iconv-dir' '--with-zlib=/usr/local' '--with-oci8=/usr/local/oracle10g' '--disable-rpath' '--with-iconv' '--with-gd' '--enable-sigchild'
Server API 	Apache 2.0 Handler

Can't call an Oracle procedure returning collections with Oracle10g OCI8 lib.
A simple call to TEST_VARCHAR works (the result is outvarchar = 'VARCHAR VALUE'), and the entire code works when using Oracle9i OCI8 lib.

With Oracle10g, the result is a hang of the httpd process at ociexecute( $stmt ).

Oracle code :
-------------
CREATE OR REPLACE TYPE "COLLECTION_TYPE" AS TABLE OF VARCHAR2(255);
/

CREATE OR REPLACE PACKAGE TEST AS
	PROCEDURE TEST_COLLECTION( OUTPARAM OUT COLLECTION_TYPE );
	PROCEDURE TEST_VARCHAR( OUTPARAM OUT VARCHAR2 );
END;
/

CREATE OR REPLACE PACKAGE BODY TEST AS
	PROCEDURE TEST_COLLECTION( OUTPARAM OUT COLLECTION_TYPE ) IS
	BEGIN
		OUTPARAM := COLLECTION_TYPE( 'FIRST VALUE', 'SECOND VALUE', 'THIRD VALUE' );
	END;
	PROCEDURE TEST_VARCHAR( OUTPARAM OUT VARCHAR2 ) IS
	BEGIN
		OUTPARAM := 'VARCHAR VALUE';
	END;
END;
/

Reproduce code:
---------------
<?php
$cnx = ociplogon( USER_INTER, PASS_INTER, BD_INTER );
$sql = "BEGIN\nTEST.TEST_COLLECTION( :outparam );\nEND;";
$stmt = ociparse( $cnx, $sql );
$outparam = ocinewcollection( $cnx, "COLLECTION_TYPE" );
ocibindbyname( $stmt, ":outparam", &$outparam, -1, OCI_B_SQLT_NTY );
ociexecute( $stmt );
for( $i = 0; $i < $outparam->size(); $i++ )
{
    echo( "outparam[$i] = '" . $outparam->getelem( $i ) . "'<br>\n" );
}
$sql = "BEGIN\nTEST.TEST_VARCHAR( :outvarchar );\nEND;";
$stmt = ociparse( $cnx, $sql );
$outvarchar = '';
ocibindbyname( $stmt, ":outvarchar", &$outvarchar, 300 );
ociexecute( $stmt );
echo( "outvarchar = '" . $outvarchar . "'<br>\n" );
?>

Expected result:
----------------
outparam[0] = 'FIRST VALUE'
outparam[1] = 'SECOND VALUE'
outparam[2] = 'THIRD VALUE'
outvarchar = 'VARCHAR VALUE'

Actual result:
--------------
no result !

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-04-18 13:13 UTC] fsurleau at skyservices dot net
Reproduce Code is :

$cnx = ociplogon( USER_INTER, PASS_INTER, BD_INTER );
$sql = "BEGIN\nTEST.TEST_COLLECTION( :outparam );\nEND;";
$stmt = ociparse( $cnx, $sql );
$outparam = ocinewcollection( $cnx, "COLLECTION_TYPE" );
ocibindbyname( $stmt, ":outparam", &$outparam, -1, OCI_B_SQLT_NTY );
ociexecute( $stmt );
for( $i = 0; $i < $outparam->size(); $i++ )
{
    echo( "outparam[$i] = '" . $outparam->getelem( $i ) . "'<br>\n" );
}
$sql = "BEGIN\nTEST.TEST_VARCHAR( :outvarchar );\nEND;";
$stmt = ociparse( $cnx, $sql );
$outvarchar = '';
ocibindbyname( $stmt, ":outvarchar", &$outvarchar, 300 );
ociexecute( $stmt );
echo( "outvarchar = '" . $outvarchar . "'<br>\n" );


It was cut at first post...
 [2005-04-18 13:16 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


 [2005-04-18 13:22 UTC] fsurleau at skyservices dot net
Sorry (again, see bug #32722), I can't use PHP5.
 [2005-04-19 14:25 UTC] tony2001@php.net
What does it mean "no result"? Segfault? FALSE? Empty string? Zero?
There is _always_ a result, whatever you do.
 [2005-04-19 14:29 UTC] fsurleau at skyservices dot net
No result means I have nothing because as I explained, the httpd process hang (stop).
 [2005-04-19 14:35 UTC] tony2001@php.net
Are there any entries in the error_log ?
If so, use gdb to generate a backtrace.
 [2005-04-19 15:27 UTC] fsurleau at skyservices dot net
gdb ./httpd
GNU gdb Red Hat Linux (5.3.90-0.20030710.41.2.1rh)
Copyright 2003 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"...Using host libthread_db library "/lib/libthread_db.so.1".

(gdb) run -X
Starting program: /usr/local/apache2/bin/httpd -X
kgepop: no error frame to pop to for error 21522
OCI-21522: attempted to use an invalid connection in OCI (object mode only)
Errors in file :
OCI-21522: attempted to use an invalid connection in OCI (object mode only)


----- Call Stack Trace -----
Cannot open /proc/2679/exe.
calling              call     entry                argument values in hex
location             type     point                (? means dubious value)
-------------------- -------- -------------------- ----------------------------

Program received signal SIGSEGV, Segmentation fault.
0x40e65940 in slrac () from /usr/local/oracle10g/lib/libclntsh.so.10.1
(gdb) bt
#0  0x40e65940 in slrac () from /usr/local/oracle10g/lib/libclntsh.so.10.1
#1  0x40eb8a13 in kgdsaaddr () from /usr/local/oracle10g/lib/libclntsh.so.10.1
#2  0x40eb848e in kgdsdst () from /usr/local/oracle10g/lib/libclntsh.so.10.1
#3  0x40a4e80c in skgudmp () from /usr/local/oracle10g/lib/libclntsh.so.10.1
#4  0x40e9a69e in kgepop () from /usr/local/oracle10g/lib/libclntsh.so.10.1
#5  0x40e9ae1a in kgesev () from /usr/local/oracle10g/lib/libclntsh.so.10.1
#6  0x40e9ac1f in kgesec0 () from /usr/local/oracle10g/lib/libclntsh.so.10.1
#7  0x40d327c8 in kodogr2lt () from /usr/local/oracle10g/lib/libclntsh.so.10.1
#8  0x40cbd020 in kosindcv () from /usr/local/oracle10g/lib/libclntsh.so.10.1
#9  0x40cbca9a in kosiend () from /usr/local/oracle10g/lib/libclntsh.so.10.1
#10 0x40cbde4d in kpctor () from /usr/local/oracle10g/lib/libclntsh.so.10.1
#11 0x40cd3332 in ttca2p () from /usr/local/oracle10g/lib/libclntsh.so.10.1
#12 0x40ca05b4 in ttcacr () from /usr/local/oracle10g/lib/libclntsh.so.10.1
#13 0x40ca1487 in ttcdrv () from /usr/local/oracle10g/lib/libclntsh.so.10.1
#14 0x40b4312d in nioqwa () from /usr/local/oracle10g/lib/libclntsh.so.10.1
#15 0x409b4d56 in upirtrc () from /usr/local/oracle10g/lib/libclntsh.so.10.1
#16 0x4094ba0d in kpurcsc () from /usr/local/oracle10g/lib/libclntsh.so.10.1
#17 0x409081b8 in kpuexecv8 () from /usr/local/oracle10g/lib/libclntsh.so.10.1
#18 0x4090a084 in kpuexec () from /usr/local/oracle10g/lib/libclntsh.so.10.1
#19 0x4097e85e in OCIStmtExecute () from /usr/local/oracle10g/lib/libclntsh.so.10.1
#20 0x403afb84 in oci_execute (statement=0x820369c, func=0x404aaff6 "OCIExecute", mode=32) at /home/install/php-4.3.11/ext/oci8/oci8.c:1483
#21 0x403b629f in zif_ociexecute (ht=1, return_value=0x8208fbc, this_ptr=0x0, return_value_used=0) at /home/install/php-4.3.11/ext/oci8/oci8.c:4017
#22 0x4048f71f in execute (op_array=0x81e63c4) at /home/install/php-4.3.11/Zend/zend_execute.c:1654
#23 0x4047ce66 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /home/install/php-4.3.11/Zend/zend.c:926
#24 0x4044ae84 in php_execute_script (primary_file=0xbffeb9c0) at /home/install/php-4.3.11/main/main.c:1745
#25 0x4049538f in php_handler (r=0x81da8d8) at /home/install/php-4.3.11/sapi/apache2handler/sapi_apache2.c:560
#26 0x08087646 in ap_run_handler (r=0x81da8d8) at config.c:152
#27 0x08087b61 in ap_invoke_handler (r=0x81da8d8) at config.c:364
#28 0x08071365 in ap_process_request (r=0x81da8d8) at http_request.c:249
#29 0x0806d358 in ap_process_http_connection (c=0x81d44b0) at http_core.c:251
#30 0x080907e2 in ap_run_process_connection (c=0x81d44b0) at connection.c:43
#31 0x080862ad in child_main (child_num_arg=0) at prefork.c:610
#32 0x08086360 in make_child (s=0x80c73a0, slot=0) at prefork.c:650
#33 0x0808644a in startup_children (number_to_start=5) at prefork.c:722
#34 0x08086750 in ap_mpm_run (_pconf=0x80c2a50, plog=0x80fab30, s=0x80c73a0) at prefork.c:941
#35 0x0808bc9f in main (argc=2, argv=0xbffebd64) at main.c:618
 [2005-09-08 11:45 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).
 [2005-11-03 13:04 UTC] fsurleau at skyservices dot net
OCI8 v.1.1 is a PHP 5 release.

The bug still exists in PHP 4.4.1
 [2005-11-03 21:55 UTC] sniper@php.net
Tony, you propably can tell if that extension in PECL works with PHP 4?
 [2005-11-03 22:10 UTC] wez@php.net
please try:
pear install oci8-beta
as instructed.
The driver has been tested with php4.
 [2005-11-08 11:51 UTC] tony2001@php.net
It's fixed in 1.1, which exists only in HEAD and PECL.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 13:01:29 2024 UTC