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

ReactorNettyRequestUpgradeStrategy WebSocket sub protocol handling broken in GatewayAutoConfiguration #2159

Closed
Johannes-Rost opened this issue Feb 25, 2021 · 1 comment
Labels
Projects
Milestone

Comments

@Johannes-Rost
Copy link
Contributor

org.springframework.cloud.gateway.config.GatewayAutoConfiguration creates an instance of org.springframework.web.reactive.socket.server.upgrade.ReactorNettyRequestUpgradeStrategy with a reactor.netty.http.server.WebsocketServerSpec.Builder which is reused for multiple clients with different protocols.

But the Builder should not be reused: spring-projects/spring-framework#25315

I do not have a sample, but I think the referenced bug report explains the error.

This bug was introduced in 3.0.x:

@Bean
@ConditionalOnEnabledGlobalFilter(WebsocketRoutingFilter.class)
public ReactorNettyRequestUpgradeStrategy reactorNettyRequestUpgradeStrategy(
				HttpClientProperties httpClientProperties) {

	WebsocketServerSpec.Builder builder = WebsocketServerSpec.builder();
	HttpClientProperties.Websocket websocket = httpClientProperties.getWebsocket();
	PropertyMapper map = PropertyMapper.get();
	map.from(websocket::getMaxFramePayloadLength).whenNonNull().to(builder::maxFramePayloadLength);
	map.from(websocket::isProxyPing).to(builder::handlePing);

	return new ReactorNettyRequestUpgradeStrategy(builder);
}

The WebsocketServerSpec.Builder implements Supplier<WebsocketServerSpec.Builde> but does not return a fresh instance when get() is invoked.

@Johannes-Rost
Copy link
Contributor Author

From our point of view this is a serious bug, because we use websockets for both stomp and video streams and this bug causes the video streams to stop working with spring-cloud-gateway 3.0.x.

@Johannes-Rost Johannes-Rost changed the title ReactorNettyRequestUpgradeStrategy broken in GatewayAutoConfiguration ReactorNettyRequestUpgradeStrategy WebSocket sub protocol handling broken in GatewayAutoConfiguration Mar 1, 2021
@spencergibb spencergibb added this to To do in 2020.0.2 via automation Mar 11, 2021
@spencergibb spencergibb added this to the 3.0.2 milestone Mar 11, 2021
@spencergibb spencergibb moved this from To do to In progress in 2020.0.2 Mar 11, 2021
2020.0.2 automation moved this from In progress to Done Mar 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
2020.0.2
  
Done
Development

Successfully merging a pull request may close this issue.

2 participants