From 6ad3653c0470dc3fc9f49f213e9012e779f4f17e Mon Sep 17 00:00:00 2001 From: ta264 Date: Thu, 14 May 2020 19:22:33 +0100 Subject: [PATCH] Trap Kestrel Address bind exception to avoid bootloop --- src/NzbDrone.Console/ConsoleApp.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Console/ConsoleApp.cs b/src/NzbDrone.Console/ConsoleApp.cs index 47cdbe2fc..bfd286090 100644 --- a/src/NzbDrone.Console/ConsoleApp.cs +++ b/src/NzbDrone.Console/ConsoleApp.cs @@ -1,5 +1,7 @@ using System; +using System.IO; using System.Net.Sockets; +using Microsoft.AspNetCore.Connections; using NLog; using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.Exceptions; @@ -49,9 +51,23 @@ public static void Main(string[] args) { System.Console.WriteLine(""); System.Console.WriteLine(""); - Logger.Fatal(ex.Message + ". This can happen if another instance of Radarr is already running another application is using the same port (default: 7878) or the user has insufficient permissions"); + Logger.Fatal(ex.Message + " This can happen if another instance of Radarr is already running another application is using the same port (default: 7878) or the user has insufficient permissions"); Exit(ExitCodes.RecoverableFailure); } + catch (IOException ex) + { + if (ex.InnerException is AddressInUseException) + { + System.Console.WriteLine(""); + System.Console.WriteLine(""); + Logger.Fatal(ex.Message + " This can happen if another instance of Radarr is already running another application is using the same port (default: 7878) or the user has insufficient permissions"); + Exit(ExitCodes.RecoverableFailure); + } + else + { + throw; + } + } catch (RemoteAccessException ex) { System.Console.WriteLine("");