Bug 76328

Summary: apache2 will fail to graceful restart when php4's module recode is loaded
Product: Ports & Packages Reporter: dhchen <dhchen>
Component: Individual Port(s)Assignee: Alex Dupre <ale>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description dhchen 2005-01-17 02:50:17 UTC
If mod_php4 loads recode.so(GNU recode library) as its extension, apache2 cannot graceful restart, neither using apachectl
or kill -HUP. If this extension is removed, things go perfectly.

Below is the backtrace: (I dont know why recode.so will try to access mysql library, maybe that's the problem)
(gdb) where
#0  0x283e019f in kill () from /lib/libc.so.6
#1  0x283d3ca6 in raise () from /lib/libc.so.6
#2  0x284540d2 in abort () from /lib/libc.so.6
#3  0x283ef55c in _UTF8_wcsnrtombs () from /lib/libc.so.6
#4  0x283ef5a8 in _UTF8_wcsnrtombs () from /lib/libc.so.6
#5  0x283f026b in _UTF8_wcsnrtombs () from /lib/libc.so.6
#6  0x283f0842 in _UTF8_wcsnrtombs () from /lib/libc.so.6
#7  0x283f09bf in free () from /lib/libc.so.6
#8  0x288bc851 in my_no_flags_free () from /usr/local/lib/mysql/libmysqlclient.so.14
#9  0x288c27a9 in delete_dynamic () from /usr/local/lib/mysql/libmysqlclient.so.14
#10 0x288c40cc in hash_free () from /usr/local/lib/mysql/libmysqlclient.so.14
#11 0x28b55711 in recode_delete_outer () from /usr/local/lib/librecode.so.3
#12 0x28a26ed7 in zm_shutdown_recode (type=1, module_number=14)
    at /usr/ports/converters/php4-recode/work/php-4.3.10/ext/recode/recode.c:113
#13 0x285b01bd in ?? () from /usr/local/libexec/apache2/libphp4.so
#14 0x285b24ff in ?? () from /usr/local/libexec/apache2/libphp4.so
#15 0x285b267c in ?? () from /usr/local/libexec/apache2/libphp4.so
#16 0x285ac514 in ?? () from /usr/local/libexec/apache2/libphp4.so
#17 0x2857b78a in ?? () from /usr/local/libexec/apache2/libphp4.so
#18 0x2857b747 in ?? () from /usr/local/libexec/apache2/libphp4.so
#19 0x285ca1c1 in ?? () from /usr/local/libexec/apache2/libphp4.so
#20 0x28356edd in run_cleanups (cref=0x80a1028) at apr_pools.c:1951
#21 0x283560fc in apr_pool_clear (pool=0x80a1018) at apr_pools.c:693
#22 0x0806b81d in main (argc=3, argv=0xbfbfecd8) at main.c:594

Both apache, php4 and recode is the newest version from cvs.

How-To-Repeat: Install apache2, mod_php4 and php4-extensions, choose RECODE extension
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2005-01-17 06:15:50 UTC
Responsible Changed
From-To: freebsd-ports-bugs->clement

Over to maintainer of www/apache2, although it's not completely clear 
if that is where the problem lies.
Comment 2 Clement Laforet freebsd_committer freebsd_triage 2005-01-17 11:18:47 UTC
Responsible Changed
From-To: clement->ale


This is a pure php problem actually. 
Apache segfaults because hash_insert() call is mysql one, not recode one. 
Problem desappears when you remove mysql extension. 

Both libraries export hash_insert as global symbol. 

root@crashbox# nm /usr/local/lib/librecode.so | grep hash_ins 
00035550 T hash_insert 
root@crashbox# nm /usr/local/lib/mysql/libmysqlclient.so.12 | grep hash_ins 
00012484 T hash_insert 

Runtime linker use the first occurence of hash_insert (per default it's 
mysql one). 

Over to ale, I don't really know how to fix it...
Comment 3 Alex Dupre freebsd_committer freebsd_triage 2005-01-17 11:38:59 UTC
State Changed
From-To: open->closed

Read the warnings at http://www.php.net/recode