Access requests forwarded to async results will cause thread race. By default, after the Undertow task thread preserve the path of forwarding requests, InvocableHandlerMethod of async requests will be forward methods, not async methods. I writed an example unit test.
Comment From: wilkinsona
Thanks for the proposal.
I don't think we should change Undertow's default for everyone as it will be a breaking change for those who are relying on the current behaviour. I suspect this is why the Undertow team made the setting configurable (originally via a system property) and left the default unchanged.
You can configure it in Spring Boot using an UndertowDeploymentInfoCustomizer
@Bean
:
@Bean
UndertowDeploymentInfoCustomizer forwardPathPreservation() {
return (deploymentInfo) -> deploymentInfo.setPreservePathOnForward(false);
}
Comment From: gh-orange
@wilkinsona You're welcome, I just discovered this problem when I changed Tomcat to Undertow. It took me some time to solve it. I hope that Spring-boot can provide a way for developers to not care about the differences in the details of the Servlet container, and make the migration easier.