Below is my initialization code from the main()
evthread_use_pthreads();
struct event_config *cfg = event_config_new();
event_config_require_features(cfg, EV_FEATURE_EARLY_CLOSE);
c->base = event_base_new_with_config(cfg);
event_config_free(cfg);
I then start dispatch loop from a thread
int rv = event_base_dispatch(c->base);
//rv = event_base_loop(c->base, EVLOOP_NO_EXIT_ON_EMPTY);
i then use bufferevent_socket_new as needed and this works for a long time. However, after a few thousand bufferevent_socket_new and closing them, event_base_dispatch suddenly stops working and exits with return value 1.
Any further calls to event_base_dispatch() returns 1 immediately and then nothing works.
Any idea what I might be doing wrong? Note that system works fine for a few thousand bufferevent socket calls.