aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2011-11-30 13:39:04 +0100
committerRickard Green <[email protected]>2011-12-01 09:19:46 +0100
commitc23286a3b8d33a4e61b97896e1c713036bc17cb2 (patch)
treeb43ca07abcc6c10d6142c581d4cab984a059b995
parent58f5f45566b827e74ff623398bdf6d0b6fcebdb3 (diff)
downloadotp-c23286a3b8d33a4e61b97896e1c713036bc17cb2.tar.gz
otp-c23286a3b8d33a4e61b97896e1c713036bc17cb2.tar.bz2
otp-c23286a3b8d33a4e61b97896e1c713036bc17cb2.zip
Fix scheduler suspend bug
Calls to erlang:system_flag(schedulers_online, N) and/or erlang:system_flag(multi_scheduling, block|unblock) could cause internal data used by this functionality to get into an inconsistent state. When this happened various problems occurred. This bug was quite hard to trigger, so hopefully no-one has been effected by it.
-rw-r--r--erts/emulator/beam/erl_process.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/erts/emulator/beam/erl_process.c b/erts/emulator/beam/erl_process.c
index 9db2e874c6..c9905637cb 100644
--- a/erts/emulator/beam/erl_process.c
+++ b/erts/emulator/beam/erl_process.c
@@ -3894,9 +3894,11 @@ suspend_scheduler(ErtsSchedulerData *esdp)
wake = 0;
}
- flgs = erts_smp_atomic32_read_acqb(&ssi->flags);
- if (!(flgs & ERTS_SSI_FLG_SUSPENDED))
- break;
+ if (curr_online && !ongoing_multi_scheduling_block()) {
+ flgs = erts_smp_atomic32_read_acqb(&ssi->flags);
+ if (!(flgs & ERTS_SSI_FLG_SUSPENDED))
+ break;
+ }
erts_smp_mtx_unlock(&schdlr_sspnd.mtx);
while (1) {