my bug or libev's? when multi-thread and multi-loop

CodeAll codeallcn at
Tue Dec 2 09:59:11 CET 2008

More info:
1. a little like,
but i tried poll backend, has problem too
2. when i generate a lot of request from 10 client, the server choose to not
keepalive(one request per connection), but the system is reusing fd. Like,
fd = 14 are closed, after a well, fd = 14 are used again. I see this in
io_cb()'s debug info and strace's epoll_wait(xxx)

On Tue, Dec 2, 2008 at 4:46 PM, CodeAll <codeallcn at> wrote:

> Hi, Everyone:
> I use libev in my network server.
> I have one main thread with default event loop for bind/listen/accept, then
> dispatch the cilent fd to 4 worker thread, using ev_async and a blocking
> queue. Each of the worker has a ev_base_new(0). Worker monitor the client
> fd's EV_READ and EV_WRITE, parsing data into data structure, write response
> back, in ansyc-callback way.
> Everything goes will when startup. After several client connections, the
> CPU are higher and higher. Something must be wrong.
> 1. I kill -SIGSEGV the process, gdb it, found it's busy on epoll_wait()
> 2. I use strace/lstrace -f -p the process, it's also busy on epoll_wait()
> 3. After a lot of client connections, libev abort with: libev: cannot
> allocate 2147479536 bytes, aborting.
> 4. the epoll_wait() somethings are empty, somethings has 1 or 2 or more
> active fd's POLL_IN or POLL_OUT not handled, but i haven't receive any
> callback call
> 5. The one-thread version is ok.
> 6. I guess, that maybe something wrong when i using libev in mutil-thread
> env, or some fd are wrongly closed, or some fd are missing but events
> continue coming.
> Sorry for my english.
> Could anyone help?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the libev mailing list