summaryrefslogtreecommitdiff
path: root/erts/emulator/beam/time.c
diff options
context:
space:
mode:
authorRickard Green <rickard@erlang.org>2021-03-04 16:26:59 +0100
committerRickard Green <rickard@erlang.org>2021-03-04 22:39:59 +0100
commit8d3393e8bfec37842003ef808e760af850637a3c (patch)
tree384b91872f0a1244682ddb9e9a9d937bd69eaf2b /erts/emulator/beam/time.c
parent7fe7fa3dde556b5b92522f8279d465bb52baf1f6 (diff)
downloaderlang-8d3393e8bfec37842003ef808e760af850637a3c.tar.gz
Fix multi-zero timeout callback handling in timer wheel
Execution of a zero timeout callback which was started from another zero timeout callback could be delayed. Most timers in the system do not behave like this. The service timer placed in the timer wheel for management of the red-black tree of very long timers may however behave like this.
Diffstat (limited to 'erts/emulator/beam/time.c')
-rw-r--r--erts/emulator/beam/time.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/erts/emulator/beam/time.c b/erts/emulator/beam/time.c
index a3069e419a..6c528a362b 100644
--- a/erts/emulator/beam/time.c
+++ b/erts/emulator/beam/time.c
@@ -480,6 +480,8 @@ find_next_timeout(ErtsSchedulerData *esdp, ErtsTimerWheel *tiw)
ERTS_HARD_DBG_CHK_WHEELS(tiw, 0);
+ ERTS_TW_ASSERT(tiw->at_once.nto == 0);
+ ERTS_TW_ASSERT(tiw->nto == tiw->soon.nto + tiw->later.nto);
ERTS_TW_ASSERT(tiw->yield_slot == ERTS_TW_SLOT_INACTIVE);
if (tiw->nto == 0) { /* no timeouts in wheel */
@@ -864,6 +866,8 @@ erts_bump_timers(ErtsTimerWheel *tiw, ErtsMonotonicTime curr_time)
}
if (tiw->pos >= bump_to) {
+ if (tiw->at_once.nto)
+ continue;
ERTS_MSACC_POP_STATE_M_X();
break;
}