Re: non-thread-safe yet pthreads-friendly build of PHP?

From: Date: Wed, 28 Mar 2001 08:45:03 +0000
Subject: Re: non-thread-safe yet pthreads-friendly build of PHP?
References: 1 2 3  Groups: php.dev 
Request: Send a blank email to php-dev+get-50115@lists.php.net to get a copy of this message
Hi, this whole "feature" have caused me several headhaches too.. There seem to be some consencus on this mailing list at least, that this error is related to GLIBC. Ulrich Drepper, GLIBC maintainer, doesn't see it that way. I sent a small program that illustrates this behaviour, and the response was "This is not bug. Live with it". And sure, I can live with it.. However, it would make life easier if we could make Apache modules that could be loaded by a stock RPM / debian Apache package, whatever.. wihtout having to rebuild all the time. Afterall, that's the whole point of loadable modules. If this is a feature and not a bug at least the package maintainers could build the Apacher core server with pthread linked it in. Allow me to attach the test scenario.. Note that it works fine on Solaris 2.6... The generated program main-wt works OK since it is linked with pthread -- the other, main-wot, without threads, dies with a SEGV. [snip] sub.c: int sub(void) { return 1; } [snip] main.c: #include <stdio.h> #include <stdlib.h> #include <dlfcn.h> int main(int argc, char **argv) { void *h; h = dlopen ("./sub.so", RTLD_NOW|RTLD_GLOBAL); if (!h) { printf ("dlopen failed\n"); exit (1); } gethostbyname("slashdot.org"); dlclose (h); exit (0); } [snip] Makefile all: sub.so main-wt main-wot sub.so: sub.c gcc -D_REENTRANT -shared sub.c -o sub.so -lpthread main-wt: main.c gcc main.c -o main-wt -ldl -lpthread main-wot: main.c gcc main.c -o main-wot -ldl clean: rm -f main-wt main-wot sub.so core [end] On Tue, Mar 27, 2001 at 06:03:49PM -0600, Jason Greene wrote: > I have ran into this issue many times, with the sudden system call switch between > a threaded and non-threaded mode. In one scenario I had a problem where a 3rd party module > (chilisoft) was linked against an so that was linked against libpthread. > > I had an issue where signals where not being utilized correctly > (SIGALRM would no longer work after one try) which would break keep-alive in apache. > > My first fix was a patch to the source to reset non-blocking on SIGALRM with every request. > Later I discovered just compiling the webserver with -lthread and -lpthread solved all > problems. > > I am currently developing an Intermail module, which uses threads as well, and have had no > problems. > (the same applies to the php/java module.) > > I definitely think this is something that is not as well known as it should be. > > -Jason > [snip] Cheers, Adam -- Adam Dickmeiss mailto:adam@indexdata.dk http://www.indexdata.dk Index Data T: +45 33410100 Mob.: 212 212 66

« previous php.dev (#50115) next »