On Thu, Jan 24, 2002 at 10:50:43AM -0500, Jeff Trawick wrote: > The following message is a courtesy copy of an article > that has been posted to comp.unix.solaris as well. > > I could use some Solaris-specific insight here. > > I suspect that the best situation is that all code is compiled with > _THREAD_SAFE so that everybody uses __errno2(), but I have a situation > where that isn't the case and I'm trying to figure out if it is a > problem. Here's the situation: > > + Apache 1.3 built with Sun compiler without _THREAD_SAFE > > + module for Apache built with gcc with _THREAD_SAFE; the module > creates other threads that run in the Apache processes
I've written an Apache 1.3 module that used threads on Solaris (the thread usage was implicit behind door calls), so I know it's fine as long as you play nicely. Two major gotchas here: - Apache 1.3 is built with Forte. Module is built with gcc. This almost never works. I'm shocked it even ran. mod_webapp runs into all sorts of problems when this mismatch occurrs. The compilers have different ideas about lots of things, so there could be a mismatch in how errno is handled. - Building httpd without _THREAD_SAFE with a module compiled for _THREAD_SAFE is the root of your problem. This goes to the discussion Aaron and I had a few days ago about always compiling with _REENTRANT/thread-safety flags in httpd-2.0. I know that Solaris goes wonky when this mismatch occurs - it's entirely unpredictable - which seems to be what's happening here. Sorry, but I think Apache 1.3 just needs to be recompiled with _THREAD_SAFE and with the same compiler as the module. Anything else is just asking for trouble like this. However, if this error occurs with a _THREAD_SAFE/same-compiler build, then it's something we should look into. I just wouldn't put any money on that happening. -- justin
