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

Unhandled AbandonedMutexException #413

Open
Eta0 opened this issue Mar 16, 2024 · 0 comments
Open

Unhandled AbandonedMutexException #413

Eta0 opened this issue Mar 16, 2024 · 0 comments

Comments

@Eta0
Copy link

Eta0 commented Mar 16, 2024

Attempting to grab the mutex during application startup can throw an AbandonedMutexException, which successfully acquires the mutex, but will crash the program if not handled. When it crashes, it abandons the mutex again, ultimately causing the program to crash repeatedly on every launch until the mutex is cleaned up by some other mechanism.

There are two prerequisites to get into this situation:

  1. Something else causes the mutex to be abandoned the first time (some unrelated crash)
  2. Another process is holding an open handle to the mutex between program launches and prevents it from being cleaned up by the operating system (which would reset its state automatically)

I noticed this because of some other bug that was leaving an instance application in a quasi-shut-down state (no remaining application window, and not holding that mutex, but not fully exiting and releasing handles), which then made all subsequent launches fail until the odd one was terminated via task manager. It's a pretty niche set of circumstances, but should be pretty easy to handle to prevent that sort of crash loop from coming up. Either ignoring the AbandonedMutexException and treating it as a successful acquire (since it still is one) or attempting to clean up the program state by terminating all other CompactGUI instances (since something is broken at that point) might be reasonable approaches.

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

No branches or pull requests

1 participant