Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Websocket client UpgradeException: 101 Switching Protocols caused by NullPointerException #5325

Closed
natan-abolafya opened this issue Sep 25, 2020 · 3 comments

Comments

@natan-abolafya
Copy link

Jetty version
9.4.31.v20200723

Java version
openjdk 11.0.8+10

OS type/version
Ubuntu 18.04.1

Description
Unfortunately I can't give a very clear description but I'm hoping the exception stack trace will help. This feels like a version mismatch but as far as I can see all the jetty jars are 9.4.31.

First, stack trace:

org.eclipse.jetty.websocket.api.UpgradeException: 101 Switching Protocols
	at org.eclipse.jetty.websocket.client.WebSocketUpgradeRequest.onComplete(WebSocketUpgradeRequest.java:529)
	at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:218)
	at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:210)
	at org.eclipse.jetty.client.HttpSender.terminateRequest(HttpSender.java:411)
	at org.eclipse.jetty.client.HttpSender.someToSuccess(HttpSender.java:331)
	at org.eclipse.jetty.client.HttpSender$CommitCallback.process(HttpSender.java:744)
	at org.eclipse.jetty.client.HttpSender$CommitCallback.succeeded(HttpSender.java:710)
	at org.eclipse.jetty.client.http.HttpSenderOverHTTP$HeadersCallback.onCompleteSuccess(HttpSenderOverHTTP.java:307)
	at org.eclipse.jetty.util.IteratingCallback.processing(IteratingCallback.java:326)
	at org.eclipse.jetty.util.IteratingCallback.iterate(IteratingCallback.java:223)
	at org.eclipse.jetty.client.http.HttpSenderOverHTTP.sendHeaders(HttpSenderOverHTTP.java:65)
	at org.eclipse.jetty.client.HttpSender.send(HttpSender.java:212)
	at org.eclipse.jetty.client.http.HttpChannelOverHTTP.send(HttpChannelOverHTTP.java:85)
	at org.eclipse.jetty.client.HttpChannel.send(HttpChannel.java:128)
	at org.eclipse.jetty.client.HttpConnection.send(HttpConnection.java:225)
	at org.eclipse.jetty.client.http.HttpConnectionOverHTTP$Delegate.send(HttpConnectionOverHTTP.java:247)
	at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.send(HttpConnectionOverHTTP.java:121)
	at org.eclipse.jetty.client.http.HttpDestinationOverHTTP.send(HttpDestinationOverHTTP.java:38)
	at org.eclipse.jetty.client.HttpDestination.process(HttpDestination.java:382)
	at org.eclipse.jetty.client.HttpDestination.process(HttpDestination.java:336)
	at org.eclipse.jetty.client.HttpDestination.send(HttpDestination.java:318)
	at org.eclipse.jetty.client.HttpDestination.succeeded(HttpDestination.java:247)
	at org.eclipse.jetty.client.AbstractConnectionPool.proceed(AbstractConnectionPool.java:206)
	at org.eclipse.jetty.client.AbstractConnectionPool$1.succeeded(AbstractConnectionPool.java:184)
	at org.eclipse.jetty.client.AbstractConnectionPool$1.succeeded(AbstractConnectionPool.java:176)
	at org.eclipse.jetty.util.Promise$Wrapper.succeeded(Promise.java:130)
	at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.onOpen(HttpConnectionOverHTTP.java:129)
	at org.eclipse.jetty.io.SelectorManager.connectionOpened(SelectorManager.java:324)
	at org.eclipse.jetty.io.ManagedSelector.createEndPoint(ManagedSelector.java:368)
	at org.eclipse.jetty.io.ManagedSelector.access$2000(ManagedSelector.java:62)
	at org.eclipse.jetty.io.ManagedSelector$CreateEndPoint.run(ManagedSelector.java:1027)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.NullPointerException
	at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.onUpgradeFrom(HttpReceiverOverHTTP.java:118)
	at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.onUpgradeFrom(HttpConnectionOverHTTP.java:163)
	at org.eclipse.jetty.io.AbstractEndPoint.upgrade(AbstractEndPoint.java:432)
	at org.eclipse.jetty.websocket.client.WebSocketUpgradeRequest.upgrade(WebSocketUpgradeRequest.java:659)
	at org.eclipse.jetty.client.http.HttpChannelOverHTTP.exchangeTerminating(HttpChannelOverHTTP.java:118)
	at org.eclipse.jetty.client.HttpSender.terminateRequest(HttpSender.java:403)
	... 30 more

I only use the websocket client for some integration tests for websocket server 9.4.31. And sometimes the connection fails with the exception above.
It started happening, I believe, after upgrading to 9.4.31, from 9.4.30.
It happens on our build environment when it's running tests via gradle, not concurrently.
When I run the tests non-stop on my local environment (Windows 10 + Intellij IDEA + Intellij Runner (not-gradle-runner)), I can never reproduce it. And that kind of strengthens the possibility of library version mismatch caused by gradle. But I can't really find it. Maybe someone familiar with the code can point me to the right direction?

@joakime
Copy link
Contributor

joakime commented Sep 25, 2020

This is a duplicate of #5170
It's been fixed in jetty-9.4.x and is due out in the next release, Jetty 9.4.32

@natan-abolafya
Copy link
Author

Ah, should have searched for NullPointerException instead of UpgradeException. Thanks.

@joakime
Copy link
Contributor

joakime commented Sep 25, 2020

No worries. This one was tricky to search for.
The stacktrace you show is one of many that can trigger due to the underlying cause that was identified and fixed in #5170.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants