Configure default settings for Servlet async request timeout for WebFlux [SPR-15463] #20023
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
type: enhancement
A general enhancement
Milestone
Rossen Stoyanchev opened SPR-15463 and commented
The timeout for Servlet 3.0 async requests is defined roughly as the time between
ServletRequest#startAsync
and calls to eitherAsyncContext#dispatch
orAsyncContext#complete
.In WebFlux we call
ServletRequest#startAsync
automatically and then use Servlet 3.1 non-blocking I/O withAsyncContext#complete
at the end. Thedispatch
does not fit into our processing model which is not based on the Servlet API to begin with and we callstartAsync
quite early, way before we could know if the request will require streaming or not.For now our only option is to set the
AsyncContext
to never time out (-1) in order to make streaming scenarios possible. The downside is the lack of protection for non-streaming requests but then again even in the Servlet API there is no protection against regular requests taking indefinitely to process.It should also be noted that both Reactor and RxJava provide timeout operators so that's something natural to express. In the future we can consider implementing a timeout feature that's built into the Spring WebFlux processing model and works across all runtimes. For example a timeout composed on the
Mono<Void>
returned from theHttpHandler
.Affects: 5.0 M5
Issue Links:
Referenced from: commits 4f3db9b
The text was updated successfully, but these errors were encountered: