Skip to content

Jetty10RequestUpgradeStrategy - WebSocketCreatorInterceptor IndexOutOfBoundsException #28008

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

Closed
mreiterer opened this issue Feb 4, 2022 · 1 comment
Labels
status: duplicate A duplicate of another issue

Comments

@mreiterer
Copy link

mreiterer commented Feb 4, 2022

Affects: spring-websocket: 5.3.14, Jetty 10.0.7

When using the Jetty10RequestUpgradeStrategy for websocket support in Jetty 10.0.7 i get the following exception on the upgrade call:

Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 2 out of bounds for length 2 at org.springframework.web.socket.server.jetty.Jetty10RequestUpgradeStrategy$WebSocketCreatorInterceptor.invoke(Jetty10RequestUpgradeStrategy.java:161) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215) at com.sun.proxy.$Proxy161.createWebSocket(Unknown Source) at org.eclipse.jetty.websocket.server.JettyWebSocketServerContainer.lambda$upgrade$2(JettyWebSocketServerContainer.java:173) at org.eclipse.jetty.websocket.core.server.internal.CreatorNegotiator.lambda$negotiate$0(CreatorNegotiator.java:64) at org.eclipse.jetty.server.handler.ContextHandler.handle(ContextHandler.java:1445) at org.eclipse.jetty.server.handler.ContextHandler.handle(ContextHandler.java:1482) at org.eclipse.jetty.websocket.core.server.internal.CreatorNegotiator.negotiate(CreatorNegotiator.java:63) at org.eclipse.jetty.websocket.core.server.internal.AbstractHandshaker.upgradeRequest(AbstractHandshaker.java:76) at org.eclipse.jetty.websocket.core.server.internal.HandshakerSelector.upgradeRequest(HandshakerSelector.java:39) at org.eclipse.jetty.websocket.server.JettyWebSocketServerContainer.upgrade(JettyWebSocketServerContainer.java:177) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:282) at org.springframework.web.socket.server.jetty.Jetty10RequestUpgradeStrategy.upgrade(Jetty10RequestUpgradeStrategy.java:118) ... 96 common frames omitted

The reason seems to be the WebSocketCreatorInterceptor and in here the

@Nullable @Override public Object invoke(@NonNull MethodInvocation invocation) { if (this.protocol != null) { ReflectionUtils.invokeMethod( setAcceptedSubProtocol, invocation.getArguments()[2], this.protocol); } return this.adapter; }

The proxy is created from the jetty based interface

JettyWebSocketCreator which has only two arguments.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Feb 4, 2022
@rstoyanchev
Copy link
Contributor

Thanks for the report. This was previously reported in #27899 and fixed in 5.3.15, which was already released so you should be able to just upgrade for the fix.

@rstoyanchev rstoyanchev added status: duplicate A duplicate of another issue and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants