Merge branch 'fix/race-condition-unzip' into 'master'

Fix: race condition on shutdown of zip extractor

See merge request sheepitrenderfarm/client!347
This commit is contained in:
Sheepit Renderfarm
2024-12-14 09:38:44 +00:00

View File

@@ -245,6 +245,17 @@ public class UnzipUtils {
private static void writeWait(WriteQueue queue, ExecutorService executor) throws InterruptedException { private static void writeWait(WriteQueue queue, ExecutorService executor) throws InterruptedException {
queue.doneAdding = true; queue.doneAdding = true;
executor.shutdown(); executor.shutdown();
try {
if (executor.awaitTermination(60, TimeUnit.MINUTES) == false) {
executor.shutdownNow();
}
}
catch (InterruptedException e) {
executor.shutdownNow();
Thread.currentThread().interrupt();
}
//Encourage the JVM to release memory used while decompressing //Encourage the JVM to release memory used while decompressing
GC_RUNNER.execute(System::gc); GC_RUNNER.execute(System::gc);
} }