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

2001-03-28 Thread Adam Dickmeiss

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 
#include 
#include 

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:[EMAIL PROTECTED]  http://www.indexdata.dk
Index Data  T: +45 33410100   Mob.: 212 212 66

-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




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

2001-03-27 Thread Jason Greene

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

- Original Message - 
From: "Zeev Suraski" <[EMAIL PROTECTED]>
To: "Rasmus Lerdorf" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, March 27, 2001 4:32 PM
Subject: Re: [PHP-DEV] non-thread-safe yet pthreads-friendly build of PHP?


> Ok, thanks!
> 
> Zeev
> 
> At 00:29 28/3/2001, Rasmus Lerdorf wrote:
> > > Is there any way to build PHP with pthreads, with ZTS disabled?  The reason
> > > I'm asking is that there are some thread-safe 3rd party libraries which are
> > > linked against pthreads, and apparently, if PHP isn't built with pthreads -
> > > it crashes.  Any experience with it?
> >
> >If you link Apache with pthreads that should suffice.  Just add -lpthreads
> >to the Apache LIBS line.
> >
> >-Rasmus
> 
> --
> Zeev Suraski <[EMAIL PROTECTED]>
> CTO &  co-founder, Zend Technologies Ltd. http://www.zend.com/
> 
> 
> -- 
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




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

2001-03-27 Thread Zeev Suraski

Ok, thanks!

Zeev

At 00:29 28/3/2001, Rasmus Lerdorf wrote:
> > Is there any way to build PHP with pthreads, with ZTS disabled?  The reason
> > I'm asking is that there are some thread-safe 3rd party libraries which are
> > linked against pthreads, and apparently, if PHP isn't built with pthreads -
> > it crashes.  Any experience with it?
>
>If you link Apache with pthreads that should suffice.  Just add -lpthreads
>to the Apache LIBS line.
>
>-Rasmus

--
Zeev Suraski <[EMAIL PROTECTED]>
CTO &  co-founder, Zend Technologies Ltd. http://www.zend.com/


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




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

2001-03-27 Thread Rasmus Lerdorf

> Is there any way to build PHP with pthreads, with ZTS disabled?  The reason
> I'm asking is that there are some thread-safe 3rd party libraries which are
> linked against pthreads, and apparently, if PHP isn't built with pthreads -
> it crashes.  Any experience with it?

If you link Apache with pthreads that should suffice.  Just add -lpthreads
to the Apache LIBS line.

-Rasmus


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




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

2001-03-27 Thread Thies C. Arntzen

On Tue, Mar 27, 2001 at 09:09:03PM +0200, Zeev Suraski wrote:
> Is there any way to build PHP with pthreads, with ZTS disabled?  The reason 
> I'm asking is that there are some thread-safe 3rd party libraries which are 
> linked against pthreads, and apparently, if PHP isn't built with pthreads - 
> it crashes.  Any experience with it?

i build php agains pthread all the time (cause of oracle) and
it does work for me. you should also link apache agains
-lpthreads as there's aknow glibc issue which could cause
your crash.

tc

-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] non-thread-safe yet pthreads-friendly build of PHP?

2001-03-27 Thread Zeev Suraski

Is there any way to build PHP with pthreads, with ZTS disabled?  The reason 
I'm asking is that there are some thread-safe 3rd party libraries which are 
linked against pthreads, and apparently, if PHP isn't built with pthreads - 
it crashes.  Any experience with it?

Zeev


--
Zeev Suraski <[EMAIL PROTECTED]>
CTO &  co-founder, Zend Technologies Ltd. http://www.zend.com/


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]