Recurring AsyncRequestTimeoutException in Spring Boot Admin log
Alternatively without spring boot, add
@Override
public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
long timeout = 5 * 60 * 1000;// for example 5 minutes
WebMvcConfigurer.super.configureAsyncSupport(configurer);
configurer.setDefaultTimeout(timeout);
}
to the configuration class that implements WebMvcConfigurer
In case of using ComplatebleFuture<Any>
as return type of @RestController
function and using Tomcat as backing container.Then is required to register catalina Connector customizer into spring context, which will adjust async connection timeout. Because org.apache.catalina.connector.Connector
has its own property protected long asyncTimeout = 30000;
which is used as timeout for async request.
@Configuration
class TomcatAsyncConfig {
@Bean
fun asyncTimeoutCustomize(): TomcatConnectorCustomizer =
TomcatConnectorCustomizer { connector -> connector.asyncTimeout = 180000 }
}
Modifing values of
spring.mvc.async.request-timeout: -1
or server.tomcat.connection-timeout
won't do.
I also had similar error. try this property in you application.yml
spring:
mvc:
async:
request-timeout: -1