From owner-freebsd-hackers@FreeBSD.ORG Mon Dec 5 07:26:43 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D183C16A41F for ; Mon, 5 Dec 2005 07:26:43 +0000 (GMT) (envelope-from rzhe@agava.com) Received: from agava.mipt.ru (ofc2.agava.net [81.5.88.62]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5476343D5F for ; Mon, 5 Dec 2005 07:26:42 +0000 (GMT) (envelope-from rzhe@agava.com) Received: by agava.mipt.ru (Postfix, from userid 426) id 976B3721F68; Mon, 5 Dec 2005 10:07:11 +0300 (MSK) Received: from mailhub (localhost [127.0.0.1]) by localhost (Postfix) with ESMTP id 4DF609D9AE0; Mon, 5 Dec 2005 09:42:04 +0300 (MSK) Received: from rzhe.agava-dubna.local (unknown [213.33.195.194]) (using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits)) (No client certificate requested) by agava.mipt.ru (Postfix) with ESMTP id 8FFC2720B0F; Mon, 5 Dec 2005 09:21:36 +0300 (MSK) Date: Mon, 5 Dec 2005 09:27:50 +0300 From: Dmitry Agaphonov To: John-Mark Gurney Message-ID: <20051205092750.1c6d4f5d@rzhe.agava-dubna.local> In-Reply-To: <20051201185514.GP885@funkthat.com> References: <20051201150608.5e8d49f1@rzhe.agava-dubna.local> <20051201185514.GP885@funkthat.com> Organization: AGAVA Software X-Mailer: Sylpheed-Claws 1.0.1 (GTK+ 1.2.10; i386-portbld-freebsd4.11) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: Kevent(2) doesn't notify about EVFILT_WRITE filter event 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: Mon, 05 Dec 2005 07:26:43 -0000 John-Mark Gurney wrote on 01.12.2005 10:55 MSK: JMG> Dmitry Agaphonov wrote this message on Thu, Dec 01, 2005 at 15:06 +0300: JMG> > I have two applications (server A and server B, A asks B for data to JMG> > serve clients) communicating via UNIX-domain socket. Testing local JMG> > clients interact to server A via UNIX-domain sockets too. Server A JMG> > uses kqueue(2) to handle clients and server B. JMG> > JMG> > When about 20 clients start requesting server A without delay, kevent(2) JMG> > doesn't notify about requested EVFILT_WRITE after only few small JMG> > requests. JMG> > JMG> > JMG> > Dumping kevent(2) changelist and eventlist gives the following: JMG> > JMG> > Server A asks for write event (with EV_ONESHOT flag set) to server B: JMG> > [13:45:36][DBG] Changing SysEvent: ident: 8, filter: -2, flags: 0x11, fflags: 0, data: 0, udata: 0x0 JMG> > [13:45:36][DBG] Received SysEvent: ident: 8, filter: -2, flags: 0x11, fflags: 0, data: 8192, udata: 0x0 JMG> > JMG> > So, the socket send buffer has 8192 bytes free. Then A sends 426 JMG> > bytes to B. JMG> > JMG> > Then server A asks for write event again: JMG> > [13:45:36][DBG] Changing SysEvent: ident: 8, filter: -2, flags: 0x11, fflags: 0, data: 0, udata: 0x0 JMG> > JMG> > After this, EVFILT_WRITE event is not returned. Noone else writes to JMG> > this socket. How it is possible? JMG> JMG> are you checking the output from the kevent that sets the sysevent? JMG> kevent if you do something "stupid" like set a _ONESHOT in kevent, and JMG> provide space for events to be returned to userland, the _ONESHOT will JMG> be immediately returned and cleared... JMG> JMG> It could also be an error is trying to be set, but can't be if you JMG> don't provide return space... so w/o seeing your code, I'd make sure JMG> when setting you are able to receive some events, and check what events JMG> you get back... Not in this, but that was my fault. Thank you for answer.