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

Investigate WebSocketOverHTTP2Test.testServerConnectionClose() #4603

Closed
sbordet opened this issue Feb 26, 2020 · 2 comments · Fixed by #4702
Closed

Investigate WebSocketOverHTTP2Test.testServerConnectionClose() #4603

sbordet opened this issue Feb 26, 2020 · 2 comments · Fixed by #4702
Assignees

Comments

@sbordet
Copy link
Contributor

sbordet commented Feb 26, 2020

Jetty version
10.0.x

Description
The test passes, but sometimes this NPE happens:

2020-02-26 09:47:47.528:INFO:oejs.Server:main: jetty-10.0.0-SNAPSHOT; built: unknown; git: ; jvm 11.0.6+10
2020-02-26 09:47:47.530:INFO:oejsh.ContextHandler:main: Started o.e.j.s.ServletContextHandler@aafcffa{/,null,AVAILABLE}
2020-02-26 09:47:47.530:INFO:oejs.AbstractConnector:main: Started ServerConnector@20b12f8a{HTTP/1.1, (http/1.1, h2c)}{0.0.0.0:41843}
2020-02-26 09:47:47.535:INFO:oejus.SslContextFactory:main: x509=X509@6955cb39(1,h=[],w=[]) for Server@235a0c16[provider=null,keyStore=file:///home/simon/opensource/jetty/jetty10.0/jetty-websocket/websocket-jetty-tests/src/test/resources/keystore.p12,trustStore=null]
2020-02-26 09:47:47.539:INFO:oejs.AbstractConnector:main: Started ServerConnector@54a67a45{SSL, (ssl, alpn, http/1.1, h2)}{0.0.0.0:38253}
2020-02-26 09:47:47.539:INFO:oejs.Server:main: Started Server@5ddea849{STARTING}[10.0.0-SNAPSHOT,sto=0] @3388ms
2020-02-26 09:47:47.540:WARN:oejusS.config:main: Trusting all certificates configured for Client@6b7906b3[provider=null,keyStore=null,trustStore=null]
2020-02-26 09:47:47.541:WARN:oejusS.config:main: No Client EndPointIdentificationAlgorithm configured for Client@6b7906b3[provider=null,keyStore=null,trustStore=null]
2020-02-26 09:47:47.555:WARN:oejs.HttpChannel:server-159: /ws/connectionClose
java.lang.NullPointerException
	at org.eclipse.jetty.http2.server.HttpTransportOverHTTP2.prepareUpgrade(HttpTransportOverHTTP2.java:324)
	at org.eclipse.jetty.http2.server.HTTP2ServerConnection$ServerHttpChannelOverHTTP2.checkAndPrepareUpgrade(HTTP2ServerConnection.java:382)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:494)
	at org.eclipse.jetty.server.HttpChannel.run(HttpChannel.java:327)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:135)
	at org.eclipse.jetty.http2.HTTP2Connection.produce(HTTP2Connection.java:200)
	at org.eclipse.jetty.http2.HTTP2Connection.onFillable(HTTP2Connection.java:147)
	at org.eclipse.jetty.http2.HTTP2Connection$FillableCallback.succeeded(HTTP2Connection.java:370)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:135)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:823)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:945)
	at java.base/java.lang.Thread.run(Thread.java:834)
2020-02-26 09:47:47.556:INFO:oejs.Server:main: Stopped Server@5ddea849{STOPPING}[10.0.0-SNAPSHOT,sto=0]
2020-02-26 09:47:47.556:INFO:oejs.AbstractConnector:main: Stopped ServerConnector@20b12f8a{HTTP/1.1, (http/1.1, h2c)}{0.0.0.0:0}
2020-02-26 09:47:47.557:INFO:oejs.AbstractConnector:main: Stopped ServerConnector@54a67a45{SSL, (ssl, alpn, http/1.1, h2)}{0.0.0.0:0}
2020-02-26 09:47:47.557:INFO:oejsh.ContextHandler:main: Stopped o.e.j.s.ServletContextHandler@aafcffa{/,null,UNAVAILABLE}
lachlan-roberts added a commit that referenced this issue Mar 2, 2020
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
lachlan-roberts added a commit that referenced this issue Mar 24, 2020
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
@sbordet
Copy link
Contributor Author

sbordet commented Mar 24, 2020

@lachlan-roberts as per our discussion, I would like to understand better why the NPE happens (what race triggers it) before a fix is attempted. Then maybe the fix is the same, but at least we know what it is.

Please document in this issue what is the race.

lachlan-roberts added a commit that referenced this issue Mar 25, 2020
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
@lachlan-roberts
Copy link
Contributor

The test was deliberatly closing the endpoint in the middle of the upgrade, this caused the AbstractHandshaker to throw in the call to Response.flushBuffer(); and because of this the UPGRADE_CONNECTION_ATTRIBUTE was never set. When we get to the point where we try to use the upgrade attribute, it is null so we get the NPE.

lachlan-roberts added a commit that referenced this issue Mar 26, 2020
Issue #4603 - avoid NPE during websocket HTTP/2 upgrade
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants