From owner-freebsd-hackers@FreeBSD.ORG Thu Dec 1 12:06:16 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 8C74116A41F for ; Thu, 1 Dec 2005 12:06:16 +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 E7CDB43D45 for ; Thu, 1 Dec 2005 12:06:15 +0000 (GMT) (envelope-from rzhe@agava.com) Received: by agava.mipt.ru (Postfix, from userid 426) id CF76EC9A5F4; Thu, 1 Dec 2005 15:00:13 +0300 (MSK) Received: from mailhub (localhost [127.0.0.1]) by localhost (Postfix) with ESMTP id 726B0C9A5E4 for ; Thu, 1 Dec 2005 15:00:13 +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 08388C9A5EF for ; Thu, 1 Dec 2005 15:00:12 +0300 (MSK) Date: Thu, 1 Dec 2005 15:06:08 +0300 From: Dmitry Agaphonov To: freebsd-hackers@freebsd.org Message-ID: <20051201150608.5e8d49f1@rzhe.agava-dubna.local> 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 Subject: 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: Thu, 01 Dec 2005 12:06:16 -0000 Hello all, I have two applications (server A and server B, A asks B for data to serve clients) communicating via UNIX-domain socket. Testing local clients interact to server A via UNIX-domain sockets too. Server A uses kqueue(2) to handle clients and server B. When about 20 clients start requesting server A without delay, kevent(2) doesn't notify about requested EVFILT_WRITE after only few small requests. Dumping kevent(2) changelist and eventlist gives the following: Server A asks for write event (with EV_ONESHOT flag set) to server B: [13:45:36][DBG] Changing SysEvent: ident: 8, filter: -2, flags: 0x11, fflags: 0, data: 0, udata: 0x0 [13:45:36][DBG] Received SysEvent: ident: 8, filter: -2, flags: 0x11, fflags: 0, data: 8192, udata: 0x0 So, the socket send buffer has 8192 bytes free. Then A sends 426 bytes to B. Then server A asks for write event again: [13:45:36][DBG] Changing SysEvent: ident: 8, filter: -2, flags: 0x11, fflags: 0, data: 0, udata: 0x0 After this, EVFILT_WRITE event is not returned. Noone else writes to this socket. How it is possible? When I only turn on some additional logging which makes nothing but logs something and thus makes some small delays between kevent(2) calls -- all works fine, kevent(2) notifies about all write events. Could anyone please give thoughts about why kevent(2) can behave so? I have definitely no idea where the problem can be. This happens on FreeBSD 4.11-STABLE (cvsup'ed Nov 20 2005), SMP kernel, P4 with HT.