Closed radiant-ai closed 4 years ago
I haven't been able to replicate this issue since 2.11.2. If you like, I have a beta build of removing the thread sleeping code for a prettier solution. If you like, feel free to download it here: https://github.com/SuperRonanCraft/BetterRTP/releases/tag/2.12.0 and tell me if it works for you ;)
Ok, I will try it and I will get back to you if I have any problems in the next 24 hours. Thank you!
This is likely caused by BetterRTP doing a busy-spin while waiting for chunks to load. Although this is done on another thread, it still means the thread has to perform tons of useless operations every second until the destination chunks have been loaded. Depending on how long it takes chunks to load this small loop might repeat thousands or millions of times. You can see here:
The solution to this is to take proper advantage of CompletableFutures and restructure the code to run in a callback once all futures are done. This can be accomplished with CompletableFuture.allOf, for example this pseudo-code:
List<CompletableFuture<Chunk>> asyncChunks;
CompletableFuture.allOf(asyncChunks.toArray(new CompletableFuture[] {})).thenRun(() -> {
// code continues here
});
Thats actually fairly helpful. I will implement that right away and get this ready for a release soon!
Plugin Version: 2.11.3
Describe The Bug: Player executes /rtp, server crashes
How To Reproduce: Execute /rtp This happended only once on prod server and I could not reproduce this on a testing one, I would not try to use it again on prod though. Rolled back to 2.11.0.
Expected Behavior: No crashes
Screenshots/Error Log: https://pastebin.com/Gw1E3i0J
Additional Context: Server does not have a pregenerated world