[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[Libevent-users] Bufferevent client read callback sporadically not called



Hi,

I'm new to libevent and have the following problem with bufferevents.
I have a server talking to many clients. Very occasionally (when the
number of clients is around 1000 or larger), the server writes a
message to the client, which is read by the client (strace shows that
readv() is successfully called) but the read callback of the client is
not invoked. Subsequently, both server and client side of the
connection wait for input in epoll_wait() until timeout.

The problem exhibits itself with libevent 2.0.16, 2.0.19 and the 2.1.1
alpha. I'm using a default event base (level-triggered I/O) with
default watermarks. Surely, I must be making a simple mistake
somewhere, like introducing a race condition, but I can't find it.

I made a simple program which demonstrates the behaviour:

http://pastebin.com/FaCuCwU5

Compile with gcc -std=gnu99 -Wall -pedantic test.c -levent and run
with ./a.out [number of clients].
For me, with 500 clients, everything is fine, while with 1000 clients,
a few connections stall. Make sure you set your file descriptor limit
sufficiently high.

Any help is appreciated.

Best regards,
Alexander
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.