From 4e02b95eeac1cdd3d49f0ca0177f9d59a76e9ce4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 7 Dec 2025 00:19:04 +0000 Subject: Add handling for AbandonedMutexException from WaitOne call Co-authored-by: jpdillingham <17145758+jpdillingham@users.noreply.github.com> --- src/slskd/Program.cs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/slskd/Program.cs') diff --git a/src/slskd/Program.cs b/src/slskd/Program.cs index 098cc324..bafac8b1 100644 --- a/src/slskd/Program.cs +++ b/src/slskd/Program.cs @@ -357,6 +357,13 @@ namespace slskd Log.Warning("This can happen when running with insufficient permissions"); Log.Warning("The application will continue, but multiple instances may be able to run simultaneously"); } + catch (AbandonedMutexException ex) + { + Log.Warning($"Acquired an abandoned mutex: {ex.Message}"); + Log.Warning("A previous instance may have terminated unexpectedly"); + + // The mutex is now owned by this thread, so we can continue + } // derive the application directory value and defaults that are dependent upon it AppDirectory ??= DefaultAppDirectory; -- cgit v1.2.3