antirez/redis — Issue #333: firelist is unstable
Author: finaldie
Created: 2012-02-10 03:20:30+00:00
State: open

yes, that's my question about firelist in network module (ae).
Currently, the firelist store some active events, but aeProcessEvents() only check the mask for the event whether or not has been removed. So, there may be an event not only removed another event but also reused the fd to create a new event into epoll, then the check will failed.

So, I think maybe we can add a new sparse array to store and relate the firelist, when an event active, we add event fd into firelist and add index of event into sparse array. Then aeProcessEvents() can check the event whether valid safely in current loop.

eg:
clear_firelist();
int num = epoll_wait(...);
for( ... ) {
if ( is_fired(fd) ) continue;
process(...);
}