mirror of
https://github.com/vrcx-team/VRCX.git
synced 2026-04-06 00:32:02 +02:00
Crash auto recovery
in the worst way possible
This commit is contained in:
@@ -80,7 +80,7 @@ namespace VRCX
|
||||
break;
|
||||
|
||||
case CefTerminationStatus.ProcessCrashed:
|
||||
_logger.Error("Browser crashed while.");
|
||||
_logger.Error("Browser crashed.");
|
||||
break;
|
||||
|
||||
case CefTerminationStatus.OutOfMemory:
|
||||
@@ -91,6 +91,12 @@ namespace VRCX
|
||||
_logger.Error($"Browser terminated with unhandled status '{status}' while at address.");
|
||||
break;
|
||||
}
|
||||
|
||||
if (chromiumWebBrowser.IsDisposed || chromiumWebBrowser.IsLoading)
|
||||
return;
|
||||
|
||||
_logger.Info("Attempting to reload browser...");
|
||||
chromiumWebBrowser.Reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using CefSharp.Internals;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
|
||||
namespace VRCX;
|
||||
|
||||
@@ -26,7 +27,7 @@ public class BrowserSubprocess
|
||||
|
||||
if (string.IsNullOrEmpty(type))
|
||||
{
|
||||
// If --type param missing from command line CEF/Chromium assums
|
||||
// If --type param missing from command line CEF/Chromium assumes
|
||||
// this is the main process (as all subprocesses must have a type param).
|
||||
return;
|
||||
}
|
||||
@@ -46,9 +47,22 @@ public class BrowserSubprocess
|
||||
|
||||
var methodArgs = new object[] { args };
|
||||
|
||||
var exitCode = mainMethod.Invoke(null, methodArgs);
|
||||
|
||||
Environment.Exit((int)exitCode);
|
||||
int exitCode = -1;
|
||||
while (true)
|
||||
{
|
||||
try
|
||||
{
|
||||
exitCode = (int)mainMethod.Invoke(null, methodArgs);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// TODO: Log this exception somewhere more useful
|
||||
Console.WriteLine("Exception in BrowserSubprocess: " + ex);
|
||||
Thread.Sleep(1000);
|
||||
continue;
|
||||
}
|
||||
Environment.Exit(exitCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ using System;
|
||||
using System.Data.SQLite;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
#if !LINUX
|
||||
@@ -128,6 +127,7 @@ namespace VRCX
|
||||
[SuppressMessage("Interoperability", "CA1416:Validate platform compatibility")]
|
||||
private static void Main()
|
||||
{
|
||||
BrowserSubprocess.Start();
|
||||
if (Wine.GetIfWine())
|
||||
{
|
||||
MessageBox.Show(
|
||||
@@ -192,20 +192,6 @@ namespace VRCX
|
||||
|
||||
#endregion
|
||||
|
||||
#region Handle Out Of Memory
|
||||
|
||||
catch (SEHException e)
|
||||
{
|
||||
logger.Fatal(e, "Unhandled SEH Exception, most likely out of memory, closing.");
|
||||
var messageBoxResult = MessageBox.Show(
|
||||
"VRCX has run out of memory and needs to close.\n" +
|
||||
"We're actively working on fixing this issue. \n" +
|
||||
e, "Out of Memory", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
catch (Exception e)
|
||||
{
|
||||
var cpuError = WinApi.GetCpuErrorMessage();
|
||||
@@ -233,7 +219,6 @@ namespace VRCX
|
||||
StartupArgs.ArgsCheck(args);
|
||||
SetProgramDirectories();
|
||||
VRCXStorage.Instance.Load();
|
||||
BrowserSubprocess.Start();
|
||||
ConfigureLogger();
|
||||
GetVersion();
|
||||
Update.Check();
|
||||
|
||||
Reference in New Issue
Block a user