aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_process.c
diff options
context:
space:
mode:
authorJohn Högberg <[email protected]>2018-11-27 07:10:43 +0100
committerJohn Högberg <[email protected]>2018-11-27 07:19:28 +0100
commit106158baac95a886d8c4e3f3133fabc7d4a9695f (patch)
tree3fb27bc9d1b731ccb92f490aa084e183071c1e18 /erts/emulator/beam/erl_process.c
parent423f078e3b8603cbd8bfea3be8709092a861a36e (diff)
downloadotp-106158baac95a886d8c4e3f3133fabc7d4a9695f.tar.gz
otp-106158baac95a886d8c4e3f3133fabc7d4a9695f.tar.bz2
otp-106158baac95a886d8c4e3f3133fabc7d4a9695f.zip
Abort when aux work runs on a dirty scheduler
While the system will keep working, the aux work will never run and the affected scheduler never goes to sleep. OTP-15446 is a good example of this. As this error easily flies under the radar it's best to make it immediately visible. The assertions we had in debug builds were clearly not enough to catch all sources of this problem.
Diffstat (limited to 'erts/emulator/beam/erl_process.c')
-rw-r--r--erts/emulator/beam/erl_process.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/erts/emulator/beam/erl_process.c b/erts/emulator/beam/erl_process.c
index a21acb9a57..1dde9800f8 100644
--- a/erts/emulator/beam/erl_process.c
+++ b/erts/emulator/beam/erl_process.c
@@ -3284,7 +3284,12 @@ scheduler_wait(int *fcalls, ErtsSchedulerData *esdp, ErtsRunQueue *rq)
ErtsMonotonicTime current_time = 0;
aux_work = erts_atomic32_read_acqb(&ssi->aux_work);
- if (aux_work && !ERTS_SCHEDULER_IS_DIRTY(esdp)) {
+
+ if (aux_work && ERTS_SCHEDULER_IS_DIRTY(esdp)) {
+ ERTS_INTERNAL_ERROR("Executing aux work on a dirty scheduler.");
+ }
+
+ if (aux_work) {
if (!thr_prgr_active) {
erts_thr_progress_active(esdp, thr_prgr_active = 1);
sched_wall_time_change(esdp, 1);
@@ -3296,16 +3301,14 @@ scheduler_wait(int *fcalls, ErtsSchedulerData *esdp, ErtsRunQueue *rq)
}
if (aux_work) {
- if (!ERTS_SCHEDULER_IS_DIRTY(esdp)) {
- flgs = erts_atomic32_read_acqb(&ssi->flags);
- current_time = erts_get_monotonic_time(esdp);
- if (current_time >= erts_next_timeout_time(esdp->next_tmo_ref)) {
- if (!thr_prgr_active) {
- erts_thr_progress_active(esdp, thr_prgr_active = 1);
- sched_wall_time_change(esdp, 1);
- }
- erts_bump_timers(esdp->timer_wheel, current_time);
+ flgs = erts_atomic32_read_acqb(&ssi->flags);
+ current_time = erts_get_monotonic_time(esdp);
+ if (current_time >= erts_next_timeout_time(esdp->next_tmo_ref)) {
+ if (!thr_prgr_active) {
+ erts_thr_progress_active(esdp, thr_prgr_active = 1);
+ sched_wall_time_change(esdp, 1);
}
+ erts_bump_timers(esdp->timer_wheel, current_time);
}
}
else {