menacher/java-game-server

NPE at MessageBufferProtocol.java:40

nikolaykuz opened this issue · 1 comments

Sometimes (not always) I see this error in log

Exception in thread "Lane[45]" java.lang.NullPointerException at org.menacheri.jetserver.protocols.impl.MessageBufferProtocol.applyProtocol(MessageBufferProtocol.java:40)
        at org.menacheri.jetserver.protocols.AbstractNettyProtocol.applyProtocol (AbstractNettyProtocol.java:50)

Line 40 is
pipeline.addLast("lengthDecoder", createLengthBasedFrameDecoder());

gameRoom is an instance of extended GameRoomSession, connectSession was not overriden.

//issue 9 at github
NettyUtils.clearPipeline(NettyUtils.getPipeLineOfConnection(request));

gameRoom.connectSession(request); //error in here

request is instance of PlayerSession. Do you need to delete NettyUtils.clearPipeline to avoid this error happening?

From looking at code I am not sure why this error is occurring. Let me try recreating it with some unit tests.