Vexatos / Computronics

A ComputerCraft/OpenComputers addon mod.
121 stars 52 forks source link

Duplicate calls to CC attach/detach #273

Open LemADEC opened 5 years ago

LemADEC commented 5 years ago

As of Computronics-1.12.2-1.6.6.191-charset-wires, when the mod is present on our server with many mods, we can see multiple calls to attach the same computer to the same block. Without Computronics this doesn't happen.

As initially reported on CC-Tweaked, here https://github.com/SquidDev-CC/CC-Tweaked/issues/103 : with Computronics

[14:23:34] [Thread-85/INFO] [THAUMCRAFT]: Starting aura thread for dim -101
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]: java.lang.RuntimeException:
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at cr0s.warpdrive.block.TileEntityAbstractInterfaced.attach(TileEntityAbstractInterfaced.java:456)
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at pl.asie.computronics.api.multiperipheral.WrappedMultiPeripheral.attach(WrappedMultiPeripheral.java:43)
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at pl.asie.computronics.cc.multiperipheral.MultiPeripheral.attach(MultiPeripheral.java:98)
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at dan200.computercraft.core.apis.PeripheralAPI$PeripheralWrapper.attach(PeripheralAPI.java:86)
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at dan200.computercraft.core.apis.PeripheralAPI.startup(PeripheralAPI.java:346)
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at dan200.computercraft.core.computer.Computer.initLua(Computer.java:739)
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at dan200.computercraft.core.computer.Computer.access$1400(Computer.java:33)
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at dan200.computercraft.core.computer.Computer$1.execute(Computer.java:847)
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at dan200.computercraft.core.computer.ComputerThread$TaskRunner.run(ComputerThread.java:284)
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at java.lang.Thread.run(Thread.java:748)
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [warpdrive]: TileEntityShipCore 'Lemian' @ solarSystem (-40547 58 28465) Disconnected Attaching to dan200.computercraft.core.apis.PeripheralAPI$PeripheralWrapper@680d3e06 16 right
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [warpdrive]: TileEntityShipCore 'Lemian' @ solarSystem (-40547 58 28465) Connected Mounted lua.ComputerCraft/common to /warpdrive as /warpdrive
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [warpdrive]: TileEntityShipCore 'Lemian' @ solarSystem (-40547 58 28465) Connected Mounted lua.ComputerCraft/warpdriveShipCore to /warpdrive/ShipCore as /warpdrive/ShipCore
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [warpdrive]: TileEntityShipCore 'Lemian' @ solarSystem (-40547 58 28465) Connected Mounted lua.ComputerCraft/warpdriveShipCore/startup to /startup as /startup
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]: java.lang.RuntimeException:
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at cr0s.warpdrive.block.TileEntityAbstractInterfaced.attach(TileEntityAbstractInterfaced.java:456)
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at pl.asie.computronics.api.multiperipheral.WrappedMultiPeripheral.attach(WrappedMultiPeripheral.java:43)
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at pl.asie.computronics.cc.multiperipheral.MultiPeripheral.attach(MultiPeripheral.java:98)
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at dan200.computercraft.core.apis.PeripheralAPI$PeripheralWrapper.attach(PeripheralAPI.java:86)
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at dan200.computercraft.core.apis.PeripheralAPI.startup(PeripheralAPI.java:346)
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at dan200.computercraft.core.computer.Computer.initLua(Computer.java:739)
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at dan200.computercraft.core.computer.Computer.access$1400(Computer.java:33)
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at dan200.computercraft.core.computer.Computer$1.execute(Computer.java:847)
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at dan200.computercraft.core.computer.ComputerThread$TaskRunner.run(ComputerThread.java:284)
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at java.lang.Thread.run(Thread.java:748)
[14:23:34] [ComputerCraft-Computer-Runner-0/ERROR] [warpdrive]: TileEntityShipCore 'Lemian' @ solarSystem (-40547 58 28465) Connected Already attached to dan200.computercraft.core.apis.PeripheralAPI$PeripheralWrapper@680d3e06 16 right, ignoring...
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]: java.lang.RuntimeException:
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at cr0s.warpdrive.block.TileEntityAbstractInterfaced.attach(TileEntityAbstractInterfaced.java:456)
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at pl.asie.computronics.api.multiperipheral.WrappedMultiPeripheral.attach(WrappedMultiPeripheral.java:43)
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at pl.asie.computronics.cc.multiperipheral.MultiPeripheral.attach(MultiPeripheral.java:98)
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at dan200.computercraft.core.apis.PeripheralAPI$PeripheralWrapper.attach(PeripheralAPI.java:86)
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at dan200.computercraft.core.apis.PeripheralAPI.startup(PeripheralAPI.java:346)
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at dan200.computercraft.core.computer.Computer.initLua(Computer.java:739)
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at dan200.computercraft.core.computer.Computer.access$1400(Computer.java:33)
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at dan200.computercraft.core.computer.Computer$1.execute(Computer.java:847)
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at dan200.computercraft.core.computer.ComputerThread$TaskRunner.run(ComputerThread.java:284)
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at java.lang.Thread.run(Thread.java:748)
[14:23:34] [ComputerCraft-Computer-Runner-0/ERROR] [warpdrive]: TileEntityShipCore 'Lemian' @ solarSystem (-40547 58 28465) Connected Already attached to dan200.computercraft.core.apis.PeripheralAPI$PeripheralWrapper@680d3e06 16 right, ignoring...
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]: java.lang.RuntimeException:
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at cr0s.warpdrive.block.TileEntityAbstractInterfaced.attach(TileEntityAbstractInterfaced.java:456)
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at pl.asie.computronics.api.multiperipheral.WrappedMultiPeripheral.attach(WrappedMultiPeripheral.java:43)
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at pl.asie.computronics.cc.multiperipheral.MultiPeripheral.attach(MultiPeripheral.java:98)
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at dan200.computercraft.core.apis.PeripheralAPI$PeripheralWrapper.attach(PeripheralAPI.java:86)
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at dan200.computercraft.core.apis.PeripheralAPI.startup(PeripheralAPI.java:346)
[14:23:34] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at dan200.computercraft.core.computer.Computer.initLua(Computer.java:739)
...

without Computronics

[14:41:15] [Thread-69/INFO] [THAUMCRAFT]: Starting aura thread for dim -101
[14:41:16] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]: java.lang.RuntimeException:
[14:41:16] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at cr0s.warpdrive.block.TileEntityAbstractInterfaced.attach(TileEntityAbstractInterfaced.java:456)
[14:41:16] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at dan200.computercraft.core.apis.PeripheralAPI$PeripheralWrapper.attach(PeripheralAPI.java:86)
[14:41:16] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at dan200.computercraft.core.apis.PeripheralAPI.startup(PeripheralAPI.java:346)
[14:41:16] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at dan200.computercraft.core.computer.Computer.initLua(Computer.java:739)
[14:41:16] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at dan200.computercraft.core.computer.Computer.access$1400(Computer.java:33)
[14:41:16] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at dan200.computercraft.core.computer.Computer$1.execute(Computer.java:847)
[14:41:16] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at dan200.computercraft.core.computer.ComputerThread$TaskRunner.run(ComputerThread.java:284)
[14:41:16] [ComputerCraft-Computer-Runner-0/INFO] [STDERR]: [cr0s.warpdrive.block.TileEntityAbstractInterfaced:attach:456]:     at java.lang.Thread.run(Thread.java:748)
[14:41:16] [ComputerCraft-Computer-Runner-0/INFO] [warpdrive]: TileEntityShipCore 'Lemian' @ solarSystem (-40547 58 28465) Disconnected Attaching to dan200.computercraft.core.apis.PeripheralAPI$PeripheralWrapper@419e3dba 16 right
[14:41:16] [ComputerCraft-Computer-Runner-0/INFO] [warpdrive]: TileEntityShipCore 'Lemian' @ solarSystem (-40547 58 28465) Connected Mounted lua.ComputerCraft/common to /warpdrive as /warpdrive
[14:41:16] [ComputerCraft-Computer-Runner-0/INFO] [warpdrive]: TileEntityShipCore 'Lemian' @ solarSystem (-40547 58 28465) Connected Mounted lua.ComputerCraft/warpdriveShipCore to /warpdrive/ShipCore as /warpdrive/ShipCore
[14:41:16] [ComputerCraft-Computer-Runner-0/INFO] [warpdrive]: TileEntityShipCore 'Lemian' @ solarSystem (-40547 58 28465) Connected Mounted lua.ComputerCraft/warpdriveShipCore/startup to /startup as /startup
[14:41:17] [ComputerCraft-Coroutine-2/INFO] [warpdrive]: [CC] LUA call from 16:right @ solarSystem (-40547 58 28465) to warpdriveShipCore.isInterfaced()

So far, I wasn't able to reproduced in single player nor in dev space SMP with fewer mods.

Vexatos commented 5 years ago

The only thing I can think of is that your mod somehow has multiple registered IPeripheralProviders that return the same thing, that method would only be called multiple times if the peripheral containing it appears in the list of peripherals multiple times, meaning there are multiple providers returning it.

LemADEC commented 5 years ago

Why would it be called multiple times only in presence of Computronics? My single IPeripheralProvider is only registered once, during FMLPostInitialization. My provider always return the same thing, which is the tile entity at the location.

Vexatos commented 5 years ago

Because Computronics calls every registered IPeripheralProvider, while normal ComputerCraft only calls them until one returns anything other than null, and then stops. For this exact thing to be called multiple times, either ComputerCraft must call it multiple times, or the provider is registered multiple times. It cannot really be the former, that would cause issues with practically every mod, including Computronics itself, if it were the case.

LemADEC commented 5 years ago

There's a total of 46 calls instead of 1. That's 45 extras. Could it be another mod registering IPeripheralProvider for my blocks? Could it be related to my blocks supporting both CC and OC? Any logs, option or something we could do to narrow down where the 45 extras are coming from?

Vexatos commented 5 years ago

You could always try to reproduce it with only your mod, CC, and Computronics first, and then keep adding mods interacting with CC until it happens. If it happens with only those three mods it's likely to be something on your end.

All blocks in Computronics also support both CC and OC, and they are not experiencing this.

LemADEC commented 5 years ago

It's a large modpack producing an issue in SMP only. Brute force removing mods to try to find the rootcause is fairly inefficient. This is why I came here asking for help to understand your mod and eventually instrument it.

Selim042 commented 5 years ago

Add half of the remaining missing mods at a time until you get the issue, then remove half until you find the most causing issues.

SquidDev commented 5 years ago

I guess the other thing to try would be copying a few chunks surrounding a problematic tile and trying to reproduce on a local server. SMP bugs are the worst to reproduce, but sometimes it's the only way :/.

LemADEC commented 5 years ago

So there's really no way to tell me where to put a log listing which mod registered which provider and provided 45 of those?