Skip to content

Commit

Permalink
erts: Guard against IN events in poll thread
Browse files Browse the repository at this point in the history
If an IN event is triggered in the poll thread just
as migration happens to scheduler polling, we should
just ignore that event as the scheduler poll will
get the same event.
  • Loading branch information
garazdawi committed Feb 10, 2025
1 parent dc676d9 commit 2ecf2dc
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions erts/emulator/sys/common/erl_check_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -2037,14 +2037,17 @@ erts_check_io(ErtsPollThread *psi, ErtsMonotonicTime timeout_time, int poll_only
#endif
{
ErtsPollEvents reactive_events;

if (state->flags & ERTS_EV_FLAG_SCHEDULER) {
/* We are in a poll thread and the fd is managed
by a scheduler, we ignore the any IN events */
revents &= ~ERTS_POLL_EV_IN;
}

state->active_events &= ~revents;

reactive_events = state->active_events;

if (state->flags & ERTS_EV_FLAG_IN_SCHEDULER) {
state->active_events |= ERTS_POLL_EV_IN;
}

/* Reactivate the poll op if there are still active events */
if (reactive_events) {
ErtsPollEvents new_events;
Expand Down

0 comments on commit 2ecf2dc

Please sign in to comment.