problem in cleanup of cursors in oracle.c - can cause php to die!!

From: Date: Thu, 22 Apr 1999 10:58:14 +0000
Subject: problem in cleanup of cursors in oracle.c - can cause php to die!!
Groups: php.dev 
Request: Send a blank email to php-dev+get-5200@lists.php.net to get a copy of this message
hi, -- sorry this might be a bit chaotic, but i feel kind-a braindead today - i think the interesting stuff is the purify log below!!! - i've isolated (i think) a real problem in the oracle.c stuff: (this problem causes random crashes when you use the oracle driver!) the problem is that we do a _php3_hash_apply(ORACLE_GLOBAL(php3_oracle_module).resource_list, (int (*)(void *))_cursors_cleanup); in line 203 and 216 (_close_orapconn, _close_oraconn) -> but these functions already get called thru destroy_resource_list which means that we end up having kind of a recursion - and we're having no control over the order the order in which things get released -> and we NEED to release cursors BEFORE connectiond!!! scenario: new cursors get added to ORACLE_GLOBAL(php3_oracle_module).le_cursor line 1517 and their id is returned to the caller who will store it in a php variable -> so they are in "list".... in ora_del_cursor they are removed from "list", but not ORACLE_GLOBAL(php3_oracle_module).le_cursor .... when the request does a shutdown we try top close all open cursors BEFORE we close the connection: all this together ends up in: (see below) when i did all that for the oci8-driver i decided that i let php do all the list&plist stuff, and keep my own HashTables for the module internal-stuff... i'm not really "up-to-date" with oracle.c - but i would highly appreciate if somebody could have a look, 'cause this is almost defnetly a "crash-bug"! regards, tc FMR: Free memory read: * This is occurring while in: _php3_hash_apply [php3_hash.c:663] _close_oraconn [oracle.c:203] list_entry_destructor [list.c:99] _php3_hash_destroy [php3_hash.c:637] destroy_resource_list [language-parser.y:156] php3_request_shutdown [main.c:767] run_cleanups [alloc.c:1650] ap_clear_pool [alloc.c:475] ap_destroy_pool [alloc.c:505] ap_clear_pool [alloc.c:472] child_main [http_main.c:3615] make_child [http_main.c:3976] perform_idle_server_maintenance [http_main.c:4140] standalone_main [http_main.c:4371] main [http_main.c:4591] _start [crt1.o] * Reading 4 bytes from 0x6a2204 in the heap. * Address 0x6a2204 is 44 bytes into a freed block at 0x6a21d8 of 60 bytes. * This block was allocated from: malloc [rtlib.o] _emalloc [alloc.c:115] _php3_hash_index_update_or_next_insert [php3_hash.c:273] php3_list_do_insert [list.c:67] oci8_do_connect [oci8.c:2198] php3_oci8_plogon [oci8.c:3293] cs_functioncall_post_variable_passing [control_structures_inline.h:930] phpparse [language-parser.y:534] php3_parse [main.c:1540] apache_php3_module_main [main.c:1920] send_php3 [mod_php3.c:245] send_parsed_php3 [mod_php3.c:261] ap_invoke_handler [http_config.c:508] process_request_internal [http_request.c:1212] ap_process_request [http_request.c:1228] child_main [http_main.c:3851] make_child [http_main.c:3976] perform_idle_server_maintenance [http_main.c:4140] standalone_main [http_main.c:4371] main [http_main.c:4591] _start [crt1.o] * There have been 28 frees since this block was freed from: free [rtlib.o] _efree [alloc.c:173] _php3_hash_destroy [php3_hash.c:646] destroy_resource_list [language-parser.y:156] php3_request_shutdown [main.c:767] run_cleanups [alloc.c:1650] ap_clear_pool [alloc.c:475] ap_destroy_pool [alloc.c:505] ap_clear_pool [alloc.c:472] child_main [http_main.c:3615] make_child [http_main.c:3976] perform_idle_server_maintenance [http_main.c:4140] standalone_main [http_main.c:4371] main [http_main.c:4591] _start [crt1.o] **** Purify instrumented /dot/dc4/packages/apache_1.3.6/src/httpd (pid 6626, forked from pid 6620) **** FMR: Free memory read: * This is occurring while in: _php3_hash_apply [php3_hash.c:664] _close_oraconn [oracle.c:203] list_entry_destructor [list.c:99] _php3_hash_destroy [php3_hash.c:637] destroy_resource_list [language-parser.y:156] php3_request_shutdown [main.c:767] run_cleanups [alloc.c:1650] ap_clear_pool [alloc.c:475] ap_destroy_pool [alloc.c:505] ap_clear_pool [alloc.c:472] child_main [http_main.c:3615] make_child [http_main.c:3976] perform_idle_server_maintenance [http_main.c:4140] standalone_main [http_main.c:4371] main [http_main.c:4591] _start [crt1.o] * Reading 4 bytes from 0x6a21fc in the heap. * Address 0x6a21fc is 36 bytes into a freed block at 0x6a21d8 of 60 bytes. * This block was allocated from: malloc [rtlib.o] _emalloc [alloc.c:115] _php3_hash_index_update_or_next_insert [php3_hash.c:273] php3_list_do_insert [list.c:67] oci8_do_connect [oci8.c:2198] php3_oci8_plogon [oci8.c:3293] cs_functioncall_post_variable_passing [control_structures_inline.h:930] phpparse [language-parser.y:534] php3_parse [main.c:1540] apache_php3_module_main [main.c:1920] send_php3 [mod_php3.c:245] send_parsed_php3 [mod_php3.c:261] ap_invoke_handler [http_config.c:508] process_request_internal [http_request.c:1212] ap_process_request [http_request.c:1228] child_main [http_main.c:3851] make_child [http_main.c:3976] perform_idle_server_maintenance [http_main.c:4140] standalone_main [http_main.c:4371] main [http_main.c:4591] _start [crt1.o] * There have been 28 frees since this block was freed from: free [rtlib.o] _efree [alloc.c:173] _php3_hash_destroy [php3_hash.c:646] destroy_resource_list [language-parser.y:156] php3_request_shutdown [main.c:767] run_cleanups [alloc.c:1650] ap_clear_pool [alloc.c:475] ap_destroy_pool [alloc.c:505] ap_clear_pool [alloc.c:472] child_main [http_main.c:3615] make_child [http_main.c:3976] perform_idle_server_maintenance [http_main.c:4140] standalone_main [http_main.c:4371] main [http_main.c:4591] _start [crt1.o] **** Purify instrumented /dot/dc4/packages/apache_1.3.6/src/httpd (pid 6626, forked from pid 6620) **** MSE: Memory segment error: * This is occurring while in: _cursors_cleanup [oracle.c:186] _php3_hash_apply [php3_hash.c:664] _close_oraconn [oracle.c:203] list_entry_destructor [list.c:99] _php3_hash_destroy [php3_hash.c:637] destroy_resource_list [language-parser.y:156] php3_request_shutdown [main.c:767] run_cleanups [alloc.c:1650] ap_clear_pool [alloc.c:475] ap_destroy_pool [alloc.c:505] ap_clear_pool [alloc.c:472] child_main [http_main.c:3615] make_child [http_main.c:3976] perform_idle_server_maintenance [http_main.c:4140] standalone_main [http_main.c:4371] main [http_main.c:4591] _start [crt1.o] * Accessing a memory range that crosses a memory segment boundary. Addressing 0x5a5a5a5e for 4 bytes ending at 0x5a5a5a62, which is neither in the heap nor the main stack. **** Purify instrumented /dot/dc4/packages/apache_1.3.6/src/httpd (pid 6626, forked from pid 6620) **** COR: Fatal core dump: * This is occurring while in: _cursors_cleanup [oracle.c:186] _php3_hash_apply [php3_hash.c:664] _close_oraconn [oracle.c:203] list_entry_destructor [list.c:99] _php3_hash_destroy [php3_hash.c:637] destroy_resource_list [language-parser.y:156] php3_request_shutdown [main.c:767] run_cleanups [alloc.c:1650] ap_clear_pool [alloc.c:475] ap_destroy_pool [alloc.c:505] ap_clear_pool [alloc.c:472] child_main [http_main.c:3615] make_child [http_main.c:3976] perform_idle_server_maintenance [http_main.c:4140] standalone_main [http_main.c:4371] main [http_main.c:4591] _start [crt1.o] * Received signal 10 (SIGBUS - Bus Error) * Faulting address = 0x5a5a5a5e * Signal mask: * Pending signals: **** Purify instrumented /dot/dc4/packages/apache_1.3.6/src/httpd (pid 6626, forked from pid 6620) **** COR: Fatal core dump: * This is occurring while in: _p921static [crtn.o] sig_coredump [http_main.c:2519] sigacthandler [sigaction.c] pure_signal_handler_wrapper [rtlib.o] pure_sigtramp [rtlib.o] _php3_hash_apply [php3_hash.c:664] _close_oraconn [oracle.c:203] list_entry_destructor [list.c:99] _php3_hash_destroy [php3_hash.c:637] destroy_resource_list [language-parser.y:156] php3_request_shutdown [main.c:767] run_cleanups [alloc.c:1650] ap_clear_pool [alloc.c:475] ap_destroy_pool [alloc.c:505] ap_clear_pool [alloc.c:472] child_main [http_main.c:3615] make_child [http_main.c:3976] perform_idle_server_maintenance [http_main.c:4140] standalone_main [http_main.c:4371] main [http_main.c:4591] _start [crt1.o] * Received signal 10 (SIGBUS - Bus Error) * Faulting address = 0x19e2 * Signal mask: (SIGBUS) * Pending signals: Thies C. Arntzen "One Big-Mac, Small Fries and a Coke!" Digital Collections Phone +49 40 235350 Fax +49 40 23535180 Hammerbrookstr. 93 20097 Hamburg / Germany -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#5200) next »