zelytra / BetterFleet

BetterFleet is an innovative, open-source application to help you find an alliance with other players
https://betterfleet.fr
Other
15 stars 2 forks source link

Soft locking the application Null player ? #322

Closed zelytra closed 3 months ago

zelytra commented 3 months ago

Summary

The application throw in continue NPE when an event append

Steps to reproduce

Need investigation

What is the current bug behavior?

Locking completly the backend

What is the expected correct behavior?

Backend run normaly

Relevant logs and/or screenshots

2024-07-21 12:06:04,828 WARN  [fr.zel.ses.SessionSocket] (pool-483-thread-1) [UNDEFINED PLAYER] Disconnected
2024-07-21 12:06:05,267 INFO  [fr.zel.ses.SessionSocket] (vert.x-eventloop-thread-0) [ANYONE] Connecting...
2024-07-21 12:06:05,585 INFO  [fr.zel.ses.SessionSocket] (vert.x-eventloop-thread-0) [null] Connected !
2024-07-21 12:06:05,585 INFO  [fr.zel.ses.SessionManager] (vert.x-eventloop-thread-0) [EDACC54] null Join the session !
2024-07-21 12:06:06,362 INFO  [fr.zel.ses.SessionSocket] (vert.x-eventloop-thread-3) [ebz] Data updated for session !
2024-07-21 12:06:10,269 INFO  [fr.zel.ses.SessionSocket] (vert.x-eventloop-thread-4) [foxeur29] Data updated for session !
2024-07-21 12:06:11,674 INFO  [fr.zel.ses.SessionSocket] (vert.x-eventloop-thread-2) [dudumalice] Data updated for session !
2024-07-21 12:06:13,836 INFO  [fr.zel.ses.SessionSocket] (vert.x-eventloop-thread-0) [dimit0r] Data updated for session !
2024-07-21 12:06:18,549 INFO  [fr.zel.ses.SessionSocket] (vert.x-eventloop-thread-2) [whiteandsalty] Data updated for session !
2024-07-21 12:06:31,030 INFO  [fr.zel.ses.SessionSocket] (vert.x-eventloop-thread-0) [dioxydecarb] Data updated for session !
2024-07-21 12:06:41,532 ERROR [fr.zel.ses.SessionSocket] (vert.x-eventloop-thread-0) WebSocket error for session 58OA4vuMTfksSttUqsByEGS0xh-JA32hPeldksDp: java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because the return value of "fr.zelytra.session.player.Player.getUsername()" is null
2024-07-21 12:06:41,535 ERROR [fr.zel.ses.SessionSocket] (vert.x-eventloop-thread-0) WebSocket error for session 58OA4vuMTfksSttUqsByEGS0xh-JA32hPeldksDp: java.lang.RuntimeException: java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because the return value of "fr.zelytra.session.player.Player.getUsername()" is null
2024-07-21 12:06:41,535 ERROR [fr.zel.ses.SessionSocket] (vert.x-eventloop-thread-0) WebSocket error for session 58OA4vuMTfksSttUqsByEGS0xh-JA32hPeldksDp: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because the return value of "fr.zelytra.session.player.Player.getUsername()" is null
2024-07-21 12:06:41,535 WARN  [io.net.cha.AbstractChannelHandlerContext] (vert.x-eventloop-thread-0) An exception 'java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because the return value of "fr.zelytra.session.player.Player.getUsername()" is null' [enable DEBUG level for full stacktrace] was thrown by a user handler's exceptionCaught() method while handling the following exception:: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because the return value of "fr.zelytra.session.player.Player.getUsername()" is null
        at io.undertow.websockets.ServerWebSocketContainer.invokeEndpointMethod(ServerWebSocketContainer.java:538)
        at io.undertow.websockets.ServerWebSocketContainer.invokeEndpointMethod(ServerWebSocketContainer.java:525)
        at io.undertow.websockets.FrameHandler.invokeTextHandler(FrameHandler.java:335)
        at io.undertow.websockets.FrameHandler.onText(FrameHandler.java:250)
        at io.undertow.websockets.FrameHandler.processFrame(FrameHandler.java:156)
        at io.undertow.websockets.FrameHandler.channelRead0(FrameHandler.java:131)
        at io.undertow.websockets.FrameHandler.channelRead0(FrameHandler.java:61)
        at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
        at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346)
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
        at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:289)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because the return value of "fr.zelytra.session.player.Player.getUsername()" is null
        at io.undertow.websockets.ServerWebSocketContainer.invokeEndpointMethod(ServerWebSocketContainer.java:538)
        at io.undertow.websockets.ServerWebSocketContainer.invokeEndpointMethod(ServerWebSocketContainer.java:525)
        at io.undertow.websockets.FrameHandler.invokeOnError(FrameHandler.java:201)
        at io.undertow.websockets.FrameHandler$5.run(FrameHandler.java:361)
        at io.undertow.websockets.ServerWebSocketContainer$1.call(ServerWebSocketContainer.java:143)
        at io.undertow.websockets.ServerWebSocketContainer$1.call(ServerWebSocketContainer.java:140)
        at io.quarkus.websockets.client.runtime.WebsocketCoreRecorder$4$1.call(WebsocketCoreRecorder.java:181)
        at io.undertow.websockets.ServerWebSocketContainer.invokeEndpointMethod(ServerWebSocketContainer.java:536)
        ... 32 more
Caused by: java.lang.RuntimeException: java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because the return value of "fr.zelytra.session.player.Player.getUsername()" is null
        at io.undertow.websockets.ServerWebSocketContainer.invokeEndpointMethod(ServerWebSocketContainer.java:538)
        at io.undertow.websockets.ServerWebSocketContainer.invokeEndpointMethod(ServerWebSocketContainer.java:525)
        at io.undertow.websockets.annotated.AnnotatedEndpoint.onError(AnnotatedEndpoint.java:220)
        at io.undertow.websockets.FrameHandler$2.run(FrameHandler.java:204)
        at io.undertow.websockets.ServerWebSocketContainer$1.call(ServerWebSocketContainer.java:143)
        at io.undertow.websockets.ServerWebSocketContainer$1.call(ServerWebSocketContainer.java:140)
        at io.quarkus.websockets.client.runtime.WebsocketCoreRecorder$4$1.call(WebsocketCoreRecorder.java:181)
        at io.undertow.websockets.ServerWebSocketContainer.invokeEndpointMethod(ServerWebSocketContainer.java:536)
        ... 39 more
Caused by: java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because the return value of "fr.zelytra.session.player.Player.getUsername()" is null
        at fr.zelytra.session.SessionManager.getFleetByPlayerName(SessionManager.java:235)
        at fr.zelytra.session.SessionManager_Subclass.getFleetByPlayerName$$superforward(Unknown Source)
        at fr.zelytra.session.SessionManager_Subclass$$function$$3.apply(Unknown Source)
        at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:73)
        at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:62)
        at io.quarkus.arc.impl.LockInterceptor.readLock(LockInterceptor.java:99)
        at io.quarkus.arc.impl.LockInterceptor.lock(LockInterceptor.java:34)
        at io.quarkus.arc.impl.LockInterceptor_Bean.intercept(Unknown Source)
        at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:42)
        at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:30)
        at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:27)
        at fr.zelytra.session.SessionManager_Subclass.getFleetByPlayerName(Unknown Source)
        at fr.zelytra.session.SessionManager.leaveSession(SessionManager.java:117)
        at fr.zelytra.session.SessionManager_Subclass.leaveSession$$superforward(Unknown Source)
        at fr.zelytra.session.SessionManager_Subclass$$function$$16.apply(Unknown Source)
        at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:73)
        at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:62)
        at io.quarkus.arc.impl.LockInterceptor.writeLock(LockInterceptor.java:72)
        at io.quarkus.arc.impl.LockInterceptor.lock(LockInterceptor.java:32)
        at io.quarkus.arc.impl.LockInterceptor_Bean.intercept(Unknown Source)
        at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:42)
        at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:30)
        at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:27)
        at fr.zelytra.session.SessionManager_Subclass.leaveSession(Unknown Source)
        at fr.zelytra.session.SessionManager_ClientProxy.leaveSession(Unknown Source)
        at fr.zelytra.session.SessionSocket.handleSocketClose(SessionSocket.java:271)
        at fr.zelytra.session.SessionSocket.onError(SessionSocket.java:260)
        at jdk.internal.reflect.GeneratedMethodAccessor42.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at io.undertow.websockets.annotated.BoundMethod.invoke(BoundMethod.java:87)
        at io.undertow.websockets.annotated.AnnotatedEndpoint$5.run(AnnotatedEndpoint.java:225)
        at io.undertow.websockets.ServerWebSocketContainer$1.call(ServerWebSocketContainer.java:143)
        at io.undertow.websockets.ServerWebSocketContainer$1.call(ServerWebSocketContainer.java:140)
        at io.quarkus.websockets.client.runtime.WebsocketCoreRecorder$4$1.call(WebsocketCoreRecorder.java:181)
        at io.undertow.websockets.ServerWebSocketContainer.invokeEndpointMethod(ServerWebSocketContainer.java:536)
        ... 46 more

2024-07-21 12:06:42,577 ERROR [fr.zel.ses.SessionSocket] (vert.x-eventloop-thread-0) WebSocket error for session 58OA4vuMTfksSttUqsByEGS0xh-JA32hPeldksDp: java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because the return value of "fr.zelytra.session.player.Player.getUsername()" is null

Then all player throw this:

2024-07-21 12:18:45,042 INFO  [fr.zel.ses.soc.sec.SocketSecurityEndpoints] (executor-thread-205) [GET] /socket/register
2024-07-21 12:18:45,127 INFO  [fr.zel.ses.SessionSocket] (vert.x-eventloop-thread-0) [ANYONE] Connecting...
2024-07-21 12:18:45,154 INFO  [fr.zel.ses.SessionSocket] (vert.x-eventloop-thread-0) [player1] Connected !
2024-07-21 12:18:45,154 INFO  [fr.zel.ses.SessionManager] (vert.x-eventloop-thread-0) [0AB8630] Session created !
2024-07-21 12:18:45,154 ERROR [fr.zel.ses.SessionSocket] (vert.x-eventloop-thread-0) WebSocket error for session zD3fodsj2wWrnh8dZ6CcIlT1PV-1gacq624tVT4s: java.lang.NullPointerException
2024-07-21 12:18:45,161 WARN  [fr.zel.ses.SessionSocket] (vert.x-eventloop-thread-0) [UNDEFINED PLAYER] Disconnected
2024-07-21 12:18:45,161 WARN  [fr.zel.ses.SessionSocket] (vert.x-eventloop-thread-0) [UNDEFINED PLAYER] Disconnected

Possible fixes

(If you can, link to the line of code that might be responsible for the problem)