#37931 [Opn->Fbk]: PHP in Apache crash after Database-Restart while using persistent connections

From: Date: Wed, 28 Jun 2006 09:32:43 +0000
Subject: #37931 [Opn->Fbk]: PHP in Apache crash after Database-Restart while using persistent connections
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-98885@lists.php.net to get a copy of this message
ID: 37931 Updated by: tony2001@php.net Reported By: Olaf dot Imig at bifab dot de -Status: Open +Status: Feedback Bug Type: OCI8 related Operating System: Linux(x86)/Solaris(sparc) PHP Version: 5.1.4 New Comment: I don't know how did you manage to shutdown Oracle instance when there are active connections and I definitely cannot reproduce it. Please provide more information. Previous Comments: ------------------------------------------------------------------------ [2006-06-28 08:56:51] Olaf dot Imig at bifab dot de Here my backtrace. When I start with httpd -X the server crash immediately after database restart #0 0xa70c228c in kputac () from /opt/oracle/oracle8i/lib/libclntsh.so.8.0 #1 0xa710ccb1 in OCISessionEnd () from /opt/oracle/oracle8i/lib/libclntsh.so.8.0 #2 0xa79cbf43 in php_oci_connection_close (connection=0x824b368) at /export/home/users/minstall/medea/software/php5.2-200606271430/ext/oci8/oci8.c:1457 #3 0xa79c99ba in php_oci_pconnection_list_dtor (entry=0x826b4d8) at /export/home/users/minstall/medea/software/php5.2-200606271430/ext/oci8/oci8.c:707 #4 0xa7b23bd9 in plist_entry_destructor (ptr=0x826b4d8) at /export/home/users/minstall/medea/software/php5.2-200606271430/Zend/zend_list.c:210 #5 0xa7b21590 in zend_hash_del_key_or_index (ht=0xa7c64bd4, arKey=0x823a5b4 "oci8___opasuser__topasl__0", nKeyLength=27, h=513927878, flag=0) at /export/home/users/minstall/medea/software/php5.2-200606271430/Zend/zend_hash.c:492 #6 0xa79cad30 in php_oci_do_connect_ex (username=0x823edb4 "OPASUSER", username_len=8, password=0x823a634 "OPASPASS", password_len=8, new_password=0x0, new_password_len=0, dbname=0x823d18c "TOPASL", dbname_len=6, charset=0x0, session_mode=0, persistent=1, exclusive=0) at /export/home/users/minstall/medea/software/php5.2-200606271430/ext/oci8/oci8.c:1077 #7 0xa79ca187 in php_oci_do_connect (ht=3, return_value=0x823a6b4, return_value_ptr=0x0, this_ptr=0x0, return_value_used=1, persistent=1, exclusive=0) at /export/home/users/minstall/medea/software/php5.2-200606271430/ext/oci8/oci8.c:947 #8 0xa79d9cc7 in zif_oci_pconnect (ht=3, return_value=0x823a6b4, return_value_ptr=0x0, this_ptr=0x0, return_value_used=1) at /export/home/users/minstall/medea/software/php5.2-200606271430/ext/oci8/oci8_interface.c:1536 #9 0xa7b3844c in zend_do_fcall_common_helper_SPEC (execute_data=0xafb2e6f0) at zend_vm_execute.h:200 #10 0xa7b3b7ec in ZEND_DO_FCALL_SPEC_CONST_HANDLER (execute_data=0xafb2e6f0) at zend_vm_execute.h:1642 #11 0xa7b38003 in execute (op_array=0x823ecf4) at zend_vm_execute.h:92 #12 0xa7b16625 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /export/home/users/minstall/medea/software/php5.2-200606271430/Zend/zend.c:1110 #13 0xa7acb122 in php_execute_script (primary_file=0xafb30a80) at /export/home/users/minstall/medea/software/php5.2-200606271430/main/main.c:1748 #14 0xa7b85710 in php_handler (r=0x8277d98) at /export/home/users/minstall/medea/software/php5.2-200606271430/sapi/apache2handler/sapi_apache2.c:593 #15 0x08067ce9 in ap_invoke_handler () #16 0x080656b0 in ap_process_request () #17 0x08060bcb in ap_process_http_connection () #18 0x08070cca in ap_process_connection () #19 0x08066b13 in child_main () #20 0x08066bfc in make_child () #21 0x08066ffe in ap_mpm_run () #22 0x0806cfad in main () ------------------------------------------------------------------------ [2006-06-27 16:57:27] tony2001@php.net Thank you for this bug report. To properly diagnose the problem, we need a backtrace to see what is happening behind the scenes. To find out how to generate a backtrace, please read http://bugs.php.net/bugs-generating-backtrace.php for *NIX and http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32 Once you have generated a backtrace, please submit it to this bug report and change the status back to "Open". Thank you for helping us make PHP better. Also, I should note that ocilogoff($db) does not do anything with persistent connections, it just ignores them, so this piece of code doesn't make much sense. ------------------------------------------------------------------------ [2006-06-27 16:22:57] Olaf dot Imig at bifab dot de Ok, I made the test with php5.2-20060627143 on Solaris. I found the same result. ------------------------------------------------------------------------ [2006-06-27 15:48:44] tony2001@php.net Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows: http://snaps.php.net/win32/php5.2-win32-latest.zip ------------------------------------------------------------------------ [2006-06-27 15:34:47] Olaf dot Imig at bifab dot de Description: ------------ The following behavior ist reproduceable: -Call the script -shutdown/startup the Database -Call the script => Apache Instance crash The bug is forced, when you call the script many times. For the tests I used the OCI8 stuff from Oracle8i on Solaris and from Oracle8i and Oracle10g on Linux. The result was the same. Without persistent connection all is perfect. Perhaps I can deliver a Solution. I made two changes in the code and the bug vanished. After restart of Database php_oci_connection_ping found invalid connections. The first problem was here, that the function php_oci_connection_close was called twice, first time triggered through zend_hash_del(&EG(persistent_list)... and then through a direct call. The Oracle-C-functions don't like this. Furthermore some pointers was freed twice. The second problem is the call of OCISessionEnd, when the Connection is invalid. Setting of connection->is_close=0 before calling php_oci_connection_close was helpful in this special case. On demand I can send my patch. Reproduce code: --------------- $db=ociplogon("OPASUSER","OPASPASS","TOPASL"); if(!$db){ print "Connection failed\n"; exit; } ocilogoff($db); ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=37931&edit=1

« previous php.bugs (#98885) next »