Paper: Vanilla WorldGen Lakes Deadlock

Created on 2 Sep 2020  路  8Comments  路  Source: PaperMC/Paper

Vanilla appears to have a Deadlock risk here.

Lakes are looking for a structure, but structure escapes out of the RegionLimited world wrapper
This then hit some chunk that is still pending, but since main is blocked, itll never be not pending.

Full log from Zeffy here: https://paste.gg/p/anonymous/77db790e273446b3bedb58123725b337


[02:43:57] [Paper Watchdog Thread/ERROR]: ------------------------------
--
聽 | [02:43:57] [Paper Watchdog Thread/ERROR]: Current Thread: Server-Worker-2
聽 | [02:43:57] [Paper Watchdog Thread/ERROR]:   PID: 17 \| Suspended: false \| Native: false \| State: WAITING
聽 | [02:43:57] [Paper Watchdog Thread/ERROR]:   Stack:
聽 | [02:43:57] [Paper Watchdog Thread/ERROR]:       sun.misc.Unsafe.park(Native Method)
聽 | [02:43:57] [Paper Watchdog Thread/ERROR]:       java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
聽 | [02:43:57] [Paper Watchdog Thread/ERROR]:       java.util.concurrent.CompletableFuture$Signaller.block(CompletableFuture.java:1693)
聽 | [02:43:57] [Paper Watchdog Thread/ERROR]:       java.util.concurrent.ForkJoinPool.managedBlock(ForkJoinPool.java:3323)
聽 | [02:43:57] [Paper Watchdog Thread/ERROR]:       java.util.concurrent.CompletableFuture.waitingGet(CompletableFuture.java:1729)
聽 | [02:43:57] [Paper Watchdog Thread/ERROR]:       java.util.concurrent.CompletableFuture.join(CompletableFuture.java:1934)
聽 | [02:43:57] [Paper Watchdog Thread/ERROR]:       net.minecraft.server.v1_16_R2.ChunkProviderServer.getChunkAt(ChunkProviderServer.java:476)
聽 | [02:43:57] [Paper Watchdog Thread/ERROR]:       net.minecraft.server.v1_16_R2.World.getChunkAt(World.java:356)
聽 | [02:43:57] [Paper Watchdog Thread/ERROR]:       net.minecraft.server.v1_16_R2.IWorldReader.getChunkAt(IWorldReader.java:100)
聽 | [02:43:57] [Paper Watchdog Thread/ERROR]:       net.minecraft.server.v1_16_R2.StructureManager.a(StructureManager.java:27)
聽 | [02:43:57] [Paper Watchdog Thread/ERROR]:       net.minecraft.server.v1_16_R2.WorldServer.a(WorldServer.java:2184)
聽 | [02:43:57] [Paper Watchdog Thread/ERROR]:       net.minecraft.server.v1_16_R2.RegionLimitedWorldAccess.a(RegionLimitedWorldAccess.java:382)
聽 | [02:43:57] [Paper Watchdog Thread/ERROR]:       net.minecraft.server.v1_16_R2.WorldGenLakes.a(SourceFile:36)
聽 | [02:43:57] [Paper Watchdog Thread/ERROR]:       net.minecraft.server.v1_16_R2.WorldGenLakes.generate(SourceFile:18)
聽 | [02:43:57] [Paper Watchdog Thread/ERROR]:       net.minecraft.server.v1_16_R2.WorldGenFeatureConfigured.a(SourceFile:55)
聽 | [02:43:57] [Paper Watchdog Thread/ERROR]:       net.minecraft.server.v1_16_R2.WorldGenFeatureComposite.a(SourceFile:23)
聽 | [02:43:57] [Paper Watchdog Thread/ERROR]:       net.minecraft.server.v1_16_R2.WorldGenFeatureComposite$$Lambda$5582/1099215437.accept(Unknown Source)
聽 | [02:43:57] [Paper Watchdog Thread/ERROR]:       java.util.stream.Streams$StreamBuilderImpl.forEachRemaining(Streams.java:419)


accepted bug vanilla 1.16

All 8 comments

I'd like to honor and credit our lovely server player _Rachel_ for being the poor unfortunate soul that discovered this and promptly got kicked.

RegionLimitedWorldAccess is at fault here:
public Stream> a(SectionPosition sectionposition, StructureGenerator structuregenerator) {
return this.f.a(sectionposition, structuregenerator);

Needs to be

this.f.getStructureManager().a(this).a(sectionposition, structuregenerator);

That .a(this) converts the StructureManager to use a RLWA object instead.

how about we nuke that stream entirely?

no

bruh then we start recommending graalvm cuz they took a shit on them and made them F A S T

No. GraalVM isn't a topic anyone in Paper is very experienced with, and is as such not recommended. The same applies to ZGC, Shenandoah, OpenJ9 and so forth.

You're free to PR a stream removal after the bug is fixed if it really makes any difference whatsoever in what is already a slow process.

just going to note we will not accept a PR to remove streams here. Not rewriting WorldGen code, specially when its not even a main thread bottleneck.

Streams are ok in some cases, it depends how they are used. If it's not hot code, then the logical capabilities it has can end up being a performance increase. It's all very situational.

Let's end stream discussion here.

Was this page helpful?
0 / 5 - 0 ratings