Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 04 Feb 2000 09:08:36 +0000
From:      Brian Somers <brian@Awfulhak.org>
To:        Gene Kan <genehkan@scam.xcf.berkeley.edu>
Cc:        freebsd-net@FreeBSD.ORG, brian@hak.lan.Awfulhak.org
Subject:   Re: Non-blocking sockets and network outages 
Message-ID:  <200002040908.JAA00756@hak.lan.Awfulhak.org>
In-Reply-To: Message from Gene Kan <genehkan@scam.xcf.berkeley.edu>  of "Thu, 03 Feb 2000 22:17:31 PST." <20000204061731.85976.qmail@scam.xcf.berkeley.edu> 

next in thread | previous in thread | raw e-mail | index | archive | help
> I've got an interesting problem involving non-blocking sockets and network
> outages.  In all cases, SO_KEEPALIVE is on, and
> net.inet.tcp.always_keepalive: 1.  The problem manifests itself when
> there is a net partition, the other endpoint loses power, or something of
> that sort.  Basically, when a connection dies without first notifying with
> RST or FIN.
> 
> If I mark a socket for reading, the fd will just never become active, and
> I have an ESTABLISHED connection (verified with netstat) forever.
> 
> If I do a non-blocking write, the write will return -1 with errno==EAGAIN.
> Obviously, since it just looks like the other side isn't slurping up the
> data because I'm not getting a window update.
> 
> Finally...I can't figure out why the keepalives aren't taking care of all
> this for me, and discovering the connections are dead.  I waited for hours,
> which surely should have been more than all timeouts...

Keepalives are by default very infrequent:

$ sysctl -a | fgrep keepi
net.inet.tcp.keepidle: 7200000
net.inet.tcp.keepintvl: 75000
net.inet.tcp.keepinit: 75000
hak:/sys/netinet $ fgrep KEEPCNT /sys/netinet/*.h
/sys/netinet/tcp_timer.h:#define        TCPTV_KEEPCNT   8                      /* max probes before drop */

This means that the first keepalive won't be sent for 2 hours, at 
which point up to 8 will be sent with 75 seconds in between each.  If 
there are no responses after that, the connection is dropped.

> Thanks for any help.
> 
> Gene

-- 
Brian <brian@Awfulhak.org>                        <brian@FreeBSD.org>
      <http://www.Awfulhak.org>;                   <brian@OpenBSD.org>
Don't _EVER_ lose your sense of humour !          <brian@FreeBSD.org.uk>




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200002040908.JAA00756>