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

CodeAll codeallcn at gmail.com
Tue Dec 2 09:46:32 CET 2008


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: <http://lists.schmorp.de/pipermail/libev/attachments/20081202/63a80c7c/attachment.html>


More information about the libev mailing list