Patch: accept() handling on HP-UX

Mika Iisakkila mika.iisakkila at pingrid.fi
Mon Feb 27 09:55:53 EST 2006


This applies to 2.2.12, but I believe the same issue is present on later
versions too. On HP-UX 11.*, accept() can return ENOBUFS for no particular
reason, typically when the client went away before the program got around
to calling accept() for it. Current Cyrus IMAP code would then terminate
the child process; I don't know if this causes any other harm besides
extra process handling overhead and error logs, but nevertheless is
unnecessary, as the process could just accept() again. A similar fix
was introduced in Apache 1.3.23 and can be found in many other major
server software packages.

On HP-UX 10 and earlier, ENOBUFS probably still is a real error, but
I don't think too many people run (or would necessarily have to run)
those. Determining the platform and turning ENOBUFS handling on if
applicable should of course reside in the autoconf part, but no
way I'm going to touch that...

--mika
-------------- next part --------------
diff -Nacr cyrus-imapd-2.2.12-orig/master/service-thread.c cyrus-imapd-2.2.12/master/service-thread.c
*** cyrus-imapd-2.2.12-orig/master/service-thread.c	Wed Jun  2 20:26:38 2004
--- cyrus-imapd-2.2.12/master/service-thread.c	Thu Dec 29 16:57:51 2005
***************
*** 275,280 ****
--- 275,283 ----
  		case EAGAIN:
  		case EINTR:
  		case ECONNABORTED:
+ #if defined(__hpux) && defined(ENOBUFS)
+ 		case ENOBUFS:
+ #endif
  		    break;
  		default:
  		    syslog(LOG_ERR, "accept failed: %m");
diff -Nacr cyrus-imapd-2.2.12-orig/master/service.c cyrus-imapd-2.2.12/master/service.c
*** cyrus-imapd-2.2.12-orig/master/service.c	Fri Dec 17 18:32:25 2004
--- cyrus-imapd-2.2.12/master/service.c	Thu Dec 29 16:57:28 2005
***************
*** 440,445 ****
--- 440,448 ----
  		    case ENETUNREACH:
  		    case EAGAIN:
  		    case EINTR:
+ #if defined(__hpux) && defined(ENOBUFS)
+ 		    case ENOBUFS:
+ #endif
  			break;
  
  		    case EINVAL:


More information about the Info-cyrus mailing list