quarkus-smallrye-graphql: NPE when connecting with websocat

See original GitHub issue

Describe 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?

  1. 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
  2. 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:closed
  • Created a year ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
phillip-krugercommented, Sep 29, 2022

Thanks @carueda @yesunch , I think @yesunch fix that print a better error message is the right fix.

1reaction
phillip-krugercommented, Sep 27, 2022

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

I/O failure when trying to talk to `localhost` · Issue #23 - GitHub
When I try to connect to localhost, I get this error, but when I use 127.0.0.1 instead, everything is fine. I guess websocat...
Read more >
websocat 1.0.1 - Docs.rs
Connecting to and serving WebSockets from command line. · Executing external program and making it communitate to WebSocket using stdin/stdout. · Text and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found