SteamWar/SpigotCore
Archiviert
13
0

Reduce checkpoint exceptions by TCP retry and silent jar updates
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
Lixfel 2024-01-24 11:29:44 +01:00
Ursprung 375fbf1463
Commit da01fbb447

Datei anzeigen

@ -69,8 +69,17 @@ public class CheckpointUtils {
try { try {
freezeInternal(path); freezeInternal(path);
} catch (Exception e) { } catch (Exception e) {
String message = e.getMessage() != null ? e.getMessage() : "";
if(message.contains("Connected TCP socket")) {
Core.getInstance().getLogger().log(Level.INFO, "Connected TCP socket, waiting for checkpointing");
Bukkit.getScheduler().runTaskLater(Core.getInstance(), CheckpointUtils::freeze, 1);
return;
}
Bukkit.shutdown(); Bukkit.shutdown();
throw new SecurityException(e);
if(message.contains("Can't dump ghost file")) // File/Jar has been updated
throw new SecurityException(e);
} finally { } finally {
// Delete checkpoint // Delete checkpoint
try (Stream<Path> stream = Files.walk(path)) { try (Stream<Path> stream = Files.walk(path)) {
@ -109,8 +118,6 @@ public class CheckpointUtils {
try { try {
criu.checkpointJVM(); criu.checkpointJVM();
} catch (JVMCRIUException e) { } catch (JVMCRIUException e) {
Bukkit.shutdown();
Path logfile = path.resolve("criu.log"); Path logfile = path.resolve("criu.log");
if(logfile.toFile().exists()) if(logfile.toFile().exists())
throw new IllegalStateException("Could not create checkpoint, criu log:\n" + new String(Files.readAllBytes(logfile)), e); throw new IllegalStateException("Could not create checkpoint, criu log:\n" + new String(Files.readAllBytes(logfile)), e);