Skip to content

Commit 2ecf2dc

Browse files
committed
erts: Guard against IN events in poll thread
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.
1 parent dc676d9 commit 2ecf2dc

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

erts/emulator/sys/common/erl_check_io.c

+7-4
Original file line numberDiff line numberDiff line change
@@ -2037,14 +2037,17 @@ erts_check_io(ErtsPollThread *psi, ErtsMonotonicTime timeout_time, int poll_only
20372037
#endif
20382038
{
20392039
ErtsPollEvents reactive_events;
2040+
2041+
if (state->flags & ERTS_EV_FLAG_SCHEDULER) {
2042+
/* We are in a poll thread and the fd is managed
2043+
by a scheduler, we ignore the any IN events */
2044+
revents &= ~ERTS_POLL_EV_IN;
2045+
}
2046+
20402047
state->active_events &= ~revents;
20412048

20422049
reactive_events = state->active_events;
20432050

2044-
if (state->flags & ERTS_EV_FLAG_IN_SCHEDULER) {
2045-
state->active_events |= ERTS_POLL_EV_IN;
2046-
}
2047-
20482051
/* Reactivate the poll op if there are still active events */
20492052
if (reactive_events) {
20502053
ErtsPollEvents new_events;

0 commit comments

Comments
 (0)