httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <traw...@attglobal.net>
Subject app (Apache) references errno, threads in app use __errno2()
Date Thu, 24 Jan 2002 15:50:43 GMT
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

Can something done by that module's "extra" threads confuse Apache
when it looks at errno?  Shouldn't Apache and that module's threads be
referencing different storage for errno?

The problem is that something bad is happening in this code:

  static void accept_mutex_on_sysvsem(void)
  {
    while (semop(sem_id, &op_on, 1) < 0) {
        if (errno != EINTR) {
            perror("accept_mutex_on");
            clean_child_exit(APEXIT_CHILDFATAL);
        }
    }
  }

Under circumstances I can't (yet) recreate, this code exits with this
message written to stderr:

  accept_mutex_on: Interrupted system call

I interpret this as meaning that one of the following things occurred:

1) there is a compiler bug causing us to exit when errno was EINTR
   instead of when errno wasn't EINTR

2) there is a bug in Solaris perror() which causes you to get the
   EINTR message for errnos other than EINTR

3) some other thread is overlaying the errno checked for by the code
   above and/or by perror()

Any ideas?
-- 
Jeff Trawick | trawick@attglobal.net | PGP public key at web site:
       http://www.geocities.com/SiliconValley/Park/9289/
             Born in Roswell... married an alien...

Mime
View raw message