httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Slemko <>
Subject Re: errnos and buff.c
Date Wed, 16 Dec 1998 16:45:13 GMT
On a side note, but mildly related to this: I find Dean's moving of the
sending of the SIGALRM to make things more reliable, because then silly
modules or libraries can't break things by killing the timer.
Unfortunately, it leads to the situation where a silly library can set an
alarm() but, for whatever reason, not clear it.  Since Apache hasn't set
any, it won't clear it when the request is over either.  That means that
in the middle of some random request (or possibly when there isn't even a
handler installed) Apache will get that SIGALRM and abort the connection
or kill the child.  Sigh.  I hate unix.

On Wed, 16 Dec 1998, Jim Jagielski wrote:

> > If you want to also check r->connection->aborted, then you can, but it
> > may or may not get set so you can't depend on it.
> > 
> As I understand it, if it's set, then you should be able to trust that,
> right? You just can't assume if unset that all is well.


When writing a module, to ensure that you don't write endlessly to a
nonexistent client, the following MUST be checked[1]: 

	- the return code from Apache IO functions

The following MAY be checked by or happen to the module for extra warm

	- r->connection->aborted

	- if you are in a hard_timeout, you MAY be longjmped out of there
	  magically if an error writing to the client happens.

[1] if you are writing a module with a small amount of output where there
is no logic that could loop for a significant period of time or require a
significant amount of effort to do, then you can get by not bothering to
check the return values; all your writes will just fail and be wasted.

View raw message