PaperMC / PaperMC/Paper

POI chunk accessed off main thread

Open
#10,089 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: accepted type: bug version: 1.20.4
Dominant language
Java
Stars
12.7k
Forks
3.5k
Avg merge
3d 13h
Merged PRs (30d)
11

Description

Stack trace

This isn't a crash or bug, but on restart (or maybe crash?) sometimes there seems to be a code path that accesses the poi chunk off the main thread, which your async handlers detect. Which I think you may want to know about.
If its not an issue then you can close this.
This could also maybe be caused by a plugin, but I doubt it as I am not doing anything dumb like setting blocks async.

[14:38:44 INFO]: [Votifier] Disabling Votifier v2.7.3
[14:38:44 ERROR]: [ChunkTaskScheduler] Chunk system error at chunk (1112,-1021), holder: NewChunkHolder{world=cool_world, chunkX=1112, chunkZ=-1021, entityChunkFromDisk=false, lastChunkCompletion={chunk_class=net.minecraft.world.level.chunk.ProtoChunk,status=minecraft:carvers}, currentGenStatus=minecraft:carvers, requestedGenStatus=minecraft:initialize_light, generationTask=ChunkProgressionTask{class: io.papermc.paper.chunk.system.scheduling.ChunkUpgradeGenericStatusTask, for world: cool_world, chunk: (1112,-1021), hashcode: 1257105103, priority: COMPLETING, status: minecraft:features, scheduled: true}, generationTaskStatus=minecraft:features, priority=NORMAL, priorityLocked=false, neighbourRequestedPriority=NORMAL, effective_priority=NORMAL, oldTicketLevel=34, currentTicketLevel=34, totalNeighboursUsingThisChunk=5, fullNeighbourChunksLoadedBitset=1048576, chunkStatusRaw=0, currentChunkStatus=INACCESSIBLE, pendingChunkStatus=INACCESSIBLE, is_unload_safe=ticket_level, killed=false}, exception:
java.lang.Throwable: net.minecraft.ReportedException: Feature placement
        at io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler.unrecoverableChunkSystemFailure(ChunkTaskScheduler.java:276) ~[paper-1.20.4.jar:git-Paper-"dc62150"]
        at io.papermc.paper.chunk.system.scheduling.NewChunkHolder.lambda$setGenerationTask$4(NewChunkHolder.java:1705) ~[paper-1.20.4.jar:git-Paper-"dc62150"]
        at io.papermc.paper.chunk.system.scheduling.ChunkProgressionTask.complete0(ChunkProgressionTask.java:95) ~[paper-1.20.4.jar:git-Paper-"dc62150"]
        at io.papermc.paper.chunk.system.scheduling.ChunkProgressionTask.complete(ChunkProgressionTask.java:75) ~[paper-1.20.4.jar:git-Paper-"dc62150"]
        at io.papermc.paper.chunk.system.scheduling.ChunkUpgradeGenericStatusTask.run(ChunkUpgradeGenericStatusTask.java:105) ~[paper-1.20.4.jar:git-Paper-"dc62150"]
        at io.papermc.paper.chunk.system.scheduling.queue.RadiusAwarePrioritisedExecutor$Task.run(RadiusAwarePrioritisedExecutor.java:467) ~[paper-1.20.4.jar:git-Paper-"dc62150"]
        at ca.spottedleaf.concurrentutil.executor.standard.PrioritisedThreadedTaskQueue$PrioritisedTask.executeInternal(PrioritisedThreadedTaskQueue.java:351) ~[paper-1.20.4.jar:git-Paper-"dc62150"]
        at ca.spottedleaf.concurrentutil.executor.standard.PrioritisedThreadedTaskQueue.executeTask(PrioritisedThreadedTaskQueue.java:118) ~[paper-1.20.4.jar:git-Paper-"dc62150"]
        at ca.spottedleaf.concurrentutil.executor.standard.PrioritisedThreadPool$PrioritisedThread.pollTasks(PrioritisedThreadPool.java:274) ~[paper-1.20.4.jar:git-Paper-"dc62150"]
        at ca.spottedleaf.concurrentutil.executor.standard.PrioritisedQueueExecutorThread.run(PrioritisedQueueExecutorThread.java:50) ~[paper-1.20.4.jar:git-Paper-"dc62150"]
Caused by: net.minecraft.ReportedException: Feature placement
        at net.minecraft.world.level.chunk.ChunkGenerator.addVanillaDecorations(ChunkGenerator.java:466) ~[paper-1.20.4.jar:git-Paper-"dc62150"]
        at net.minecraft.world.level.chunk.ChunkGenerator.applyBiomeDecoration(ChunkGenerator.java:478) ~[paper-1.20.4.jar:git-Paper-"dc62150"]
        at net.minecraft.world.level.chunk.ChunkGenerator.applyBiomeDecoration(ChunkGenerator.java:473) ~[paper-1.20.4.jar:git-Paper-"dc62150"]
        at net.minecraft.world.level.chunk.ChunkStatus.lambda$static$11(ChunkStatus.java:127) ~[paper-1.20.4.jar:git-Paper-"dc62150"]
        at net.minecraft.world.level.chunk.ChunkStatus$SimpleGenerationTask.doWork(ChunkStatus.java:342) ~[?:?]
        at net.minecraft.world.level.chunk.ChunkStatus.generate(ChunkStatus.java:259) ~[paper-1.20.4.jar:git-Paper-"dc62150"]
        at io.papermc.paper.chunk.system.scheduling.ChunkUpgradeGenericStatusTask.run(ChunkUpgradeGenericStatusTask.java:86) ~[paper-1.20.4.jar:git-Paper-"dc62150"]
        ... 5 more
Caused by: java.lang.IllegalStateException: Accessing poi chunk off-main
        at io.papermc.paper.util.TickThread.ensureTickThread(TickThread.java:66) ~[paper-1.20.4.jar:git-Paper-"dc62150"]
        at net.minecraft.world.entity.ai.village.poi.PoiManager.d(PoiManager.java:276) ~[?:?]
        at net.minecraft.world.entity.ai.village.poi.PoiManager.exists(PoiManager.java:197) ~[?:?]
        at net.minecraft.server.level.ServerLevel.lambda$onBlockStateChange$20(ServerLevel.java:2302) ~[?:?]
        at net.minecraft.util.thread.BlockableEventLoop.execute(BlockableEventLoop.java:100) ~[?:?]
        at net.minecraft.server.level.ServerLevel.lambda$onBlockStateChange$21(ServerLevel.java:2300) ~[?:?]
        at java.util.Optional.ifPresent(Optional.java:178) ~[?:?]
        at net.minecraft.server.level.ServerLevel.onBlockStateChange(ServerLevel.java:2299) ~[?:?]
        at net.minecraft.server.level.WorldGenRegion.setBlock(WorldGenRegion.java:342) ~[?:?]
        at net.minecraft.world.level.LevelWriter.setBlock(LevelWriter.java:13) ~[?:?]
        at net.minecraft.world.level.levelgen.feature.TreeFeature.lambda$place$7(TreeFeature.java:148) ~[?:?]
        at net.minecraft.world.level.levelgen.feature.treedecorators.TreeDecorator$Context.setBlock(TreeDecorator.java:50) ~[?:?]
        at net.minecraft.world.level.levelgen.feature.treedecorators.BeehiveDecorator.place(BeehiveDecorator.java:58) ~[?:?]
        at net.minecraft.world.level.levelgen.feature.TreeFeature.lambda$place$8(TreeFeature.java:154) ~[?:?]
        at com.google.common.collect.ImmutableList.forEach(ImmutableList.java:422) ~[guava-32.1.2-jre.jar:?]
        at net.minecraft.world.level.levelgen.feature.TreeFeature.lambda$place$8(TreeFeature.java:154) ~[?:?]
        at net.minecraft.world.level.levelgen.feature.Feature.place(Feature.java:155) ~[?:?]
        at net.minecraft.world.level.levelgen.feature.ConfiguredFeature.a(ConfiguredFeature.java:25) ~[?:?]
        at net.minecraft.world.level.levelgen.placement.PlacedFeature.lambda$placeWithContext$4(PlacedFeature.java:52) ~[paper-1.20.4.jar:git-Paper-"dc62150"]
        at java.util.stream.Streams$StreamBuilderImpl.forEachRemaining(Streams.java:411) ~[?:?]
        at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762) ~[?:?]
        at net.minecraft.world.level.levelgen.placement.PlacedFeature.placeWithContext(PlacedFeature.java:51) ~[paper-1.20.4.jar:git-Paper-"dc62150"]
        at net.minecraft.world.level.levelgen.placement.PlacedFeature.place(PlacedFeature.java:33) ~[paper-1.20.4.jar:git-Paper-"dc62150"]
        at net.minecraft.world.level.levelgen.feature.RandomSelectorFeature.place(RandomSelectorFeature.java:29) ~[?:?]
        at net.minecraft.world.level.levelgen.feature.Feature.place(Feature.java:155) ~[?:?]
        at net.minecraft.world.level.levelgen.feature.ConfiguredFeature.a(ConfiguredFeature.java:25) ~[?:?]
        at net.minecraft.world.level.levelgen.placement.PlacedFeature.lambda$placeWithContext$4(PlacedFeature.java:52) ~[paper-1.20.4.jar:git-Paper-"dc62150"]
        at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) ~[?:?]
        at java.util.stream.Streams$StreamBuilderImpl.forEachRemaining(Streams.java:411) ~[?:?]
        at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762) ~[?:?]
        at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:276) ~[?:?]
        at java.util.stream.Streams$StreamBuilderImpl.forEachRemaining(Streams.java:411) ~[?:?]
        at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762) ~[?:?]
        at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:276) ~[?:?]
        at java.util.stream.Streams$StreamBuilderImpl.forEachRemaining(Streams.java:411) ~[?:?]
        at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762) ~[?:?]
        at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:276) ~[?:?]
        at java.util.stream.Streams$StreamBuilderImpl.forEachRemaining(Streams.java:411) ~[?:?]
        at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762) ~[?:?]
        at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:276) ~[?:?]
        at java.util.stream.Streams$StreamBuilderImpl.forEachRemaining(Streams.java:411) ~[?:?]
        at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762) ~[?:?]
        at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:276) ~[?:?]
        at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) ~[?:?]
        at java.util.stream.IntPipeline$1$1.accept(IntPipeline.java:180) ~[?:?]
        at java.util.stream.Streams$RangeIntSpliterator.forEachRemaining(Streams.java:104) ~[?:?]
        at java.util.Spliterator$OfInt.forEachRemaining(Spliterator.java:711) ~[?:?]
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[?:?]
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[?:?]
        at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) ~[?:?]
        at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) ~[?:?]
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
        at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596) ~[?:?]
        at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:276) ~[?:?]
        at java.util.stream.Streams$StreamBuilderImpl.forEachRemaining(Streams.java:411) ~[?:?]
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[?:?]
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[?:?]
        at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) ~[?:?]
        at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) ~[?:?]
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
        at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596) ~[?:?]
        at net.minecraft.world.level.levelgen.placement.PlacedFeature.placeWithContext(PlacedFeature.java:51) ~[paper-1.20.4.jar:git-Paper-"dc62150"]
        at net.minecraft.world.level.levelgen.placement.PlacedFeature.placeWithBiomeCheck(PlacedFeature.java:37) ~[paper-1.20.4.jar:git-Paper-"dc62150"]
        at net.minecraft.world.level.chunk.ChunkGenerator.addVanillaDecorations(ChunkGenerator.java:448) ~[paper-1.20.4.jar:git-Paper-"dc62150"]
        at net.minecraft.world.level.chunk.ChunkGenerator.applyBiomeDecoration(ChunkGenerator.java:478) ~[paper-1.20.4.jar:git-Paper-"dc62150"]
        at net.minecraft.world.level.chunk.ChunkGenerator.applyBiomeDecoration(ChunkGenerator.java:473) ~[paper-1.20.4.jar:git-Paper-"dc62150"]
        at net.minecraft.world.level.chunk.ChunkStatus.lambda$static$11(ChunkStatus.java:127) ~[paper-1.20.4.jar:git-Paper-"dc62150"]
        at net.minecraft.world.level.chunk.ChunkStatus$SimpleGenerationTask.doWork(ChunkStatus.java:342) ~[?:?]
        at net.minecraft.world.level.chunk.ChunkStatus.generate(ChunkStatus.java:259) ~[paper-1.20.4.jar:git-Paper-"dc62150"]
        at io.papermc.paper.chunk.system.scheduling.ChunkUpgradeGenericStatusTask.run(ChunkUpgradeGenericStatusTask.java:86) ~[paper-1.20.4.jar:git-Paper-"dc62150"]
        ... 5 more
>....
Plugin and Datapack List

N/A

Actions to reproduce (if known)

No response

Paper version

This server is running Paper version git-Paper-"dc62150" (MC: 1.20.4) (Implementing API version 1.20.4-R0.1-SNAPSHOT) (Git: dc62150)

Other

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the stack trace at io.papermc.paper.util.TickThread.ensureTickThread, PoiManager.exists, and ServerLevel.onBlockStateChange, then trace the chunk-generation path through ChunkGenerator and ChunkUpgradeGenericStatusTask. Reproduce the reported off-main-thread POI access during restart or generation, and determine whether the access can be prevented or otherwise handled without the error.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.