Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

erts: release dirty runqueue lock before entering endless loop #2172

Closed
wants to merge 1 commit into from

Conversation

max-au
Copy link
Contributor

@max-au max-au commented Mar 4, 2019

This patch fixes a problem happening when BEAM is shutting down. It is possible for a dirty scheduler to take the lock, and keep it, when the system is shutting down. It may also happen that a normal scheduler decides to schedule some dirty job (example is major garbage collection that results in migrating the process into dirty CPU queue), and hangs trying to take the lock that will never be released.

To fix the problem, either release the lock before entering endless wait loop, or reverse the order in which schedulers are stopped. Either fix works, and, of course, it works even better to apply both.

…EAM is shutting down

This patch fixes a problem happening when BEAM is shutting down. It is possible for a dirty scheduler to take the lock, and keep it, when the system is shutting down. It may also happen that a normal scheduler decides to schedule some dirty job (example is major garbage collection that results in migrating the process into dirty CPU queue), and hangs trying to take the lock that will never be released.

To fix the problem, either release the lock before entering endless wait loop, or reverse the order in which schedulers are stopped. Either fix works, and, of course, it works even better to apply both.
@rickard-green rickard-green added the team:VM Assigned to OTP team VM label Mar 11, 2019
@garazdawi garazdawi self-assigned this Mar 18, 2019
@garazdawi garazdawi added the testing currently being tested, tag is used by OTP internal CI label Mar 18, 2019
@garazdawi garazdawi changed the base branch from maint to master March 18, 2019 16:27
@garazdawi
Copy link
Contributor

merged to master and also scheduled to be released as patch for OTP-20 and OTP-21.

@garazdawi garazdawi closed this Mar 21, 2019
@max-au max-au deleted the dirty_scheduler_shutdown branch August 28, 2021 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team:VM Assigned to OTP team VM testing currently being tested, tag is used by OTP internal CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants