test/test-changelist.c


Log

Author Commit Date CI Message
Evan Jones c0bf63ce 2010-12-02T14:13:33 tests: Use relative includes ("") instead of system includes (<>)
Nick Mathewson 7bcace2d 2010-11-22T21:02:34 Fix some irix compilation warnings spotted by Kevin Bowling
Christopher Davis 34b84b97 2010-11-03T14:38:45 Fix more wn64 warnings.
Nick Mathewson ec347b92 2010-07-07T16:45:03 Move event-config.h to include/event2 This change means that all required include files are in event2, and all files not in event2/* are optional.
Nick Mathewson ea1ea3d6 2010-08-06T13:34:51 Make test-changelist count cpu usage right on win32
Nick Mathewson cb927a51 2010-07-19T15:03:43 Fix whitespace.
Nick Mathewson b00d4c04 2010-07-19T14:58:08 Remove unused variables in test/test-changelist.c
Mike Smellie cf249e7d 2010-07-19T13:44:56 Possible fix to 100% cpu usage with epoll and openssl I'm running a fairly simple bit of test code using libevent2 with epoll and openssl bufferevents and I've run into a 100% cpu usage problem. Looking into it 100% usage was caused by epoll_wait constantly returning write events on the openssl socket when it shouldn't really have been looking for write events at all (N_ACTIVE_CALLBACKS() was returning 0 also). Looking a bit deeper eventbuffer_openssl socket seems to be requesting that the EV_WRITE event be removed when it should, but the event isn't actually being removed from epoll. Continuing to follow this I think I've found a bug in event_changelist_del. For evpoll event_del calls event_changelist_del which caches the change which is then actioned later when evpoll_dispatch is called. In event_changlist_del there is a check so that if the currently changed action is an add then the cached action is changed to a no-op rather than a delete (which makes sense). The problem arises if there are more than two add or delete operations between calls to dispatch, in this case it's possible that the delete is turned into a no-op when it shouldn't have been. For example starting with the event on, a delete followed by an add and then another delete results in a no-op when it should have been a delete (I added a fair bit of debug output that seems to confirm this behaviour). I've applied a small change that checks the original old_event stored with the change and only converts the delete to a no-op if the event isn't on in old_event. This seems to have fixed my problem.