Following my first question, I think I found a deadlock bug.
During the program shutdown, I call from a thread different from base event thread.
bufferevent_setcb(bev, NULL, NULL, NULL, NULL);
bufferevent_disable(bev, EV_READ|EV_WRITE);
Sometimes the call to bufferevent_disable deadlocks at the following line at event.c:2220:
if (base->current_event == ev && !EVBASE_IN_THREAD(base)) {
++base->current_event_waiters;
EVTHREAD_COND_WAIT(base->current_event_cond, base->th_base_lock);
}
The other thread that is holding the lock is in bufferevent_readcb() function at bufferevent_sock.c:133
_bufferevent_incref_and_lock(bufev);
it's deadlocked because the first thread is already holding the lock of bev at line bufferevent.c:502 (in function bufferevent_disable).
Cheers,