quarkus-smallrye-graphql: NPE when connecting with websocat
See original GitHub issueDescribe the bug
NPE in SmallRyeGraphQLOverWebSocketHandler.java when connecting with websocat. Stack trace in additional info below.
Please note: My app functionality seems unaffected, but I sometimes use the handy websocat tool for some basic monitoring and I thought I’d enter this ticket in case it’s actually exposing some unknown bug in Quarkus. I explored the documentation in case it could be related with some websocket protocol variation or something like that but was not able to find anything specific. It could also be a some websocat issue… in any case, there’s an NPE lurking there that should probably be handled more gracefully.
Thanks!
Expected behavior
No exceptions.
Actual behavior
NPE in SmallRyeGraphQLOverWebSocketHandler.java
How to Reproduce?
- Have a Quarkus app with graphql capability running. I discovered the issue with an actual deployed app involving dockerization and Apache proxy-pass, a setup that I thought might had been part of the problem BUT then noted that it also simply happens in development mode:
quarkus dev - in a separate terminal, run
websocat ws://localhost:8080/graphql. The NPE is thrown.
Output of uname -a or ver
Darwin Kernel Version 19.6.0: Tue Jan 12 22:13:05 PST 2021; root:xnu-6153.141.16~1/RELEASE_X86_64 x86_64
Output of java -version
openjdk version “17.0.3” 2022-04-19 OpenJDK Runtime Environment GraalVM CE 22.1.0 (build 17.0.3+7-jvmci-22.1-b06) OpenJDK 64-Bit Server VM GraalVM CE 22.1.0 (build 17.0.3+7-jvmci-22.1-b06, mixed mode, sharing)
GraalVM version (if different from Java)
No response
Quarkus version or git rev
CLI 2.12.1.Final. BUT my pom.xml with 2.12.3.Final
Build tool (ie. output of mvnw --version or gradlew --version)
Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
Additional information
2022-09-25 12:11:55,509 ERROR [io.qua.ver.cor.run.VertxCoreRecorder] (vert.x-eventloop-thread-1) Uncaught exception received by Vert.x: java.lang.NullPointerException: Cannot invoke "String.hashCode()" because "<local5>" is null
at io.quarkus.smallrye.graphql.runtime.SmallRyeGraphQLOverWebSocketHandler.lambda$doHandle$4(SmallRyeGraphQLOverWebSocketHandler.java:38)
at io.vertx.ext.web.impl.HttpServerRequestWrapper.lambda$toWebSocket$0(HttpServerRequestWrapper.java:355)
at io.vertx.core.impl.future.FutureImpl$3.onSuccess(FutureImpl.java:141)
at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:60)
at io.vertx.core.impl.future.FutureImpl.tryComplete(FutureImpl.java:211)
at io.vertx.core.impl.future.Mapping.onSuccess(Mapping.java:40)
at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:60)
at io.vertx.core.impl.future.FutureImpl.tryComplete(FutureImpl.java:211)
at io.vertx.core.impl.future.PromiseImpl.tryComplete(PromiseImpl.java:23)
at io.vertx.core.Promise.complete(Promise.java:66)
at io.vertx.core.http.impl.Http1xServerConnection.lambda$createWebSocket$2(Http1xServerConnection.java:299)
at io.vertx.core.impl.EventLoopContext.execute(EventLoopContext.java:86)
at io.vertx.core.impl.ContextBase.execute(ContextBase.java:225)
at io.vertx.core.http.impl.Http1xServerConnection.createWebSocket(Http1xServerConnection.java:272)
at io.vertx.core.http.impl.Http1xServerRequest.lambda$webSocket$4(Http1xServerRequest.java:467)
at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:264)
at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:246)
at io.vertx.core.http.impl.HttpEventHandler.handleEnd(HttpEventHandler.java:76)
at io.vertx.core.http.impl.Http1xServerRequest.onEnd(Http1xServerRequest.java:581)
at io.vertx.core.http.impl.Http1xServerRequest.lambda$pendingQueue$1(Http1xServerRequest.java:130)
at io.vertx.core.streams.impl.InboundBuffer.handleEvent(InboundBuffer.java:239)
at io.vertx.core.streams.impl.InboundBuffer.drain(InboundBuffer.java:226)
at io.vertx.core.streams.impl.InboundBuffer.lambda$fetch$0(InboundBuffer.java:279)
at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:264)
at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:246)
at io.vertx.core.impl.EventLoopContext.lambda$runOnContext$0(EventLoopContext.java:43)
at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:167)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:503)
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:833)```
Issue Analytics
- State:
- Created a year ago
- Comments:10 (6 by maintainers)
Top Related StackOverflow Question
Thanks @carueda @yesunch , I think @yesunch fix that print a better error message is the right fix.
Ok, I managed to recreate the issue ! Thanks. I ran into https://github.com/vi/websocat/issues/23, so when I change to use 127.0.0.1 is works. I’ll look into this a.s.a.p Thanks