httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Richards <p...@originat.demon.co.uk>
Subject Re: [Fwd: Re: socket error on APACHE v1.0]
Date Sat, 10 Feb 1996 13:33:48 GMT
In reply to Aram Mirzadeh who said
> 
> > > > > This could very likely be caused by the sending of SIGHUP once per
day.
> > > > 
> > > > No, it doesn't.  Apache just has this problem.  And we're not addressing
it
> > > > why I don't know. 
> > > 
> > > We can't address what we can't see. Some of us simply don't get these
> > > problems. They seem to be platform dependent, with linux being the
> > > biggest sufferer. An earlier user explanation I forwarded seemed to
> > > blame slow OS responses to a lost connection that had just been
> > > negotiated and was awaiting a process to accept it.
> > 
> > Is anyone seeing this on anything besides Linux? Just one other report
> > would be enough to make it an Apache problem but so far all I've seen are
> > Linux reports and that does tend to suggest it's a Linux related thing, even
> > if Apache is somehow a cuplrit in triggering the problem.
> 
> I have heard people runing BSD, are also getting these, but not to the 
> total amount linux is.  Linux is the most hard hit one.

The reasons accept can fail are pretty limited.

     The accept() will fail if:

     [EBADF]      The descriptor is invalid.

     [ENOTSOCK]   The descriptor references a file, not a socket.

     [EOPNOTSUPP]

                  The referenced socket is not of type SOCK_STREAM.

     [EFAULT]     The addr parameter is not in a writable part of the user ad-
                  dress space.

     [EWOULDBLOCK]
                  The socket is marked non-blocking and no connections are
                  present to be accepted.

It'd be a bit more useful to see the actual error

        while ((csd=accept(sd, &sa_client, &clen)) == -1)
           if (errno != EINTR)
                log_error("socket error: accept failed", server_conf);

change that to actually print out errno and the associated message.
Use perror(). In fact, this should always be done, printing generic
error messages like above makes it a little diffilcult to track down
the actual cause of the error.

Does Linux's list of error codes match above or are there different
cases where accept() can fail?

What was the reasoning behind the locking around accept()? I remember
there being a lot of discussion but it was before I was really paying
attention to development issues. Strikes me as *really* bogus that
you have to use locking on system calls. Oh well, paves the way
to threads I suppose :-)

-- 
  Paul Richards, Netcraft Ltd.
  Internet: paul@netcraft.co.uk, http://www.netcraft.co.uk
  Phone: 0370 462071 (Mobile), +44 1225 447500 (work)

Mime
View raw message