Server hang when crafting stack through terminal
repvik opened this issue ยท 3 comments
Issue type:
- ๐ Performance issue
Short description:
Attempting to craft a stack of "Block of Crystalized menril" causes the server to hang for > 30 seconds.
Steps to reproduce the problem:
Setup:
A chest, a mechanical squeezer, mechanical drying basin, a drawer controller and ~50 drawers connected in a network (Terminal says ~8.5k items in storage).
- Open terminal
- Attempt to craft a block of crystalized menril from chunks. (This works just fine)
- Attempt to craft a stack of blocks. (This makes server hang)
Versions:
- This mod: 1.12.2-1.0.12
- Minecraft: 1.12.2
- Forge: 14.23.5.2844
- All The Mods 3 Remix: 1.5.1
Profiler output:
Profiler while server was hanging (crafting 33 blocks, which was "fast" enough to not cause the server watchdog to trigger):
[10:16:04] [EntityProfiler/INFO] [TickProfiler]:
TPS: 13.894211
Single Entity | Time/Tick | %
monster.EntityZombie -47,16,119:0 | 0.152 | 1.442
PlantInteractorTile {37,65,26}:0 | 0.131 | 1.241
item.EntityItem 52,26,81:0 | 0.089 | 0.838
monster.EntityZombie -31,62,-82:0 | 0.073 | 0.695
passive.EntitySheep 121,69,31:0 | 0.067 | 0.630
Chunk | Time/Tick | %
0: 7, 2 | 2.069 | 19.575
0: 8, 2 | 0.557 | 5.269
0: 2, 1 | 0.460 | 4.356
0: 3, 0 | 0.325 | 3.077
0: 4, -2 | 0.266 | 2.521
All Entities of Type | Time/Tick | %
passive.EntitySheep | 1.695 | 16.034
monster.EntityZombie | 1.613 | 15.266
entity.EntityFrog | 1.156 | 10.934
passive.EntityCow | 1.141 | 10.797
monster.EntitySkeleton | 1.015 | 9.603
Average Entity of Type | Time/tick | Calls
PlantInteractorTile | 0.051 | 2502
monster.EntityZombie | 0.051 | 26548
TileMechanicalDryingBasin | 0.050 | 834
tile.TileContOreT1 | 0.044 | 834
monster.EntitySkeleton | 0.042 | 19932
Sampler, from when attempting to craft a full stack:
serverhang.zip
Spark profiler, from when attempting to craft a full stack:
https://sparkprofiler.github.io/#wPmAbJSSzR
Comparing crafting between AE2 and ID it looks like ID crafts one item at a time, fetching new items for each crafting action while AE2 crafts all at the same time using one fetching action.
Note to self for future reference:
While a more efficient solution would have been to move multiple items into the input slots, craft once, and multiply the output item. This would have resulted in incorrect recipe application in some edge-cases. For instance, some recipes will produce different items on every craft (e.g. entangled chalice). Furthermore, some input items may not be stackable (e.g. tanks).
The current solution optimizes the problem through recipe caching , which is as far as we can go without breaking recipe interface contracts.