pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/45227: apache13 and ap13-php5 unexpectedly link against pthread

>Number:         45227
>Category:       pkg
>Synopsis:       apache13 and ap13-php5 unexpectedly link against pthread
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Aug 09 11:10:00 +0000 2011
>Originator:     Matthew Mondor
>Release:        NetBSD 5.1_STABLE
System: NetBSD behemoth.xisop 5.1_STABLE NetBSD 5.1_STABLE (GENERIC_MM) #0: Mon 
Aug 1 12:19:58 EDT 2011 
root@behemoth.xisop:/usr/obj/sys/arch/i386/compile/GENERIC_MM i386
Architecture: i386
Machine: i386

This is using pkgsrc-2011Q2 on NetBSD-5.

Although Apache 1.3.x uses a robust system of pre-forked processes, it
somehow links unnecessarily against libpthread.  I unfortunately was
not able to find out the source of the "-pthread" directives which were
added in the scripts.

Only the following files have it (from the build log):

cc -c -I/usr/pkg/include -I./os/unix -I./include  -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64 -DNETBSD  -DEAPI -DEAPI_MM -O2 -march=i686 -O2 -pipe 
-march=i686 -O2 -pipe -I/usr/pkg/include -I/usr/include -I/usr/X11R7/include 
`./apaci`  -pthread  modules.c
cc -c -I/usr/pkg/include -I./os/unix -I./include  -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64 -DNETBSD  -DEAPI -DEAPI_MM -O2 -march=i686 -O2 -pipe 
-march=i686 -O2 -pipe -I/usr/pkg/include -I/usr/include -I/usr/X11R7/include 
`./apaci`  -pthread  buildmark.c
-march=i686 -O2 -pipe -march=i686 -O2 -pipe -I/usr/pkg/include -I/usr/include 
-I/usr/X11R7/include `./apaci`  -pthread  -L/usr/pkg/lib -L/usr/pkg/lib 
-L/usr/lib -Wl,-R/usr/lib -Wl,-R/usr/pkg/lib -L/usr/X11R7/lib 
-Wl,-R/usr/X11R7/lib   -pthread -Wl,-E  -o httpd buildmark.o modules.o  
modules/standard/libstandard.a  main/libmain.a  ./os/unix/libos.a  ap/libap.a   
 -lcrypt  -lmm -lexpat 

It seems that it's part of the modules system that it adds -pthread
for.  However, interestingly none of the third party apache modules I
use need threads; and among those, the only other one to link against
pthread is ap-php.

Even in the case of ap13-php5, nm shows that none of the pthread
functions are called.  Although the configure script will show the
--with-tsrm* family of features, with the --with-trsm-pthread marked as
default, the resulting php binaries have no reference to a pthread or
tsrm library symbol whatsoever (as shown using nm).

A reason why I think this is important is that stability may be
affected.  Threads and fork are generally not easily intermixable, and
code like memory allocators may behave differently in thread and
non-thread situations.

In this case, we're somehow hit by a race condition related to the zen
allocator, which I could disable for now, restoring the system to a
usable state, but honestly I'm not sure the threaded build is at fault
in this case.  Having read similar reports of others with the same
issue, it's however possible.

I'm not used enough to apache or php build systems to immediately see
why -lpthread is added, after a few lost hours trying to fix it I
decided to send a PR despite not having a diff to propose yet.

I understand that Apache 2 users might want to use threads in both
Apache and PHP, but we consider that setup unsuitable for our server.

Thanks to anyone who knows better how to fix this.


Build www/apache and www/ap-php


Unknown magic place to patch

Home | Main Index | Thread Index | Old Index