mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-05 14:26:06 +02:00
Crash auto recovery
in the worst way possible
This commit is contained in:
@@ -80,7 +80,7 @@ namespace VRCX
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CefTerminationStatus.ProcessCrashed:
|
case CefTerminationStatus.ProcessCrashed:
|
||||||
_logger.Error("Browser crashed while.");
|
_logger.Error("Browser crashed.");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CefTerminationStatus.OutOfMemory:
|
case CefTerminationStatus.OutOfMemory:
|
||||||
@@ -91,6 +91,12 @@ namespace VRCX
|
|||||||
_logger.Error($"Browser terminated with unhandled status '{status}' while at address.");
|
_logger.Error($"Browser terminated with unhandled status '{status}' while at address.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (chromiumWebBrowser.IsDisposed || chromiumWebBrowser.IsLoading)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_logger.Info("Attempting to reload browser...");
|
||||||
|
chromiumWebBrowser.Reload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using CefSharp.Internals;
|
using CefSharp.Internals;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
namespace VRCX;
|
namespace VRCX;
|
||||||
|
|
||||||
@@ -26,7 +27,7 @@ public class BrowserSubprocess
|
|||||||
|
|
||||||
if (string.IsNullOrEmpty(type))
|
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).
|
// this is the main process (as all subprocesses must have a type param).
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -46,9 +47,22 @@ public class BrowserSubprocess
|
|||||||
|
|
||||||
var methodArgs = new object[] { args };
|
var methodArgs = new object[] { args };
|
||||||
|
|
||||||
var exitCode = mainMethod.Invoke(null, methodArgs);
|
int exitCode = -1;
|
||||||
|
while (true)
|
||||||
Environment.Exit((int)exitCode);
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-16
@@ -10,7 +10,6 @@ using System;
|
|||||||
using System.Data.SQLite;
|
using System.Data.SQLite;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
#if !LINUX
|
#if !LINUX
|
||||||
@@ -128,6 +127,7 @@ namespace VRCX
|
|||||||
[SuppressMessage("Interoperability", "CA1416:Validate platform compatibility")]
|
[SuppressMessage("Interoperability", "CA1416:Validate platform compatibility")]
|
||||||
private static void Main()
|
private static void Main()
|
||||||
{
|
{
|
||||||
|
BrowserSubprocess.Start();
|
||||||
if (Wine.GetIfWine())
|
if (Wine.GetIfWine())
|
||||||
{
|
{
|
||||||
MessageBox.Show(
|
MessageBox.Show(
|
||||||
@@ -192,20 +192,6 @@ namespace VRCX
|
|||||||
|
|
||||||
#endregion
|
#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)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
var cpuError = WinApi.GetCpuErrorMessage();
|
var cpuError = WinApi.GetCpuErrorMessage();
|
||||||
@@ -233,7 +219,6 @@ namespace VRCX
|
|||||||
StartupArgs.ArgsCheck(args);
|
StartupArgs.ArgsCheck(args);
|
||||||
SetProgramDirectories();
|
SetProgramDirectories();
|
||||||
VRCXStorage.Instance.Load();
|
VRCXStorage.Instance.Load();
|
||||||
BrowserSubprocess.Start();
|
|
||||||
ConfigureLogger();
|
ConfigureLogger();
|
||||||
GetVersion();
|
GetVersion();
|
||||||
Update.Check();
|
Update.Check();
|
||||||
|
|||||||
@@ -282,7 +282,8 @@
|
|||||||
},
|
},
|
||||||
"vrcplus": {
|
"vrcplus": {
|
||||||
"gift": "VRC+ Gift"
|
"gift": "VRC+ Gift"
|
||||||
}
|
},
|
||||||
|
"localNotifs": "System"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"friend_list": {
|
"friend_list": {
|
||||||
|
|||||||
@@ -70,8 +70,12 @@ export async function initSentry(app) {
|
|||||||
'An error occurred while sending the request'
|
'An error occurred while sending the request'
|
||||||
) ||
|
) ||
|
||||||
error.message.includes('database or disk is full') ||
|
error.message.includes('database or disk is full') ||
|
||||||
|
error.message.includes('disk I/O error') ||
|
||||||
error.message.includes(
|
error.message.includes(
|
||||||
'There is not enough space on the disk.'
|
'There is not enough space on the disk.'
|
||||||
|
) ||
|
||||||
|
error.message.includes(
|
||||||
|
'The requested address is not valid in its context.'
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
+14
-1
@@ -33,7 +33,10 @@ class SQLiteService {
|
|||||||
}
|
}
|
||||||
).catch(() => {});
|
).catch(() => {});
|
||||||
}
|
}
|
||||||
if (e.message.includes('database is locked')) {
|
if (
|
||||||
|
e.message.includes('database is locked') ||
|
||||||
|
e.message.includes('attempt to write a readonly database')
|
||||||
|
) {
|
||||||
ElMessageBox.alert(
|
ElMessageBox.alert(
|
||||||
'Please close other applications that might be using the database file.',
|
'Please close other applications that might be using the database file.',
|
||||||
'Database is locked',
|
'Database is locked',
|
||||||
@@ -43,6 +46,16 @@ class SQLiteService {
|
|||||||
}
|
}
|
||||||
).catch(() => {});
|
).catch(() => {});
|
||||||
}
|
}
|
||||||
|
if (e.message.includes('disk I/O error')) {
|
||||||
|
ElMessageBox.alert(
|
||||||
|
'Please check your disk for errors.',
|
||||||
|
'Disk I/O error',
|
||||||
|
{
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
type: 'warning'
|
||||||
|
}
|
||||||
|
).catch(() => {});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user