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

Tolerate null return from getNegotiatedExtensions (for Jetty 9.4.1 compatibility) [SPR-15180] #19746

Closed
spring-issuemaster opened this issue Jan 23, 2017 · 1 comment

Comments

@spring-issuemaster
Copy link
Collaborator

commented Jan 23, 2017

Andy Wilkinson opened SPR-15180 and commented

Jetty 9.4.1 may return null from javax.websocket.Session.getNegotiatedExtensions() rather than an empty list. This causes a NullPointerException in StandardWebSocketSession:

java.io.IOException: Connect failure
	at org.eclipse.jetty.websocket.jsr356.ClientContainer.connect(ClientContainer.java:165) ~[javax-websocket-client-impl-9.4.1.v20170120.jar:9.4.1.v20170120]
	at org.eclipse.jetty.websocket.jsr356.ClientContainer.connectToServer(ClientContainer.java:188) ~[javax-websocket-client-impl-9.4.1.v20170120.jar:9.4.1.v20170120]
	at org.springframework.web.socket.client.standard.StandardWebSocketClient$1.call(StandardWebSocketClient.java:150) ~[spring-websocket-4.3.5.RELEASE.jar:4.3.5.RELEASE]
	at org.springframework.web.socket.client.standard.StandardWebSocketClient$1.call(StandardWebSocketClient.java:147) ~[spring-websocket-4.3.5.RELEASE.jar:4.3.5.RELEASE]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_102]
	at java.lang.Thread.run(Thread.java:745) [na:1.8.0_102]
Caused by: java.lang.NullPointerException: null
	at org.springframework.web.socket.adapter.standard.StandardWebSocketSession.initializeNativeSession(StandardWebSocketSession.java:185) ~[spring-websocket-4.3.5.RELEASE.jar:4.3.5.RELEASE]
	at org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter.onOpen(StandardWebSocketHandlerAdapter.java:61) ~[spring-websocket-4.3.5.RELEASE.jar:4.3.5.RELEASE]
	at org.eclipse.jetty.websocket.jsr356.endpoints.JsrEndpointEventDriver.onConnect(JsrEndpointEventDriver.java:140) ~[javax-websocket-client-impl-9.4.1.v20170120.jar:9.4.1.v20170120]
	at org.eclipse.jetty.websocket.common.events.AbstractEventDriver.openSession(AbstractEventDriver.java:233) ~[websocket-common-9.4.1.v20170120.jar:9.4.1.v20170120]
	at org.eclipse.jetty.websocket.jsr356.endpoints.AbstractJsrEventDriver.openSession(AbstractJsrEventDriver.java:104) ~[javax-websocket-client-impl-9.4.1.v20170120.jar:9.4.1.v20170120]
	at org.eclipse.jetty.websocket.common.WebSocketSession.open(WebSocketSession.java:504) ~[websocket-common-9.4.1.v20170120.jar:9.4.1.v20170120]
	at org.eclipse.jetty.websocket.common.WebSocketSession.onOpened(WebSocketSession.java:433) ~[websocket-common-9.4.1.v20170120.jar:9.4.1.v20170120]
	at org.eclipse.jetty.io.AbstractConnection.onOpen(AbstractConnection.java:200) ~[jetty-io-9.4.1.v20170120.jar:9.4.1.v20170120]
	at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.onOpen(AbstractWebSocketConnection.java:566) ~[websocket-common-9.4.1.v20170120.jar:9.4.1.v20170120]
	at org.eclipse.jetty.io.AbstractEndPoint.upgrade(AbstractEndPoint.java:432) ~[jetty-io-9.4.1.v20170120.jar:9.4.1.v20170120]
	at org.eclipse.jetty.websocket.client.WebSocketUpgradeRequest.upgrade(WebSocketUpgradeRequest.java:622) ~[websocket-client-9.4.1.v20170120.jar:9.4.1.v20170120]
	at org.eclipse.jetty.client.http.HttpChannelOverHTTP.exchangeTerminating(HttpChannelOverHTTP.java:116) ~[jetty-client-9.4.1.v20170120.jar:9.4.1.v20170120]
	at org.eclipse.jetty.client.HttpReceiver.terminateResponse(HttpReceiver.java:451) ~[jetty-client-9.4.1.v20170120.jar:9.4.1.v20170120]
	at org.eclipse.jetty.client.HttpReceiver.responseSuccess(HttpReceiver.java:405) ~[jetty-client-9.4.1.v20170120.jar:9.4.1.v20170120]
	at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.messageComplete(HttpReceiverOverHTTP.java:281) ~[jetty-client-9.4.1.v20170120.jar:9.4.1.v20170120]
	at org.eclipse.jetty.http.HttpParser.parseHeaders(HttpParser.java:1076) ~[jetty-http-9.4.1.v20170120.jar:9.4.1.v20170120]
	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:1326) ~[jetty-http-9.4.1.v20170120.jar:9.4.1.v20170120]
	at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.parse(HttpReceiverOverHTTP.java:170) ~[jetty-client-9.4.1.v20170120.jar:9.4.1.v20170120]
	at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.process(HttpReceiverOverHTTP.java:131) ~[jetty-client-9.4.1.v20170120.jar:9.4.1.v20170120]
	at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.receive(HttpReceiverOverHTTP.java:70) ~[jetty-client-9.4.1.v20170120.jar:9.4.1.v20170120]
	at org.eclipse.jetty.client.http.HttpChannelOverHTTP.receive(HttpChannelOverHTTP.java:130) ~[jetty-client-9.4.1.v20170120.jar:9.4.1.v20170120]
	at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.onFillable(HttpConnectionOverHTTP.java:116) ~[jetty-client-9.4.1.v20170120.jar:9.4.1.v20170120]
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279) ~[jetty-io-9.4.1.v20170120.jar:9.4.1.v20170120]
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:112) ~[jetty-io-9.4.1.v20170120.jar:9.4.1.v20170120]
	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124) ~[jetty-io-9.4.1.v20170120.jar:9.4.1.v20170120]
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:672) ~[jetty-util-9.4.1.v20170120.jar:9.4.1.v20170120]
	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:590) ~[jetty-util-9.4.1.v20170120.jar:9.4.1.v20170120]
	... 1 common frames omitted

It's not clear if this is spec compliant (both the spec and the javadoc are silent on it), but could StandardWebSocketSession be made more robust and treat null as an empty list?


Affects: 4.3.5

Reference URL: spring-projects/spring-boot#7750

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Jan 23, 2017

Juergen Hoeller commented

I've revised our WebSocketSession contract along with this, defining to return always an empty list there for our own getExtensions variant... which was allowing a null return value but all implementations except one returned an empty list already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.