From owner-freebsd-hackers@FreeBSD.ORG Fri Mar 14 12:30:13 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 778311065673 for ; Fri, 14 Mar 2008 12:30:13 +0000 (UTC) (envelope-from dudu@dudu.ro) Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.158]) by mx1.freebsd.org (Postfix) with ESMTP id 042E18FC16 for ; Fri, 14 Mar 2008 12:30:12 +0000 (UTC) (envelope-from dudu@dudu.ro) Received: by fg-out-1718.google.com with SMTP id 16so3389709fgg.35 for ; Fri, 14 Mar 2008 05:30:10 -0700 (PDT) Received: by 10.82.115.8 with SMTP id n8mr26075779buc.10.1205497810346; Fri, 14 Mar 2008 05:30:10 -0700 (PDT) Received: by 10.82.185.8 with HTTP; Fri, 14 Mar 2008 05:30:10 -0700 (PDT) Message-ID: Date: Fri, 14 Mar 2008 14:30:10 +0200 From: "Vlad GALU" To: freebsd-hackers@freebsd.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20080307223723.X42870@fledge.watson.org> Subject: Re: A (perhaps silly) kqueue question X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Mar 2008 12:30:13 -0000 On 3/8/08, Vlad GALU wrote: > On 3/8/08, Robert Watson wrote: > > On Fri, 7 Mar 2008, Vlad GALU wrote: > > > > > > > I see an unusual symptom with one of our in-house applications. The main I/O > > > loop calls kevent(), which in turn returns two events with EV_EOF error set, > > > always for the same descriptors (they're both socket descriptors). As the > > > man page is not pretty clear about it and I don't have my UNP copy at hand, > > > I would like to ask the list whether the error events are supposed to be > > > one-shot or not. > > > > > > I wonder if it's returning one event for the read socket buffer, and one event > > for the write socket buffer, since there are really two event sources for each > > socket? Not that this is desirable behavior, but it might explain it. If you > > shutdown() only read, do you get back one EOF kevent and one writable kevent? > > > I'll try that and see. The only issue being the low frequency this > symptom appears at. I'll get back to the list once I have more info. Haven't gotten to the point of testing shutdown() behavior, but here's a truss excerpt of the symptom: -- cut here -- kevent(3,0x0,0,{0x7,EVFILT_WRITE,EV_EOF,54,0x832c,0x800d08080 0x7,EVFILT_READ,EV_EOF,54,0x2a,0x800d08080},1024,0x0) = 2 (0x2) kevent(3,0x0,0,{0x7,EVFILT_WRITE,EV_EOF,54,0x832c,0x800d08080 0x7,EVFILT_READ,EV_EOF,54,0x2a,0x800d08080},1024,0x0) = 2 (0x2) kevent(3,0x0,0,{0x7,EVFILT_WRITE,EV_EOF,54,0x832c,0x800d08080 0x7,EVFILT_READ,EV_EOF,54,0x2a,0x800d08080},1024,0x0) = 2 (0x2) kevent(3,0x0,0,{0x7,EVFILT_WRITE,EV_EOF,54,0x832c,0x800d08080 0x7,EVFILT_READ,EV_EOF,54,0x2a,0x800d08080},1024,0x0) = 2 (0x2) kevent(3,0x0,0,{0x7,EVFILT_WRITE,EV_EOF,54,0x832c,0x800d08080 0x7,EVFILT_READ,EV_EOF,54,0x2a,0x800d08080},1024,0x0) = 2 (0x2) kevent(3,0x0,0,{0x7,EVFILT_WRITE,EV_EOF,54,0x832c,0x800d08080 0x7,EVFILT_READ,EV_EOF,54,0x2a,0x800d08080},1024,0x0) = 2 (0x2) kevent(3,0x0,0,{0x7,EVFILT_WRITE,EV_EOF,54,0x832c,0x800d08080 0x7,EVFILT_READ,EV_EOF,54,0x2a,0x800d08080},1024,0x0) = 2 (0x2) kevent(3,0x0,0,{0x7,EVFILT_WRITE,EV_EOF,54,0x832c,0x800d08080 0x7,EVFILT_READ,EV_EOF,54,0x2a,0x800d08080},1024,0x0) = 2 (0x2) kevent(3,0x0,0,{0x7,EVFILT_WRITE,EV_EOF,54,0x832c,0x800d08080 0x7,EVFILT_READ,EV_EOF,54,0x2a,0x800d08080},1024,0x0) = 2 (0x2) kevent(3,0x0,0,{0x7,EVFILT_WRITE,EV_EOF,54,0x832c,0x800d08080 0x7,EVFILT_READ,EV_EOF,54,0x2a,0x800d08080},1024,0x0) = 2 (0x2) kevent(3,0x0,0,{0x7,EVFILT_WRITE,EV_EOF,54,0x832c,0x800d08080 0x7,EVFILT_READ,EV_EOF,54,0x2a,0x800d08080},1024,0x0) = 2 (0x2) kevent(3,0x0,0,{0x7,EVFILT_WRITE,EV_EOF,54,0x832c,0x800d08080 0x7,EVFILT_READ,EV_EOF,54,0x2a,0x800d08080},1024,0x0) = 2 (0x2) kevent(3,0x0,0,{0x7,EVFILT_WRITE,EV_EOF,54,0x832c,0x800d08080 0x7,EVFILT_READ,EV_EOF,54,0x2a,0x800d08080},1024,0x0) = 2 (0x2) kevent(3,0x0,0,{0x7,EVFILT_WRITE,EV_EOF,54,0x832c,0x800d08080 0x7,EVFILT_READ,EV_EOF,54,0x2a,0x800d08080},1024,0x0) = 2 (0x2) -- and here -- So two EOF are returrned for descriptor 7, and errno would be ECONNRESET. The question is now, why isn't it oneshot? > > > > > > Robert N M Watson > > Computer Laboratory > > University of Cambridge > > > > > > -- > Mahnahmahnah! > -- Mahnahmahnah!