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

Dmitry Agaphonov rzhe at agava.com
Mon Dec 5 07:26:43 GMT 2005


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.


More information about the freebsd-hackers mailing list