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
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
b86edf6
Use the MU_LOG_TO_STDOUT envvar to turn on stdout logging and to disa…
tjguk Jun 19, 2021
8d16baa
Refactor slightly partly to support easier testing
tjguk Jun 20, 2021
4fde706
Test the right exception if the download fails
tjguk Jun 20, 2021
a3bfae7
Pushing latest changes although incomplete
tjguk Jun 20, 2021
11bf40b
Iterate over the files in the folder, not the name of the folder(!)
tjguk Jun 21, 2021
1967a59
Ensure we can use glob
tjguk Jun 21, 2021
1aa4b03
Tidy
tjguk Jun 21, 2021
5685d83
Ignore generated zip files
tjguk Jun 21, 2021
4448691
Refactor baseline install test to allow for the fact that we now inst…
tjguk Jun 21, 2021
27182d2
Tweak tests for logging setup to allow for MU_LOG_TO_STDOUT env var
tjguk Jun 21, 2021
dd222d1
Tidy
tjguk Jun 21, 2021
d6ffa3a
Disable the pip version check when downloading wheels
tjguk Jun 22, 2021
05daba5
Add more useful function comments
tjguk Jun 23, 2021
ba30a29
Merge remote-tracking branch 'upstream/master'
tjguk Jul 3, 2021
d841a3f
Merge remote-tracking branch 'upstream/master'
tjguk Jul 4, 2021
36470b8
Merge branch 'mu-editor:master' into master
tjguk Oct 7, 2021
c310937
Merge branch 'master' of https://github.com/tjguk/mu
tjguk Oct 7, 2021
bc0f0d1
Merge branch 'mu-editor:master' into master
tjguk Oct 18, 2021
1a9540d
Merge branch 'master' of https://github.com/tjguk/mu
tjguk Oct 18, 2021
70458df
Merge branch 'mu-editor:master' into master
tjguk Dec 13, 2021
a185643
Merge branch 'master' of https://github.com/tjguk/mu
tjguk Dec 13, 2021
3ecb842
Merge branch 'mu-editor:master' into master
tjguk Dec 24, 2021
0a5c981
Merge branch 'master' of https://github.com/tjguk/mu
tjguk Dec 24, 2021
adcf8a1
Merge branch 'mu-editor:master' into master
tjguk Mar 7, 2022
c9b66e1
Merge branch 'mu-editor:master' into master
tjguk May 10, 2022
7a62f14
Merge remote-tracking branch 'upstream/master'
tjguk Jun 5, 2022
02e7682
Merge branch 'mu-editor:master' into master
tjguk Jun 9, 2022
606382a
Merge branch 'mu-editor:master' into master
tjguk Dec 5, 2022
75a830a
Merge branch 'mu-editor:master' into master
tjguk Dec 5, 2022
ecaf6d7
Merge branch 'mu-editor:master' into master
tjguk Dec 13, 2022
120286a
Merge branch 'mu-editor:master' into master
tjguk Dec 24, 2022
6236b91
Merge branch 'mu-editor:master' into master
tjguk Dec 24, 2022
12c7866
Merge branch 'mu-editor:master' into master
tjguk Dec 25, 2022
cd37d36
Merge branch 'mu-editor:master' into master
tjguk Dec 25, 2022
387dbbe
Merge branch 'mu-editor:master' into master
tjguk Dec 26, 2022
74b68ed
Merge branch 'mu-editor:master' into master
tjguk Jun 24, 2023
338a6b0
Merge branch 'mu-editor:master' into master
tjguk Jun 24, 2023
74481cf
Merge branch 'mu-editor:master' into master
tjguk Jun 24, 2023
6a3ee30
Housekeeping
tjguk Jul 1, 2023
46cd065
Add a shim to release to acquire and release the shared memory object
tjguk Sep 8, 2023
6c3b782
Test acquiring and release mutex
tjguk Sep 8, 2023
9d1ee2f
Merge branch 'master' into issue2429-reset-mutex
tjguk Sep 8, 2023
739fb24
Move short-term scripts out of the committed filespace
tjguk Sep 8, 2023
b5027e5
Merge branch 'mu-editor:master' into master
tjguk Sep 9, 2023
49a9f6b
Merge branch 'master' into issue2429-reset-mutex
tjguk Sep 9, 2023
51fccc7
Remove debugging aids
tjguk Sep 9, 2023
1d66317
Tidy up
tjguk Sep 9, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ coverage: clean
export LANG=en_GB.utf8
pytest -v --random-order --cov-config setup.cfg --cov-report term-missing --cov=mu tests/

tidy:
tidy:
python make.py tidy

black:
Expand Down
11 changes: 10 additions & 1 deletion mu/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,16 @@ def __exit__(self, *args, **kwargs):
self._shared_memory.unlock()

def acquire(self):
#
# The attach-detach dance is a shim from
# https://stackoverflow.com/questions/42549904/qsharedmemory-is-not-getting-deleted-on-application-crash
# If the existing shared memory is not held by any active application
# (eg because an appimage has hard-crashed) then it will be released
# If the memory is held by an active application it will have no effect
#
self._shared_memory.attach()
self._shared_memory.detach()

if self._shared_memory.attach():
pid = struct.unpack("q", self._shared_memory.data()[:8])
raise MutexError("MUTEX: Mu is already running with pid %d" % pid)
Expand Down Expand Up @@ -354,7 +364,6 @@ def run():
logging.info("Platform: {}".format(platform.platform()))
logging.info("Python path: {}".format(sys.path))
logging.info("Language code: {}".format(i18n.language_code))

setup_exception_handler()
check_only_running_once()

Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ exclude =
./.venv*/
./env/
./.env/
./local-scripts/
max-line-length = 88

[coverage:run]
Expand Down
Loading