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

Reset Mutex (Issue 2429) #2460

Merged
merged 47 commits into from
Sep 30, 2023
Merged

Reset Mutex (Issue 2429) #2460

merged 47 commits into from
Sep 30, 2023

Conversation

tjguk
Copy link
Collaborator

@tjguk tjguk commented Sep 9, 2023

When the app hard crashes (eg via a faulty appimage) while the Mutex is held, there is no way to reset it short of writing code to do that or rebooting! This change adds a small change which will reset the Mutex if it's orphaned but will not have any effect if it's still owned by another process (its primary purpose).

It's not easy to test -- least of all automatically. I've only been able to ad hoc test it on Linux -- and that may well be the only platform on which the problem occurs, as on other platforms the shared memory which the Mutex uses is released by the OS; on Linux it has to be released by the app.

My standard approach is to use the appimage binary which crashes consistently on my Linux Mint setup. That then leaves the Mutex held but orphaned. Without this PR, Mu will never start up; with the PR in place Mu will re-own the shared memory and will acquire the Mutex. Conversely, if the Mutex is in fact held by a running Mu instance, with this PR, things happen as they should and the second instance does not run.

tjguk added 30 commits June 19, 2021 21:17
…ble the crash handler

Use version-tagged zips for the downloaded packages
-- Still tests failing and some coverage missing after refactor
Always add the temp download area to the search patch for downloading wheels. This should work for the MacOS shim where we have to download a signed wheel for pygame and then be sure to use that in preference to the PyPI version
Remove (again) `upgrade_pip`
+ Tidy
@tjguk
Copy link
Collaborator Author

tjguk commented Sep 20, 2023

Can't get this to pass all tests -- I assume that the PiOS ones are because the relevant VM is down or something?

Unless anyone objects, I'll merge it soon and then let people play with it. I've tested on Linux & Windows so it's only if MacOS has an issue. @carlosperate (or anyone) please take it for a spin on MacOS if you can. The only reasonable test is to make sure the Mutex continues to work in normal circs -- ie you start one session and attempt to start another; but then doesn't prevent the second instance if the first session is killed hard

@tjguk tjguk merged commit 27bfb77 into mu-editor:master Sep 30, 2023
30 of 31 checks passed
@ntoll
Copy link
Member

ntoll commented Sep 30, 2023

@tjguk thank you so much for all your work on this.

@tjguk tjguk mentioned this pull request Oct 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants