diff options
author | Rickard Green <[email protected]> | 2011-11-30 13:39:04 +0100 |
---|---|---|
committer | Rickard Green <[email protected]> | 2011-12-01 09:19:46 +0100 |
commit | c23286a3b8d33a4e61b97896e1c713036bc17cb2 (patch) | |
tree | b43ca07abcc6c10d6142c581d4cab984a059b995 /erts/emulator/beam | |
parent | 58f5f45566b827e74ff623398bdf6d0b6fcebdb3 (diff) | |
download | otp-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.
Diffstat (limited to 'erts/emulator/beam')
-rw-r--r-- | erts/emulator/beam/erl_process.c | 8 |
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) { |