Re: Circumstances under which accepts returns ECONNRESET ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 14, 2002 at 02:35:49PM +0200, Yann Dirson wrote:
> Hi,
> 
> There seems to be virtually no info about accept() returnning
> ECONNRESET.  At least BIND 9 had to take this error code into account
> (since 9.2.0b1 - see below), and we're encountering this error while
> running FilterProxy (see:
> http://sourceforge.net/mailarchive/message.php?msg_id=1564404).

  Years ago I learned that documentation for APIs does not cover all
  possible error conditions, only the most common ones.  Not even the
  Single Unix Specification covers everything.

  It is an invitation for a disaster to presume that if there ever appears
  any unexpected error conditions, it would be ok to panic, or any such
  foolish thing...

  My final eye-opener was doing a complicated server on some Solaris
  systems.  Errors on  accept()  were various weird STREAMS things,
  which were not listed at Solaris man-pages for accept()  ..  back
  in 1996 according to source code ChangeLogs.

> Comments in BIND source read:
> 
> 	 * Try to accept the new connection.  If the accept fails with
> 	 * EAGAIN or EINTR, simply poke the watcher to watch this socket
> 	 * again.  Also ignore ECONNRESET, which has been reported to
> 	 * be spuriously returned on Linux 2.2.19 although it is not
> 	 * a documented error for accept().
> 
> Is this error really to be expected ?  If yes, what's its meaning, so
> that it can be documented in the manpages ?

   I would say that the accept() error processing strategy implied by
   that comment is not very good.    Silently ignoring EAGAIN/EINTR,
   and logging appearance of any other would be workable.  Detecting
   EBADF would be most likely a license to panic, anything else is
   just overreaction.

   Without going thru the kernel source, the ECONNRESET for accept(2)
   might be due to faked connection attempts with source address
   matching some existing host, or too long packet life/delivery-time
   in network so that real connect() caller has aborted the attempt
   before the return SYN reaches the connection originator.
   An enbryonic socket dying before it is fully formed.

> Regards,
> -- 
> Yann Dirson <Yann.Dirson@fr.alcove.com>                 http://www.alcove.com/
> Technical support manager                Responsable de l'assistance technique
> Senior Free-Software Consultant          Consultant senior en Logiciels Libres
> Debian developer (dirson@debian.org)                        Développeur Debian

/Matti Aarnio
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux