|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-12-23 01:58 UTC] tony2001 at ua dot fm
RH7.3, Apache 1.3.27, PHP 4.3.0RC4
bcompiler compiled as dynamic module.
It seems that bcompiler_compile.php compiles class ok, but loading this class with bcompiler_load(); initiates segfault in Apache:
----------
(gdb) file /usr/local/apache/bin/httpd
Reading symbols from /usr/local/apache/bin/httpd...done.
(gdb) run -X -f /usr/local/apache/conf/httpd.conf
Starting program: /usr/local/apache/bin/httpd -X -f /usr/local/apache/conf/httpd.conf
Program received signal SIGSEGV, Segmentation fault.
0x4207b424 in chunk_realloc () from /lib/i686/libc.so.6
(gdb) bt
#0 0x4207b424 in chunk_realloc () from /lib/i686/libc.so.6
#1 0x4207b1f8 in realloc () from /lib/i686/libc.so.6
#2 0x401335af in _erealloc (ptr=0x8147dec, size=5, allow_failure=0) at /root/CVS/php-4.3.0RC4/Zend/zend_alloc.c:293
#3 0x40475ccd in apc_create_string () from /usr/local/lib/php/extensions/bcompiler.so
#4 0x40476163 in apc_deserialize_magic () from /usr/local/lib/php/extensions/bcompiler.so
#5 0x40475180 in zif_bcompiler_load () from /usr/local/lib/php/extensions/bcompiler.so
#6 0x401545fc in execute (op_array=0x81244ac) at /root/CVS/php-4.3.0RC4/Zend/zend_execute.c:1596
#7 0x4014220c in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /root/CVS/php-4.3.0RC4/Zend/zend.c:864
#8 0x4011c22d in php_execute_script (primary_file=0xbffff420) at /root/CVS/php-4.3.0RC4/main/main.c:1573
#9 0x4015bb9e in apache_php_module_main (r=0x811ea3c, display_source_mode=0)
at /root/CVS/php-4.3.0RC4/sapi/apache/sapi_apache.c:55
#10 0x4015c696 in send_php (r=0x811ea3c, display_source_mode=0, filename=0x0)
at /root/CVS/php-4.3.0RC4/sapi/apache/mod_php4.c:556
#11 0x4015c6ea in send_parsed_php (r=0x811ea3c) at /root/CVS/php-4.3.0RC4/sapi/apache/mod_php4.c:571
#12 0x0806b02b in ap_invoke_handler ()
#13 0x0807ffcb in process_request_internal ()
#14 0x080803ef in ap_internal_redirect ()
#15 0x0805fe8c in handle_dir ()
#16 0x0806b02b in ap_invoke_handler ()
#17 0x0807ffcb in process_request_internal ()
#18 0x0808002c in ap_process_request ()
#19 0x08076e4d in child_main ()
#20 0x08076ff8 in make_child ()
#21 0x0807716c in startup_children ()
#22 0x080777e4 in standalone_main ()
#23 0x08078047 in main ()
#24 0x42017499 in __libc_start_main () from /lib/i686/libc.so.6
----------
Almost the same trouble happends when calling phpinfo(); if bcompiler.so is loaded.
----------
(gdb) run -X -f /usr/local/apache/conf/httpd.conf
Starting program: /usr/local/apache/bin/httpd -X -f /usr/local/apache/conf/httpd.conf
Program received signal SIGSEGV, Segmentation fault.
0x4207acc0 in chunk_free () from /lib/i686/libc.so.6
(gdb) bt
#0 0x4207acc0 in chunk_free () from /lib/i686/libc.so.6
#1 0x4207ac24 in free () from /lib/i686/libc.so.6
#2 0x40133875 in shutdown_memory_manager (silent=0, clean_cache=0) at /root/CVS/php-4.3.0RC4/Zend/zend_alloc.c:462
#3 0x4011afa4 in php_request_shutdown (dummy=0x0) at /root/CVS/php-4.3.0RC4/main/main.c:949
#4 0x4015bbf8 in apache_php_module_main (r=0x811e0fc, display_source_mode=0)
at /root/CVS/php-4.3.0RC4/sapi/apache/sapi_apache.c:61
#5 0x4015c696 in send_php (r=0x811e0fc, display_source_mode=0, filename=0x0)
at /root/CVS/php-4.3.0RC4/sapi/apache/mod_php4.c:556
#6 0x4015c6ea in send_parsed_php (r=0x811e0fc) at /root/CVS/php-4.3.0RC4/sapi/apache/mod_php4.c:571
#7 0x0806b02b in ap_invoke_handler ()
#8 0x0807ffcb in process_request_internal ()
#9 0x0808002c in ap_process_request ()
#10 0x08076e4d in child_main ()
#11 0x08076ff8 in make_child ()
#12 0x0807716c in startup_children ()
#13 0x080777e4 in standalone_main ()
#14 0x08078047 in main ()
#15 0x42017499 in __libc_start_main () from /lib/i686/libc.so.6
----------
The same trouble happends with Apache 1.3.26, PHP 4.3.0-dev (rather old, July CVS-version).
Extension compiles without any warnings or errors.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 07:00:01 2025 UTC |
Ok, I've tried it with 4.3.0 and made some improvements. I don't know is such patch acceptable or not, but it works ok for me. *-----------------* --- /root/IN/bcompiler/bcompiler/bcompiler.c Tue Feb 4 14:52:11 2003 +++ ./bcompiler.c Wed Mar 12 22:43:28 2003 @@ -311,7 +311,7 @@ */ static void php_bcompiler_init_globals(zend_bcompiler_globals *bcompiler_globals) { - + bcompiler_globals->buffer = (char*) emalloc(1); bcompiler_globals->stream = NULL; @@ -326,9 +326,8 @@ */ PHP_MINIT_FUNCTION(bcompiler) { - + ZEND_INIT_MODULE_GLOBALS(bcompiler, php_bcompiler_init_globals, NULL); - bcompiler_saved_zend_compile_file = zend_compile_file; zend_compile_file = bcompiler_compile_file; @@ -340,6 +339,7 @@ */ PHP_MSHUTDOWN_FUNCTION(bcompiler) { + zend_compile_file = bcompiler_saved_zend_compile_file; return SUCCESS; } @@ -350,6 +350,8 @@ */ PHP_RINIT_FUNCTION(bcompiler) { + + BCOMPILERG(buffer) = (char*) emalloc(1); return SUCCESS; } /* }}} */ @@ -458,7 +460,7 @@ BCOMPILERG(buffer) = (char*) erealloc(BCOMPILERG(buffer), n + 1); \ php_stream_read((php_stream *) BCOMPILERG(stream) , BCOMPILERG(buffer) , n); \ memcpy((char*)bytes, BCOMPILERG(buffer), n); \ - BCOMPILER(buffer)[n] = '\0'; \ + BCOMPILERG(buffer)[n] = '\0'; \ BCOMPILER_DEBUG(("Got: %s\n",(char*)BCOMPILERG(buffer))); \ } @@ -1719,7 +1721,7 @@ char *tmp; int retval; int len = 0; - + DESERIALIZE_SCALAR(&len, int); if (len <= 0) { *-----------------* And please add to the end of bcompiler_compile.php something like that: ... if (isset($_SERVER['argv'][1])) { $test = new PHP_bcompiler_compile($_SERVER['argv'][1]); } else { echo "Run ".$SCRIPT_NAME." some_class.php to compile some_class.php.phb\n"; } ... cause, it's very annoying, when it tries to compile (and compiles!) nonspecified file to './.phpb' without any messages.