From owner-freebsd-net Fri Feb 4 14:43:42 2000 Delivered-To: freebsd-net@freebsd.org Received: from awfulhak.org (dynamic-32.max4-du-ws.dialnetwork.pavilion.co.uk [212.74.9.160]) by builder.freebsd.org (Postfix) with ESMTP id 1211D41BC for ; Fri, 4 Feb 2000 14:43:37 -0800 (PST) Received: from hak.lan.Awfulhak.org (root@hak.lan.Awfulhak.org [172.16.0.12]) by awfulhak.org (8.9.3/8.9.3) with ESMTP id WAA59700; Fri, 4 Feb 2000 22:43:50 GMT (envelope-from brian@lan.awfulhak.org) Received: from hak.lan.Awfulhak.org (brian@localhost.lan.Awfulhak.org [127.0.0.1]) by hak.lan.Awfulhak.org (8.9.3/8.9.3) with ESMTP id JAA00756; Fri, 4 Feb 2000 09:08:36 GMT (envelope-from brian@hak.lan.Awfulhak.org) Message-Id: <200002040908.JAA00756@hak.lan.Awfulhak.org> X-Mailer: exmh version 2.1.1 10/15/1999 To: Gene Kan Cc: freebsd-net@FreeBSD.ORG, brian@hak.lan.Awfulhak.org Subject: Re: Non-blocking sockets and network outages In-Reply-To: Message from Gene Kan of "Thu, 03 Feb 2000 22:17:31 PST." <20000204061731.85976.qmail@scam.xcf.berkeley.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 04 Feb 2000 09:08:36 +0000 From: Brian Somers Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org > 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 Don't _EVER_ lose your sense of humour ! To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message