Re: Kevent(2) doesn't notify about EVFILT_WRITE filter event

[ Available lists | Index of freebsd-hackers | Month of Dec 2005 | Week of 1 Dec 2005 | Raw email | View thread | Wrap long lines | Reply | Tag ]
From
John-Mark Gurney <gurney_j@resnet.uoregon.edu>
Date
1 Dec 2005 18:55:35
Subject
Re: Kevent(2) doesn't notify about EVFILT_WRITE filter event
Message-ID
20051201185514.GP885@funkthat.com

In reply to
References to
Referenced by

[ Hide this part ]
Dmitry Agaphonov wrote this message on Thu, Dec 01, 2005 at 15:06 +0300:
> 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?

are you checking the output from the kevent that sets the sysevent?
kevent if you do something "stupid" like set a _ONESHOT in kevent, and
provide space for events to be returned to userland, the _ONESHOT will
be immediately returned and cleared...

It could also be an error is trying to be set, but can't be if you
don't provide return space... so w/o seeing your code, I'd make sure
when setting you are able to receive some events, and check what events
you get back...

> 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.

If you could post the parts of your code around kevent calls, I could
better help you...

--
John-Mark Gurney Voice: +1 415 225 5579

"All that I will do, has been done, All that I have, has not."


Elapsed time: 0.451 seconds