You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Marc Slemko <ma...@znep.com> on 1997/01/18 23:34:22 UTC

Socket and Protocol error in error_log file (fwd)

Comments?

(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 <ma...@znep.com>
To: marcs@znep.com
Subject: VERY URGENT!!!!! Socket and Protocol error in error_log file


>Path: pulp.ucs.ualberta.ca!rover.ucs.ualberta.ca!news.bc.net!arclight.uoregon.edu!news.bbnplanet.com!su-news-hub1.bbnplanet.com!venus.sun.com!news2me.EBay.Sun.COM!engnews2.Eng.Sun.COM!engnews1.Eng.Sun.COM!usenet
>From: Mukesh Kacker <mu...@eng.sun.com>
>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: <p5...@lucknow.i-have-a-misconfigured-system-so-shoot-me>
>References: <01...@isildur.cythere.com>
>	<32...@thebook.com>
>	<01...@isildur.cythere.com>
>NNTP-Posting-Host: lucknow.eng.sun.com
>X-Newsreader: Gnus v5.3/Emacs 19.32

"cythere" <ch...@cythere.com> 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
EPROTO).

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
---
	do
		csd = accept()
	while (csd == -1 && errno == EINTR);
	if ( csd != -1) break;
	log_unixerr();

-- 

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

---
	do
		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.
mukesh.kacker@eng.sun.com       | Violence punctuated by committee meetings.
Internet Engineering            |                      -- George Will