vaadin / hilla

Build better business applications, faster. No more juggling REST endpoints or deciphering GraphQL queries. Hilla seamlessly connects Spring Boot and React to accelerate application development.
https://hilla.dev
Apache License 2.0
868 stars 58 forks source link

NPE in PushMessageHandler when connection was disposed before #2270

Open cproinger opened 3 months ago

cproinger commented 3 months ago

Describe the bug

see this line of code https://github.com/vaadin/hilla/blob/main/packages/java/endpoint/src/main/java/com/vaadin/hilla/push/PushMessageHandler.java#L117

java.lang.NullPointerException: Cannot invoke "java.util.concurrent.ConcurrentHashMap.containsKey(Object)" because the return value of "java.util.concurrent.ConcurrentHashMap.get(Object)" is null
    at dev.hilla.push.PushMessageHandler.handleBrowserSubscribe(PushMessageHandler.java:130)
    at dev.hilla.push.PushMessageHandler.handleMessage(PushMessageHandler.java:105)
    at dev.hilla.push.PushEndpoint.onMessage(PushEndpoint.java:153)
    at dev.hilla.push.PushEndpoint.onMessageRequest(PushEndpoint.java:101)
    at dev.hilla.push.PushEndpoint.onRequest(PushEndpoint.java:75)

Version 1.3 but seems to be possible in the current code as well

Expected-behavior

No response

Reproduction

we do some non-standard stuff with the hilla flux-connection, but i imagine this could happen in other cuircumstances as well and the fix should be quite trivial

System Info

not relevant

platosha commented 3 months ago

Please provide some steps to reproduce. It's not clear how to get to this state.