You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[0.8.2a] Inserting ME disk items into AE2 allocates a CC computer ID and fsyncs on the main thread #856
Inserting the AP "ME disk" cell item (AEDiskCellItem) into AE2 storage stalls the server thread (~0.4 s per insert on our test machine, SSD-backed VM).
When AE2 inserts an item into a cell, BasicCellInventory.innerInsert asks StorageCells.getCellInventory(stack, null) whether the item is itself a cell. AEDiskHandler.getCellInventory then constructs a new AEDiskCellStorage, which calls AEDiskMedia.createDataMount → NonNegativeId.getOrCreate → ComputerCraftAPI.createUniqueNumberedSaveDir → IDAssigner.getNextId, which does a FileChannel.force (fsync). So every such check allocates a new CC computer ID and fsyncs on the main thread:
at sun.nio.ch.UnixFileDispatcherImpl.force0(Native Method)
at sun.nio.ch.FileChannelImpl.force(FileChannelImpl.java:525)
at dan200.computercraft.shared.util.IDAssigner.getNextId(IDAssigner.java:58)
at dan200.computercraft.shared.computer.core.ServerContext.getNextId(ServerContext.java:177)
at dan200.computercraft.impl.AbstractComputerCraftAPI.createUniqueNumberedSaveDir(AbstractComputerCraftAPI.java:71)
at dan200.computercraft.shared.util.NonNegativeId.getOrCreate(NonNegativeId.java:50)
at de.srendi.advancedperipherals.common.addons.ae2.disk.AEDiskMedia.createDataMount(AEDiskMedia.java:40)
at de.srendi.advancedperipherals.common.addons.ae2.disk.AEDiskCellStorage.<init>(AEDiskCellStorage.java:34)
at de.srendi.advancedperipherals.common.addons.ae2.disk.AEDiskHandler.getCellInventory(AEDiskHandler.java:27)
at appeng.api.storage.StorageCells.getCellInventory(StorageCells.java:119)
at appeng.me.cells.BasicCellInventory.innerInsert(BasicCellInventory.java:368)
at appeng.me.cells.BasicCellInventory.insert(BasicCellInventory.java:351)
at appeng.me.storage.NetworkStorage.insert(NetworkStorage.java:132)
The ID (and the save directory) should probably be created lazily, only when the disk is actually mounted by a computer, not when a cell inventory is merely constructed.
Steps to reproduce
Insert ME disk items into an ME network repeatedly (e.g. with an import bus).
Watch MSPT / take a spark profile: time is spent in IDAssigner.getNextId, and the computercraft ID counter keeps growing.
Multiplayer?
Yes
Version
1.21.1-0.8.2a (Latest 1.21.1)
Minecraft, Forge and maybe other related mods versions
The same disk, not an infinite source. It only happens with blank disks (no disk ID yet).
BasicCellInventory.innerInsert does itemKey.toStack() and passes that copy to StorageCells.getCellInventory(stack, null), so NonNegativeId.getOrCreate writes the new ID onto a throwaway stack. The key that actually gets stored is still a blank disk, so every insert of it (simulated ones too) allocates a fresh ID and fsyncs ids.json. Extract it and insert it again and it happens again.
My repro was just a test harness inserting/extracting the same blank ME disk keys through the network storage in a loop. After a few runs computercraft/ids.json was at "disk": 31672. A disk that already has an ID doesn't bump the counter, it just builds the mount again.
Activity
zyxkad commentedon Oct 22, 2026
For "keeps growing", do you mean you can insert the same disk repeatedly and grow the ID, or are you just getting disk from an inifite item source.
dargabi commentedon Oct 22, 2026
The same disk, not an infinite source. It only happens with blank disks (no disk ID yet).
BasicCellInventory.innerInsertdoesitemKey.toStack()and passes that copy toStorageCells.getCellInventory(stack, null), soNonNegativeId.getOrCreatewrites the new ID onto a throwaway stack. The key that actually gets stored is still a blank disk, so every insert of it (simulated ones too) allocates a fresh ID and fsyncsids.json. Extract it and insert it again and it happens again.My repro was just a test harness inserting/extracting the same blank ME disk keys through the network storage in a loop. After a few runs
computercraft/ids.jsonwas at"disk": 31672. A disk that already has an ID doesn't bump the counter, it just builds the mount again.prevent create new cc disk on fake insertion