Bug 33788 - Apache crash when using threaded modules
Summary: Apache crash when using threaded modules
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: apache
Version: 7.1
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Nalin Dahyabhai
QA Contact: David Lawrence
Depends On:
TreeView+ depends on / blocked
Reported: 2001-03-29 09:39 UTC by Adam Dickmeiss
Modified: 2007-04-18 16:32 UTC (History)
0 users

Clone Of:
Last Closed: 2001-04-08 20:33:58 UTC

Attachments (Terms of Use)

Description Adam Dickmeiss 2001-03-29 09:39:22 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)

The Apache server produces segmentation violation when using
module that uses POSIX threads. 

Reproducible: Sometimes
Steps to Reproduce:
1.Compile an Apache module that links with POSIX Threads
  There is a very small module that illustrates this at
2.Install it
3.Start Apache

Actual Results:  This is what happens when loading module mod_thr.so that
is linked with pthreads:

[root@gamma mod_thr]# /etc/rc.d/init.d/httpd start
Starting httpd:                                            [FAILED]
[root@gamma mod_thr]# gdb /usr/sbin/httpd 
GNU gdb 5.0
Copyright 2000 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you 
welcome to change it and/or distribute copies of it under certain 
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"...
(no debugging symbols found)...
(gdb) run -X -f /etc/httpd/conf/httpd.conf
Starting program: /usr/sbin/httpd -X -f /etc/httpd/conf/httpd.conf
[New Thread 1024 (LWP 5937)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1024 (LWP 5937)]
__res_state () at errno.c:38
38	errno.c: No such file or directory.
	in errno.c
(gdb) bt
#0  __res_state () at errno.c:38
#1  0x401dbd1f in gethostbyname (name=0xbffff518 "gamma.indexdata.dk")
    at ../nss/getXXbyYY.c:108
#2  0x08066ad3 in ap_get_local_host () at eval.c:41
#3  0x08063e7d in ap_fini_vhost_config () at eval.c:41
#4  0x08055372 in ap_read_config () at eval.c:41
#5  0x0805d9bb in main () at eval.c:41
#6  0x40108f11 in __libc_start_main (main=0x805d740 <main>, argc=4, 
    ubp_av=0xbffffaac, init=0x804f1c8 <_init>, fini=0x807e3bc <_fini>, 
    rtld_fini=0x4000e214 <_dl_fini>, stack_end=0xbffffaa4)
    at ../sysdeps/generic/libc-start.c:129

Expected Results:  It works fine when mod_thr.so is not linked with 
[root@gamma mod_thr]# /etc/rc.d/init.d/httpd start
Starting httpd:                                            [  OK  ]
[root@gamma mod_thr]# 

A known "repair" is to add -lpthreads for LIBS in Makefile when
building Apache. Some people think this is a bug in 
GNU LIBC (GLIBC maintainer don't think it's a bug in GLIBC).

This bug has been around for a long time. Some people wrote that
it should be fixed in LIBC 2.2, but it's not fixed LIBC 2.2.1 that
comes with Fisher.

The problem affects all modules that relies on POSIX threads
such as Oracle, some PHP extensions, etc.. Redhat Fisher Tcl
(tcl-8.3.2-50) is also linked with POSIX threads, so Apache
extensions using Tcl no longer work...

Comment 1 Adam Dickmeiss 2001-04-08 20:33:54 UTC
Upgrading to GNU LIBC 2.2.2 seems to fix the problem.

Comment 2 Nalin Dahyabhai 2001-07-24 19:07:11 UTC
I'm told that if any of the modules demand-loaded by Apache need threading
support, then the main binary also needs to be linked with libpthread.  Setting
LIBS to "-lpthread" in 1.3.20-5 and later should fix this.

Note You need to log in before you can comment on or make changes to this bug.