RFTools

RFTools

74M Downloads

Time-out connecting to server with NPE

dzrw opened this issue ยท 16 comments

commented

I'm running into a timeout problem when connecting to a server which I believe this is related to #136 -- an issue that was closed without resolution. I've spent days trying to figure out what's going on -- attempting to search for Unexpected packet during modded negotiation leads to a dead-end of people claiming that the Forge versions are mismatched: I assure you that that is not the problem here (my server and client are built from the same custom mod library).

However, #136 mentions that a mismatch between the server and client config might be responsible for generating the NPE in mcjty.rftools.dimension.RfToolsDimensionManager.unregisterDimensions which in turn might cause the connection issues.

If that's the case, would you perform a null check and print out a more helpful message to the logs?

The vulnerability is the unchecked usage of instance here. The proximate cause is most likely that RfToolsDimensionManager.getDimensionManager has not been invoked in this pathway (due to a configuration conflict somewhere else?). The reliance on a static instance variable that defaults to null is a code smell -- is there a standard dependency injection framework / IoC container for Minecraft/Java? That's the standard way of solving the singleton initialization problem. I'll dig around and try to figure out whether/if there is a configuration check that prevents a read on getDimensionManager. I'm happy to help you track down this bug to a particular line of code, but I've noticed that maintainers tend to find dubious reasons to not accept PRs to their mods in a timely fashion, so I'll let you actually fix it. No offense.

My server logs contain the following lines:

[03:06:05] [Netty IO #4/INFO] [FML]: Client protocol version 2
[03:06:05] [Netty IO #4/INFO] [FML]: Client attempting to join with 93 mods : [email protected],MineFactoryReloaded|[email protected],[email protected],[email protected],[email protected],BuildCraft|[email protected],[email protected],appliedenergistics2-core@rv2-stable-10,[email protected],[email protected],[email protected],[email protected],BuildCraft|[email protected],[email protected],[email protected],MineFactoryReloaded|[email protected],[email protected],[email protected],NEIAddons|[email protected],MineFactoryReloaded|[email protected],[email protected],[email protected],journeymap@@JMVERSION@,appliedenergistics2@rv2-stable-10,BuildCraft|[email protected],MineFactoryReloaded|[email protected],MineFactoryReloaded|[email protected],MineFactoryReloaded|[email protected],[email protected],MineFactoryReloaded|[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],BuildCraft|[email protected],[email protected],MineFactoryReloaded|[email protected],MineFactoryReloaded|[email protected],NEIAddons|[email protected],MineFactoryReloaded|[email protected],[email protected],[email protected],MineFactoryReloaded|[email protected],MineFactoryReloaded|[email protected],[email protected],MineFactoryReloaded|[email protected],[email protected],[email protected],[email protected],BuildCraft|[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],NEIAddons|[email protected],[email protected],[email protected],MineFactoryReloaded|[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],MineFactoryReloaded|[email protected],BuildCraft|[email protected],[email protected],MineFactoryReloaded|[email protected],MineFactoryReloaded|[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],NEIAddons|[email protected],[email protected],BuildCraft|[email protected],[email protected],[email protected],[email protected],<CoFH ASM>@000,NEIAddons|[email protected],NEIAddons|[email protected],[email protected],[email protected],BuildCraft|[email protected],MineFactoryReloaded|[email protected]
[03:06:05] [Netty IO #4/INFO] [FML]: Attempting connection with missing mods [] at CLIENT
[03:06:07] [Netty IO #4/INFO] [FML]: Unexpected packet during modded negotiation - assuming vanilla or keepalives : net.minecraft.network.play.client.C00PacketKeepAlive

On the client, I see the following logs:

[20:08:21] [Netty Client IO #5/INFO] [FML/]: Unexpected packet during modded negotiation - assuming vanilla or keepalives : net.minecraft.network.play.server.S00PacketKeepAlive
[20:08:41] [Netty Client IO #5/ERROR] [FML/]: NetworkDispatcher exception
io.netty.handler.timeout.ReadTimeoutException
[20:08:41] [Netty Client IO #5/INFO] [mcjty.rftools.RFTools/]: Disconnect from server: Unregistering RFTools dimensions
[20:08:41] [Netty Client IO #5/ERROR] [FML/]: Exception caught during firing event cpw.mods.fml.common.network.FMLNetworkEvent$ClientDisconnectionFromServerEvent@20eed083:
java.lang.NullPointerException
    at mcjty.rftools.dimension.RfToolsDimensionManager.unregisterDimensions(RfToolsDimensionManager.java:96) ~[RfToolsDimensionManager.class:?]
    at mcjty.rftools.ClientDisconnectEvent.onDisconnectedFromServerEvent(ClientDisconnectEvent.java:13) ~[ClientDisconnectEvent.class:?]
    at cpw.mods.fml.common.eventhandler.ASMEventHandler_552_ClientDisconnectEvent_onDisconnectedFromServerEvent_ClientDisconnectionFromServerEvent.invoke(.dynamic) ~[?:?]
    at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) ~[ASMEventHandler.class:?]
    at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:138) [EventBus.class:?]
    at cpw.mods.fml.common.network.handshake.NetworkDispatcher.close(NetworkDispatcher.java:405) [NetworkDispatcher.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.invokeClose(DefaultChannelHandlerContext.java:560) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.close(DefaultChannelHandlerContext.java:545) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.close(DefaultChannelHandlerContext.java:423) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelPipeline.close(DefaultChannelPipeline.java:826) [DefaultChannelPipeline.class:?]
    at io.netty.channel.AbstractChannel.close(AbstractChannel.java:177) [AbstractChannel.class:?]
    at net.minecraft.network.NetworkManager.func_150718_a(NetworkManager.java:230) [ej.class:?]
    at net.minecraft.network.NetworkManager.exceptionCaught(NetworkManager.java:104) [ej.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.invokeExceptionCaught(DefaultChannelHandlerContext.java:275) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.fireExceptionCaught(DefaultChannelHandlerContext.java:253) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.ChannelInboundHandlerAdapter.exceptionCaught(ChannelInboundHandlerAdapter.java:131) [ChannelInboundHandlerAdapter.class:?]
    at cpw.mods.fml.common.network.handshake.NetworkDispatcher.exceptionCaught(NetworkDispatcher.java:487) [NetworkDispatcher.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.invokeExceptionCaught(DefaultChannelHandlerContext.java:275) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.fireExceptionCaught(DefaultChannelHandlerContext.java:253) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.ChannelHandlerAdapter.exceptionCaught(ChannelHandlerAdapter.java:61) [ChannelHandlerAdapter.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.invokeExceptionCaught(DefaultChannelHandlerContext.java:275) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.fireExceptionCaught(DefaultChannelHandlerContext.java:253) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.ChannelHandlerAdapter.exceptionCaught(ChannelHandlerAdapter.java:61) [ChannelHandlerAdapter.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.invokeExceptionCaught(DefaultChannelHandlerContext.java:275) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.fireExceptionCaught(DefaultChannelHandlerContext.java:253) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.ChannelHandlerAdapter.exceptionCaught(ChannelHandlerAdapter.java:61) [ChannelHandlerAdapter.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.invokeExceptionCaught(DefaultChannelHandlerContext.java:275) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.fireExceptionCaught(DefaultChannelHandlerContext.java:253) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.ChannelInboundHandlerAdapter.exceptionCaught(ChannelInboundHandlerAdapter.java:131) [ChannelInboundHandlerAdapter.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.invokeExceptionCaught(DefaultChannelHandlerContext.java:275) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.fireExceptionCaught(DefaultChannelHandlerContext.java:253) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.ChannelInboundHandlerAdapter.exceptionCaught(ChannelInboundHandlerAdapter.java:131) [ChannelInboundHandlerAdapter.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.invokeExceptionCaught(DefaultChannelHandlerContext.java:275) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.fireExceptionCaught(DefaultChannelHandlerContext.java:253) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.ChannelInboundHandlerAdapter.exceptionCaught(ChannelInboundHandlerAdapter.java:131) [ChannelInboundHandlerAdapter.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.invokeExceptionCaught(DefaultChannelHandlerContext.java:275) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.fireExceptionCaught(DefaultChannelHandlerContext.java:253) [DefaultChannelHandlerContext.class:?]
    at io.netty.handler.timeout.ReadTimeoutHandler.readTimedOut(ReadTimeoutHandler.java:185) [ReadTimeoutHandler.class:?]
    at io.netty.handler.timeout.ReadTimeoutHandler$ReadTimeoutTask.run(ReadTimeoutHandler.java:211) [ReadTimeoutHandler$ReadTimeoutTask.class:?]
    at io.netty.util.concurrent.PromiseTask$RunnableAdapter.call(PromiseTask.java:38) [PromiseTask$RunnableAdapter.class:?]
    at io.netty.util.concurrent.ScheduledFutureTask.run(ScheduledFutureTask.java:123) [ScheduledFutureTask.class:?]
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:354) [SingleThreadEventExecutor.class:?]
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:348) [NioEventLoop.class:?]
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101) [SingleThreadEventExecutor$2.class:?]
    at java.lang.Thread.run(Thread.java:745) [?:1.8.0_45]
[20:08:41] [Netty Client IO #5/ERROR] [FML/]: Index: 4 Listeners:
[20:08:41] [Netty Client IO #5/ERROR] [FML/]: 0: NORMAL
[20:08:41] [Netty Client IO #5/ERROR] [FML/]: 1: ASM: org.dave.CompactMachines.handler.CMEventHandler@5b3d9031 onClientDisconnect(Lcpw/mods/fml/common/network/FMLNetworkEvent$ClientDisconnectionFromServerEvent;)V
[20:08:41] [Netty Client IO #5/ERROR] [FML/]: 2: ASM: crazypants.enderio.machine.hypercube.ConnectionHandler@75a3f143 onDisconnectedFromServer(Lcpw/mods/fml/common/network/FMLNetworkEvent$ClientDisconnectionFromServerEvent;)V
[20:08:41] [Netty Client IO #5/ERROR] [FML/]: 3: ASM: crazypants.enderio.machine.transceiver.ConnectionHandler@60b163fa onDisconnectedFromServer(Lcpw/mods/fml/common/network/FMLNetworkEvent$ClientDisconnectionFromServerEvent;)V
[20:08:41] [Netty Client IO #5/ERROR] [FML/]: 4: ASM: mcjty.rftools.ClientDisconnectEvent@23c78acf onDisconnectedFromServerEvent(Lcpw/mods/fml/common/network/FMLNetworkEvent$ClientDisconnectionFromServerEvent;)V
[20:08:41] [Netty Client IO #5/ERROR] [FML/]: 5: ASM: tonius.simplyjetpacks.handler.SyncHandler@26ccd910 onClientDisconnectedFromServer(Lcpw/mods/fml/common/network/FMLNetworkEvent$ClientDisconnectionFromServerEvent;)V
commented

I am also experiencing this on our server. It is a very large modpack, so we were trying to think what else could be causing a conflict based on what mods we have different compared to some of the other popular modpacks out there. One that we have that is different that uses additional dimensions is compact machines which I also notice listed in the modpack above. When I get some more time I will try troubleshooting more to see if it is related to the combination of those two mods, but just figured I would add this note here in case anyone else gets chance to test that on their server before me. On our server we are currently using forge 1481.

commented

Ok, so I did finally get to try removing compact machines and re-enabling rftools. Still getting the timed-out issue, so it looks like it is not related to a conflict between these two after all.

commented

I solved this problem by copying Mobius Core and opis from server to client.

What's strange is that I believe I have opis on server but not client at first and the server worked fine. After I modified some cfg files with worldgen the problem happened. I guess it's related with the mapwriter implemented by opis.

Edit: Opis is not necessary, only Mobius Core.

commented

The immediate issue is in RFTools and it's caused me quite some annoyance trying to debug disconnect issues.

The initialization is obviously not finished as per #285 (comment) since the disconnect event may fire very early for any auxiliary issue while connecting. The event is being fired from the network pipeline's exception handler, so it has to be expected before any other.

commented

Well I have no advice to give on this issue as I have absolutely no clue what is going on here and I cannot reproduce this in any way.

commented

However, I suppose I could add a null check though

commented

@McJty this bug is appeared to me too, and even if not RFTools causes the crash, this crash hides the real connection problem and prevents MineCraft to throw the real exception. Please reopen this issue and give us an advice what could go wrong here, since this excepton gives absolute no point for users what's wrong. More descriptive exception or throwing the original exception would be better than this NPE.

No Opis/MobiusCore affected on my Side, RFTools 4.13, slightly modded Project Ozone pack.

commented

@McJty I'd really appreciate if you can.

commented

Hmm. I have the feeling this bug may be caused by something else going wrong and because of that RFTools crashing because some parts haven't been initialized correctly (like that instance). Do you happen to have a full log?

commented

I had the same problem. The modpack was built with forge 1448, but when I update to forge 1492, the problem disappears.

commented

I haven't had a chance to get back to this and generate a full log, but I did want to jump on and mention that I'm running Forge 1448. Thanks for the tip @MrBenji285, I'll try to update to 1492 - that might be a "quick fix" that fixes the immediate problem.

It would be interesting to me to figure out what fixed the issue between 1492 and 1448. The idea that @McJty's mods are not being initialized correctly due to a bug in the middleware has got to be frustrating.

commented

I encountered a similar Issue with Forge 1492 too on my server. The server runs but none of us can connect to it and get a time out. This is the part of the client log http://pastebin.com/bryhAMgJ

commented

Why exactly do you suspect RFTools is at fault here (to Soro300)? I see nothing in that log indicating that.

commented

at mcjty.rftools.dimension.RfToolsDimensionManager.unregisterDimensions(RfToolsDimensionManager.java:96) ~[RfToolsDimensionManager.class:?]
at mcjty.rftools.ClientDisconnectEvent.onDisconnectedFromServerEvent(ClientDisconnectEvent.java:14) ~[ClientDisconnectEvent.class:?]

commented

Hmm yes I missed that. But even so that code is called when a client disconnects. So that means this crash is actually a symptom of the problem and not the cause. i.e. because of something causing a timeout this causes the client to disconnect and this causes RFTools to try to unregister that client. Apparently something got corrupted so it fails to do so. Seems a number of things are going wrong here. Can you describe what has happened before this event? Anything special? Are you in rftools dimensions?

commented

no the problem is I just set the server up I already fixed a few things and got the server running but now everyone gets a time out.