Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

World generation crashes the server #52

Closed
masmc05 opened this issue Apr 19, 2023 · 4 comments
Closed

World generation crashes the server #52

masmc05 opened this issue Apr 19, 2023 · 4 comments
Labels
type: bug Something doesn't work as it was intended to. version: 1.19.4 Game version 1.19.4

Comments

@masmc05
Copy link

masmc05 commented Apr 19, 2023

Stack trace

paste your stack trace or a paste.gg link here!

https://mclo.gs/LwjfUMD

Plugin and Datapack List

[12:29:00 INFO]: Paper Plugins:
[12:29:00 INFO]: - MiniScoreBoard
[12:29:00 INFO]: Bukkit Plugins:
[12:29:00 INFO]: - Chatty, Chunky, CoreProtect, DiscordSRV, floodgate, FreedomChat, LuckPerms, spark, TAB, Vault
[12:29:00 INFO]: ViaBackwards, ViaVersion

Actions to reproduce (if known)

No response

Folia version

[12:29:13 INFO]: This server is running Folia version git-Folia-"41c5548" (MC: 1.19.4) (Implementing API version 1.19.4-R0.1-SNAPSHOT) (Git: 41c5548)
You are 2 version(s) behind
Download the new version at: https://papermc.io/downloads

Other

i'll try now to update to dddaab9 , but still wanted to report in case if that was not related to this

@masmc05
Copy link
Author

masmc05 commented Apr 20, 2023

[05:51:22] [Region Scheduler Thread #6/INFO]: Checking version, please wait...
[05:51:22] [Thread-66/INFO]: This server is running Folia version git-Folia-"dddaab9" (MC: 1.19.4) (Implementing API version 1.19.4-R0.1-SNAPSHOT) (Git: dddaab9)
You are running the latest version
Previous version: git-Folia-"41c5548" (MC: 1.19.4)

the crash still occurs

@masmc05
Copy link
Author

masmc05 commented Apr 20, 2023

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: masmc05 <masmc05@gmail.com>
Date: Thu, 20 Apr 2023 20:37:35 +0300
Subject: [PATCH] TempFix


diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
index 2fbfdf1fdba12417e2dbca041b9c7e29af27d02d..39408e5df67464843c6c37524ebf078f6fb9cc91 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
@@ -449,7 +449,7 @@ public abstract class ChunkGenerator {
                                 crashreportsystemdetails = crashreport1.addCategory("Feature");
                                 Objects.requireNonNull(supplier1);
                                 crashreportsystemdetails.setDetail("Description", supplier1::get);
-                                throw new ReportedException(crashreport1);
+                                //throw new ReportedException(crashreport1);
                             }
                         }
                     }

I'll pray that this won't break anything else, because it's a huge problem now, crashes became too often

@jpenilla
Copy link
Member

jpenilla commented Apr 22, 2023

@masmc05 Could you give this diff a try? I don't think we want to be accessing captured states from world gen threads (this is a CB issue and is probably present on Paper as well in the form of a thread safety issue instead of an error).

diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index f4c4951f8..2f94a2467 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -515,7 +515,7 @@ public class LevelChunk extends ChunkAccess {
                     return null;
                 } else {
                     // CraftBukkit - Don't place while processing the BlockPlaceEvent, unless it's a BlockContainer. Prevents blocks such as TNT from activating when cancelled.
-                    if (!this.level.isClientSide && doPlace && (!this.level.getCurrentWorldData().captureBlockStates || block instanceof net.minecraft.world.level.block.BaseEntityBlock)) { // Folia - region threading
+                    if (!this.level.isClientSide && doPlace && (!io.papermc.paper.util.TickThread.isTickThread() || !this.level.getCurrentWorldData().captureBlockStates || block instanceof net.minecraft.world.level.block.BaseEntityBlock)) { // Folia - region threading
                         iblockdata.onPlace(this.level, blockposition, iblockdata1, flag);
                     }
 
@@ -562,7 +562,7 @@ public class LevelChunk extends ChunkAccess {
     @Nullable
     public BlockEntity getBlockEntity(BlockPos pos, LevelChunk.EntityCreationType creationType) {
         // CraftBukkit start
-        BlockEntity tileentity = level.getCurrentWorldData().capturedTileEntities.get(pos); // Folia - region threading
+        BlockEntity tileentity = io.papermc.paper.util.TickThread.isTickThread() ? level.getCurrentWorldData().capturedTileEntities.get(pos) : null; // Folia - region threading
         if (tileentity == null) {
             tileentity = (BlockEntity) this.blockEntities.get(pos);
         }

@jpenilla jpenilla added type: bug Something doesn't work as it was intended to. and removed status: needs triage labels Apr 22, 2023
@Spottedleaf
Copy link
Member

The underlying issue is that the world state is being accessed by the world gen threads, which is unacceptable in the first place.

killerprojecte pushed a commit to killerprojecte/Folia that referenced this issue May 30, 2023
The returned TE may be in the world, in which case it is unsafe
for the current thread to modify or access its contents.

Fixes PaperMC#52
@kashike kashike added version: 1.19.4 Game version 1.19.4 and removed version: 1.19 labels Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something doesn't work as it was intended to. version: 1.19.4 Game version 1.19.4
Projects
None yet
Development

No branches or pull requests

4 participants