Server crash loop - at mekanism.common.multipart.PartSidedPipe.canConnectMutual
ProsperCraft opened this issue ยท 6 comments
After updating today to Allthemods 1.32 the server started to crashloop.
I too have discovered this error. I did a bit of checking in mekanism source as to why this is occurring.
It appears that despite the capability provider replying that the capability is there, it returns null when the capability is requested.
I would assume this is a fault in the provider or it could be that forge is not using the exact same checks in the get as in the has method...?
As an experienced developer (not minecraft), I have a suggestion that would have also avoided this bug.
I see in your PartSided.canConnectMutual that you first check to see if the capability is there and then get the capability. However, this is less efficient. Your essentially making capability checks twice, when your method wants to actually use the capability.
If you read the forge's interface docs. The hasCapability is a reduced version of getCapability. Likely the same check code. In my many years experience with has/get pairs like this, the has method is only intended to be called when you need to know if it has it but you don't need it now (similar to maps, you wouldn't do a contains and then a get as you'd look it up twice).
So to be quicker and more sure... It seems FAR more reasonable to rely of the getCapability's documented return of NULL when the capability does not exists. Thus you eliminate an additional check.
so after the getting the tile entity I would just do
IBlockableConnection blockableConnection = CapabilityUtils.getCapability(tile, Capabilities.BLOCKABLE_CONNECTION_CAPABILITY, side.getOpposite());
return (blockableConnection == null) ? false :
blockableConnection.canConnect(side.getOpposite());
I might try to test this next weekend if I get the time to setup the enviroment, haven't yet used forge for 1.10.2 (last modded with 1.6.4)
Same here with 1.10.2 v1.33 when I try to load my local saved game.
http://pastebin.com/gFLkGt6E
ok, my son was impatient... so I did it last night.
I see the fault is technically "extreme reactors" who's getCapability method must have a fault with its RF tap block.
However, I got his server running by building a version of mekanism using the more defensive and efficient capability requesting as I described earlier.
Since getCapability says the accessibility of a capability can change at any time, I would strongly suggest re-coding all gets with a null check. It will prevent the faults of other modders from crashing your mod.
Here is another crash - http://pastebin.com/CbQitAML
Players are reporting that the crash occurs when placing an ultimate universal Mekanism cable against an extreme reactor power tap.