MovingBlocks / Terasology

Terasology - open source voxel world
http://terasology.org
Apache License 2.0
3.69k stars 1.34k forks source link

Race condition / bad initialization order during game start vs chunk generation #2385

Open Cervator opened 8 years ago

Cervator commented 8 years ago

This just happened as I was trying to test in a Heightmap world with the Sample module enabled, so nothing particularly unusual. The chunk I started in and a bunch around me failed to generate as a chunk generator thread died. Based on logs it appears like chunk gen started before all blocks were registered? Might specifically be an OakTrunk from a tree attempting to generate. That seems sort of odd and prone to problems if something in or near the starting chunk needs a block that hasn't finished registering yet.

Log snippet:

22:55:55.748 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:stone with id 25
22:55:55.755 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:water]
22:55:55.755 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:water with id 26
22:55:55.758 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:Ice]
22:55:55.758 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:Ice with id 27
22:55:55.764 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:Sand]
22:55:55.764 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:Sand with id 28
22:55:55.767 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:Grass]
22:55:55.767 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:Grass with id 29
22:55:55.771 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:Snow]
22:55:55.772 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:Snow with id 30
22:55:55.774 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:Dirt]
22:55:55.774 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:Dirt with id 31
22:55:55.941 [Chunk-Generator-0] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:OakTrunk]
22:55:55.941 [Chunk-Generator-0] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:OakTrunk with id 32
22:55:55.969 [Chunk-Generator-4] ERROR o.t.u.concurrency.TaskProcessor - Error in thread Chunk-Generator-4
java.lang.NullPointerException: null
    at org.terasology.world.block.loader.BlockFamilyDefinitionData.<init>(BlockFamilyDefinitionData.java:44)
    at org.terasology.world.block.loader.BlockFamilyDefinition.getData(BlockFamilyDefinition.java:67)
    at org.terasology.world.block.loader.BlockFamilyDefinitionFormat$BlockFamilyDefinitionDataHandler.createBaseData(BlockFamilyDefinitionFormat.java:311)
    at org.terasology.world.block.loader.BlockFamilyDefinitionFormat$BlockFamilyDefinitionDataHandler.deserialize(BlockFamilyDefinitionFormat.java:139)
    at org.terasology.world.block.loader.BlockFamilyDefinitionFormat$BlockFamilyDefinitionDataHandler.deserialize(BlockFamilyDefinitionFormat.java:130)
    at com.google.gson.TreeTypeAdapter.read(TreeTypeAdapter.java:58)
    at com.google.gson.Gson.fromJson(Gson.java:879)
    at com.google.gson.Gson.fromJson(Gson.java:817)
    at org.terasology.world.block.loader.BlockFamilyDefinitionFormat.load(BlockFamilyDefinitionFormat.java:95)
    at org.terasology.world.block.loader.BlockFamilyDefinitionFormat.load(BlockFamilyDefinitionFormat.java:69)
    at org.terasology.assets.module.UnloadedAssetData$AssetSourceResolver.load(UnloadedAssetData.java:292)
    at org.terasology.assets.module.UnloadedAssetData.load(UnloadedAssetData.java:180)
    at org.terasology.assets.module.ModuleAssetDataProducer.getAssetData(ModuleAssetDataProducer.java:228)
    at org.terasology.assets.AssetType.lambda$reload$1(AssetType.java:356)
    at org.terasology.assets.AssetType$$Lambda$73/330551672.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.terasology.assets.AssetType.reload(AssetType.java:354)
    at org.terasology.assets.AssetType.getNormalAsset(AssetType.java:383)
    at org.terasology.assets.AssetType.getAsset(AssetType.java:262)
    at org.terasology.assets.management.AssetManager.getAsset(AssetManager.java:223)
    at org.terasology.world.block.internal.BlockManagerImpl.loadFamily(BlockManagerImpl.java:266)
    at org.terasology.world.block.internal.BlockManagerImpl.getBlockFamily(BlockManagerImpl.java:248)
    at org.terasology.world.block.internal.BlockManagerImpl.getBlock(BlockManagerImpl.java:306)
    at org.terasology.core.world.generator.trees.TreeGeneratorLSystem.generate(TreeGeneratorLSystem.java:71)
    at org.terasology.core.world.generator.rasterizers.TreeRasterizer.generateChunk(TreeRasterizer.java:57)
    at org.terasology.world.generation.WorldImpl.rasterizeChunk(WorldImpl.java:64)
    at org.terasology.world.generation.BaseFacetedWorldGenerator.createChunk(BaseFacetedWorldGenerator.java:65)
    at org.terasology.world.chunks.localChunkProvider.LocalChunkProvider$1.run(LocalChunkProvider.java:634)
    at org.terasology.utilities.concurrency.TaskProcessor.run(TaskProcessor.java:50)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
22:55:55.977 [Chunk-Generator-2] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:Cactus]
22:55:55.977 [Chunk-Generator-2] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:Cactus with id 33
22:55:55.991 [Chunk-Generator-0] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:RedLeaf]
22:55:55.992 [Chunk-Generator-0] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:RedLeaf with id 34
22:55:56.002 [Chunk-Generator-4] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:PineTrunk]
22:55:56.003 [Chunk-Generator-4] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:PineTrunk with id 35
22:55:56.005 [Chunk-Generator-3] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:OakTrunk]
22:55:56.005 [Chunk-Generator-3] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:OakTrunk with id 36
22:55:56.014 [Chunk-Generator-4] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:DarkLeaf]
22:55:56.014 [Chunk-Generator-4] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:DarkLeaf with id 37
22:55:56.047 [Chunk-Generator-4] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:GreenLeaf]
22:55:56.047 [Chunk-Generator-4] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:GreenLeaf with id 38
22:55:57.498 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:chest]
22:55:57.498 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:chest.LEFT with id 39
22:55:57.498 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:chest.RIGHT with id 40
22:55:57.499 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:chest.FRONT with id 41

Screenie:

terasology-160628230149-1152x720

Edit: Linking to PR #2074 as I figure this might end up relating to how we go from the main menu to in-game (fully load and register things as part of the preview/configure stage?)

Cervator commented 8 years ago

Happened again, or something very similar (shapes?), this time on starting an Island World from the PolyWorld module. Again appears like chunk generation started too early before everything had finished registering:

21:31:34.389 [main] WARN  o.t.rendering.nui.asset.UIFormat - Field 'crosshairIcon' not recognized for interface org.terasology.rendering.nui.UIWidget in {"type":"UICrosshair","id":"crosshair","crosshairIcon":"engine:gui#crosshair","chargeStages":["engine:gui#crosshairCharge1","engine:gui#crosshairCharge2","engine:gui#crosshairCharge3","engine:gui#crosshairCharge4","engine:gui#crosshairCharge5","engine:gui#crosshairCharge6","engine:gui#crosshairCharge7","engine:gui#crosshairCharge8"],"layoutInfo":{"use-content-width":true,"use-content-height":true,"position-horizontal-center":{},"position-vertical-center":{}}}
21:31:34.556 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:stone]
21:31:34.556 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:stone with id 10
21:31:34.563 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:water]
21:31:34.563 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:water with id 11
21:31:34.567 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:Ice]
21:31:34.567 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:Ice with id 12
21:31:34.575 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:Sand]
21:31:34.575 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:Sand with id 13
21:31:34.577 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:Grass]
21:31:34.578 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:Grass with id 14
21:31:34.581 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:Snow]
21:31:34.581 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:Snow with id 15
21:31:34.585 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:Dirt]
21:31:34.585 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:Dirt with id 16
21:31:34.587 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[engine:air]
21:31:34.587 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block engine:air with id 17
21:31:34.595 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:TallGrass1]
21:31:34.596 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:TallGrass1 with id 18
21:31:34.598 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:TallGrass2]
21:31:34.599 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:TallGrass2 with id 19
21:31:34.600 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:TallGrass3]
21:31:34.601 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:TallGrass3 with id 20
21:31:34.603 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:Dandelion]
21:31:34.603 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:Dandelion with id 21
21:31:34.605 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:Glowbell]
21:31:34.606 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:Glowbell with id 22
21:31:34.608 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:Iris]
21:31:34.608 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:Iris with id 23
21:31:34.611 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:Lavender]
21:31:34.611 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:Lavender with id 24
21:31:34.614 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:RedClover]
21:31:34.614 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:RedClover with id 25
21:31:34.617 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:RedFlower]
21:31:34.617 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:RedFlower with id 26
21:31:34.620 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:Tulip]
21:31:34.620 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:Tulip with id 27
21:31:34.623 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:YellowFlower]
21:31:34.623 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:YellowFlower with id 28
21:31:34.626 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:BigBrownShroom]
21:31:34.626 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:BigBrownShroom with id 29
21:31:34.629 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:BrownShroom]
21:31:34.629 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:BrownShroom with id 30
21:31:34.632 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:RedShroom]
21:31:34.632 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:RedShroom with id 31
21:31:34.878 [main] INFO  o.t.p.graph.GraphFacetProvider - Created graph for (x=-168 y=-197 w=168 h=197) in 166ms.
21:31:34.944 [main] INFO  o.t.p.graph.GraphFacetProvider - Created graph for (x=-474 y=0 w=474 h=405) in 46ms.
21:31:34.974 [main] INFO  o.t.p.graph.GraphFacetProvider - Created graph for (x=0 y=-168 w=888 h=168) in 18ms.
21:31:34.987 [main] INFO  o.t.p.graph.GraphFacetProvider - Created graph for (x=0 y=0 w=474 h=102) in 5ms.
21:31:35.701 [Chunk-Generator-7] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:Cactus]
21:31:35.704 [Chunk-Generator-7] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:Cactus with id 32
21:31:35.755 [Chunk-Generator-1] ERROR o.t.u.concurrency.TaskProcessor - Error in thread Chunk-Generator-1
java.lang.NullPointerException: null
    at org.terasology.world.block.shapes.BlockShapeImpl.doReload(BlockShapeImpl.java:79)
    at org.terasology.world.block.shapes.BlockShapeImpl.doReload(BlockShapeImpl.java:44)
    at org.terasology.assets.Asset.reload(Asset.java:98)
    at org.terasology.assets.AssetType.loadAsset(AssetType.java:530)
    at org.terasology.assets.AssetType.lambda$reload$1(AssetType.java:358)
    at org.terasology.assets.AssetType$$Lambda$73/1663888181.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.terasology.assets.AssetType.reload(AssetType.java:354)
    at org.terasology.assets.AssetType.getNormalAsset(AssetType.java:383)
    at org.terasology.assets.AssetType.getAsset(AssetType.java:262)
    at org.terasology.assets.management.AssetManager.getAsset(AssetManager.java:223)
    at org.terasology.assets.management.AssetManager.getAsset(AssetManager.java:203)
    at org.terasology.assets.management.AssetManager.getAsset(AssetManager.java:187)
    at org.terasology.world.block.loader.BlockFamilyDefinitionFormat$AssetTypeAdapterFactory$1.read(BlockFamilyDefinitionFormat.java:371)
    at org.terasology.world.block.loader.BlockFamilyDefinitionFormat$AssetTypeAdapterFactory$1.read(BlockFamilyDefinitionFormat.java:354)
    at com.google.gson.Gson.fromJson(Gson.java:879)
    at com.google.gson.Gson.fromJson(Gson.java:944)
    at com.google.gson.Gson$1.deserialize(Gson.java:138)
    at org.terasology.world.block.loader.BlockFamilyDefinitionFormat$BlockFamilyDefinitionDataHandler.setObject(BlockFamilyDefinitionFormat.java:302)
    at org.terasology.world.block.loader.BlockFamilyDefinitionFormat$BlockFamilyDefinitionDataHandler.deserializeSectionDefinitionData(BlockFamilyDefinitionFormat.java:219)
    at org.terasology.world.block.loader.BlockFamilyDefinitionFormat$BlockFamilyDefinitionDataHandler.deserialize(BlockFamilyDefinitionFormat.java:147)
    at org.terasology.world.block.loader.BlockFamilyDefinitionFormat$BlockFamilyDefinitionDataHandler.deserialize(BlockFamilyDefinitionFormat.java:130)
    at com.google.gson.TreeTypeAdapter.read(TreeTypeAdapter.java:58)
    at com.google.gson.Gson.fromJson(Gson.java:879)
    at com.google.gson.Gson.fromJson(Gson.java:817)
    at org.terasology.world.block.loader.BlockFamilyDefinitionFormat.load(BlockFamilyDefinitionFormat.java:95)
    at org.terasology.world.block.loader.BlockFamilyDefinitionFormat.load(BlockFamilyDefinitionFormat.java:69)
    at org.terasology.assets.module.UnloadedAssetData$AssetSourceResolver.load(UnloadedAssetData.java:292)
    at org.terasology.assets.module.UnloadedAssetData.load(UnloadedAssetData.java:180)
    at org.terasology.assets.module.ModuleAssetDataProducer.getAssetData(ModuleAssetDataProducer.java:228)
    at org.terasology.assets.AssetType.lambda$reload$1(AssetType.java:356)
    at org.terasology.assets.AssetType$$Lambda$73/1663888181.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.terasology.assets.AssetType.reload(AssetType.java:354)
    at org.terasology.assets.AssetType.getNormalAsset(AssetType.java:383)
    at org.terasology.assets.AssetType.getAsset(AssetType.java:262)
    at org.terasology.assets.management.AssetManager.getAsset(AssetManager.java:223)
    at org.terasology.world.block.internal.BlockManagerImpl.loadFamily(BlockManagerImpl.java:264)
    at org.terasology.world.block.internal.BlockManagerImpl.getBlockFamily(BlockManagerImpl.java:246)
    at org.terasology.world.block.internal.BlockManagerImpl.getBlock(BlockManagerImpl.java:304)
    at org.terasology.core.world.generator.trees.TreeGeneratorCactus.generate(TreeGeneratorCactus.java:34)
    at org.terasology.core.world.generator.rasterizers.TreeRasterizer.generateChunk(TreeRasterizer.java:57)
    at org.terasology.world.generation.WorldImpl.rasterizeChunk(WorldImpl.java:64)
    at org.terasology.world.generation.BaseFacetedWorldGenerator.createChunk(BaseFacetedWorldGenerator.java:65)
    at org.terasology.world.chunks.localChunkProvider.LocalChunkProvider$1.run(LocalChunkProvider.java:634)
    at org.terasology.utilities.concurrency.TaskProcessor.run(TaskProcessor.java:50)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
21:31:36.388 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:chest]
21:31:36.388 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:chest.LEFT with id 33
21:31:36.388 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:chest.RIGHT with id 34
21:31:36.388 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:chest.FRONT with id 35
21:31:36.388 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:chest.BACK with id 36
21:31:36.392 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:companion]
21:31:36.392 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:companion with id 37
21:31:36.408 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:brick:engine:stair]
21:31:36.408 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:brick:engine:stair.LEFT with id 38
21:31:36.408 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:brick:engine:stair.RIGHT with id 39
21:31:36.409 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:brick:engine:stair.FRONT with id 40
21:31:36.409 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:brick:engine:stair.BACK with id 41
21:31:36.413 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:Tnt]
21:31:36.413 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:Tnt with id 42
21:31:36.436 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:brick]
21:31:36.436 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:brick with id 43
21:31:36.440 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:Plank]
21:31:36.440 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:Plank with id 44
21:31:36.453 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:lava]
21:31:36.453 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:lava with id 45
21:31:36.475 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:Torch]
21:31:36.475 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:Torch.TOP with id 46
21:31:36.475 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:Torch.LEFT with id 47
21:31:36.475 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:Torch.RIGHT with id 48
21:31:36.475 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:Torch.FRONT with id 49
21:31:36.476 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:Torch.BACK with id 50
21:31:36.620 [Chunk-Generator-3] INFO  o.t.p.graph.GraphFacetProvider - Created graph for (x=-1024 y=-1024 w=856 h=1024) in 137ms.
21:31:37.191 [Chunk-Generator-7] INFO  o.t.p.graph.GraphFacetProvider - Created graph for (x=0 y=-920 w=888 h=752) in 95ms.
21:31:37.196 [Chunk-Generator-4] INFO  o.t.p.graph.GraphFacetProvider - Created graph for (x=-168 y=-1024 w=168 h=827) in 214ms.
21:31:37.831 [Chunk-Generator-5] INFO  o.t.p.graph.GraphFacetProvider - Created graph for (x=0 y=102 w=588 h=922) in 58ms.
21:31:38.666 [Chunk-Generator-0] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:OakTrunk]
21:31:38.666 [Chunk-Generator-0] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:OakTrunk with id 51
21:31:38.670 [Chunk-Generator-0] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:GreenLeaf]
21:31:38.671 [Chunk-Generator-0] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:GreenLeaf with id 52
21:31:41.545 [Chunk-Generator-4] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:PineTrunk]
21:31:41.545 [Chunk-Generator-4] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:PineTrunk with id 53
21:31:41.548 [Chunk-Generator-4] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:DarkLeaf]
21:31:41.548 [Chunk-Generator-4] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:DarkLeaf with id 54
21:31:41.611 [Chunk-Generator-5] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:RedLeaf]
21:31:41.611 [Chunk-Generator-5] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:RedLeaf with id 55
21:32:39.116 [Engine-Task-Pool] INFO  o.t.rendering.opengl.PostProcessor - Screenshot 'Terasology-160802213238-1152x720.jpg' saved! 
21:32:42.100 [main] INFO  o.t.p.i.ReadWriteStorageManager - Saving - Creating game snapshot

terasology-160802213238-1152x720

Rest of the world was fine but the initial dead chunks didn't come back even after making distance to let the area unload then coming back:

terasology-160802213652-1152x720

After game restart the world loaded fine with the affected chunks regenerated and fully visible again.

skaldarnar commented 8 years ago

I encountered this once, too. I did not investigate further, but it's good to see this issue as a note.

GabrielXia commented 7 years ago

Hey, since I'll be out for days, note something here, hope it helpful for others who want to fix this bug. Here is the TimeLine before game began :

  1. Class LoadPrefabs
    • main registered some blocks like Core:DoorTop.LEFT
  2. Class InitialiseWorld :
    • chunkGenerator initialized, but these threads didn't work since there were no task in taskQueue
    • main registered block engine:unloaded
  3. Class InitialiseWorldGenerator
    • main registered some blocks like engine:air, core:TallGrass3
  4. Class SetupLocalPlayer
    • main added tasks to taskQueue
    • chunkGenerator began to work, they registered blocks
  5. Class AwaitCharacterSpawn
    • main registered some blocks like core:chest.FRONT,core:Tnt
    • chunkGenerator still registered two block before game began

It seems that the blocks causing bug could only be in AwaitCharacter ? Maybe this TimeLine didn't corresponde to the bug case since I did not encountered the bug :-(

Problems :

GabrielXia commented 7 years ago
20:35:07.518 [Chunk-Generator-6] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:Cactus]
20:35:07.518 [Chunk-Generator-6] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:Cactus with id 32
20:35:07.553 [Chunk-Generator-7] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:OakTrunk]
20:35:07.554 [Chunk-Generator-7] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:OakTrunk with id 33
20:35:07.585 [Chunk-Generator-2] ERROR o.t.u.concurrency.TaskProcessor - Error in thread Chunk-Generator-2
java.lang.NullPointerException: null
    at org.terasology.world.block.Block.setCollision(Block.java:629)
    at org.terasology.world.block.internal.BlockBuilder.constructCustomBlock(BlockBuilder.java:123)
    at org.terasology.world.block.internal.BlockBuilder.constructTransformedBlock(BlockBuilder.java:104)
    at org.terasology.world.block.family.HorizontalBlockFamilyFactory.createBlockFamily(HorizontalBlockFamilyFactory.java:53)
    at org.terasology.world.block.loader.BlockFamilyDefinition.createFamily(BlockFamilyDefinition.java:57)
    at org.terasology.world.block.internal.BlockManagerImpl.loadFamily(BlockManagerImpl.java:278)
    at org.terasology.world.block.internal.BlockManagerImpl.getBlockFamily(BlockManagerImpl.java:246)
    at org.terasology.world.block.internal.BlockManagerImpl.getBlock(BlockManagerImpl.java:304)
    at org.terasology.core.world.generator.trees.TreeGeneratorCactus.generate(TreeGeneratorCactus.java:34)
    at org.terasology.core.world.generator.rasterizers.TreeRasterizer.generateChunk(TreeRasterizer.java:57)
    at org.terasology.world.generation.WorldImpl.rasterizeChunk(WorldImpl.java:64)
    at org.terasology.world.generation.BaseFacetedWorldGenerator.createChunk(BaseFacetedWorldGenerator.java:65)
    at org.terasology.world.chunks.localChunkProvider.LocalChunkProvider$1.run(LocalChunkProvider.java:620)
    at org.terasology.utilities.concurrency.TaskProcessor.run(TaskProcessor.java:50)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
20:35:07.587 [Chunk-Generator-7] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:GreenLeaf]
20:35:07.587 [Chunk-Generator-7] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:GreenLeaf with id 34
20:35:07.951 [Chunk-Generator-2] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:PineTrunk]
20:35:07.952 [Chunk-Generator-2] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:PineTrunk with id 35
20:35:07.956 [Chunk-Generator-2] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:DarkLeaf]
20:35:07.956 [Chunk-Generator-2] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:DarkLeaf with id 36

Is that the same bug ? Encountered that in Heightmap world with the Sample module enabled. After that, game got stuck in the game loading interface(not crash, so no CR appeared).

Cervator commented 7 years ago

That does look pretty similar, yeah. Block registration still going after the crash.

I missed the earlier comment but after the complexities of this situation have kept piling up I wonder if it is a fix better saved for when we expand the stages between the main menu and appearing in-game.

Right now possibly too much stuff is happening at once - registration jumbled in with chunk generator threads. Part of GSOC item #2774 involves better segregating these stages so you'd probably have several UI steps like so:

  1. Pick your modules (exists)
  2. Pick your world based on what's available in the modules (exists)
  3. Load up a preview environment (can be skipped + existing world preview is buggy)
  4. Register all blocks etc that might be used during world generation*
  5. Register all world configuration options (like frequency of caves, height of mountains ..)
  6. Generate a 2D preview map of the world, allowing the user to tweak at config and regen
  7. Start generating actual chunks as the player readies for entering the world (optional: checkbox to enter world automatically when ready)
  8. Spawn the player and start playing

That would completely avoid this issue if you thus get block registration out of the way before generating a single chunk plus improve the overall process IMHO. You could also engage options like pre-generating a far larger part of the world before dropping in the player, if for instance you have a slow server and don't want a ton of lag while moving around.

However one - I am unsure how our lazy assigning of block ids factor into this. Not every possible block combination gets an id right away, since with the amount of shapes we support that could overflow the block id even as a short pretty easily. Maybe the issue here isn't* that block registration is still pending, but that new block combos have been found as part of world generation, and before those are fully registered an available chunk generator has attempted to rasterize a chunk into blocks.

Maybe we need to involve better BlockFamilies as well, so you might prepare all possible Blocks by name but not give out ids to every possible shape combo until needed.