Hi Nick
Well my problems are gone, but only because I changed the design.
Initially I was using a very inefficient method, whereby I would create a non persistent event every time I wanted to write some data to a socket (event_new followed by event_add). In the callback, if all the data was sent I would release the event (event_free), however if part of the data was sent then I would reschedule the event again after adjusting the offset in the buffer and the number of bytes remaining (event_add).
In my latest design I just create the event once and add it every time I want to write data to a socket. If the event is already added then I queue the data and don't readd the event. When the data is sent I dequeue the next data and reschedule the event after changing the callback arguments to point the new data to be sent. On disconnection, I release the event.
The first logic was causing deadlocks (Within maximum 2 hours), the second hasn't caused any so far (1+ day running)
I can't explain why the first logic was deadocking but it was inefficient anyways, so not worth investigating
Thanks
Regards
Sherif
On Mon, Apr 11, 2011 at 7:19 PM, Nick Mathewson
<nickm@xxxxxxxxxxxxx> wrote:
On Sun, Apr 10, 2011 at 2:55 PM, Sherif Fanous <
sherif.fanous@xxxxxxxxx> wrote:
> I'm willing to post code snippets if it helps.
> What I'm seeing is that after some time adding just 1 event causes an
> infinite loop in evmap_io_active, and I can't figure out if I'm doing
> anything wrong, and why the code would work for some time then go crazy.
> Thanks
> Sherif
Hm. If there's an infinite loop there, it *probably* means that the
event list for that fd has become corrupt. One reason that can happen
is if you add an event, then re-assign it and re-add it without first
deleting it. To debug that, try enabling debug mode by calling
event_enable_debug_mode();
near the start of your program (before you construct any event_bases).
It should detect any attempts to modify an event that's currently pending.
HTH,
--
Nick
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users in the body.