httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Slemko <>
Subject Socket and Protocol error in error_log file (fwd)
Date Sat, 18 Jan 1997 22:34:22 GMT

(it would need to be wrapped in a whack of ifdefs, since not all platforms
have EPROTO, etc.)

---------- Forwarded message ----------
Date: Fri, 17 Jan 1997 10:47:30 -0700
From: Marc Slemko <>
Subject: VERY URGENT!!!!! Socket and Protocol error in error_log file

>From: Mukesh Kacker <>
>Newsgroups: comp.infosystems.www.servers.unix
>Subject: Re: VERY URGENT!!!!! Socket and Protocol error in error_log file
>Date: 17 Jan 1997 06:26:45 -0800
>Organization: Sun Microsystems Inc., Mountain View, CA
>Lines: 61
>Sender: mukesh@lucknow
>Message-ID: <p53iv4ws7h6.fsf@lucknow.i-have-a-misconfigured-system-so-shoot-me>
>References: <01bc0251$d9896d00$>
>	<>
>	<01bc045b$313c4620$>
>X-Newsreader: Gnus v5.3/Emacs 19.32

"cythere" <> writes:

The "protocol error" (errno EPROTO in Unix) failure for accept() occurs
when an incoming connection gets aborted before the accept() completes.

The exact technical debate on this issue is convoluted (no long flames
or technical discussions please :-)) but here is a brief summary.
When an incoming connection is aborted, BSD derived platforms the accept()
does not return an error. For web servers with high connection rates this
works fine but in some fringe cases, it may cause a select() to indicate
an incoming connection but a process/thread hanging in accept() forever which
is unacceptable. So some platforms return this EPROTO error in this
situation. This is admittedly a confusing error code and in future platform
vendors will be returning an ECONNABORTED error for this case (and not

This problems happens on some Solaris 2.x (and I have heard it happens on
Unixware based platforms) etc. In Solaris 2.5.1 with Internet Server Supplement
- ISS 1.0 patch applied, the error would be ECONNABORTED (and not EPROTO).

For Web servers, the right thing to do is to ignore this error (as they
do EINTR) and not log it and retry the accept() call.
I have tried through friends/contacts in Apache development
to get this fixed in the past, but apparently not hard enough :-)

I am not sure what the latest Apache code looks like, but the Apache 1.1.1
does something like this in http_main.c
		csd = accept()
	while (csd == -1 && errno == EINTR);
	if ( csd != -1) break;


One portable way to write this code to work on all platforms (present
and future would be:

		csd = accept()
	while (csd == -1 &&
		(errno == EINTR ||  /* interrupted call - retry */
		 errno == ECONNABORTED || /* aborted connection - retry */
		 errno == EPROTO) /* aborted connection - retry */

For efficiency reasons, some should study the frequency of the three
error codes above and check them in that order to minimize compares.

If you have friends and influence in the Apache development team, please
pass this on so that it gets fixed :-)

Mukesh Kacker                   | Football incorporates the two worst
Sun Microsystems Inc (SunSoft)  | characteristics of American society.       | Violence punctuated by committee meetings.
Internet Engineering            |                      -- George Will

View raw message