Description
Violeta Georgieva opened SPR-15614 and commented
Hi,
Currently when an I/O error happens, completeWithError
will be called:
https://github.com/spring-projects/spring-framework/blob/master/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ResponseBodyEmitter.java#L172
At some point this call will result in:
https://github.com/spring-projects/spring-framework/blob/master/spring-web/src/main/java/org/springframework/web/context/request/async/WebAsyncManager.java#L357
Thus the implementation guarantees that the I/O error will be handled properly and the corresponding error handlers will be invoked.
On the other hand there is AsyncListener
that will be notified by the servlet containers that an error occurred:
https://github.com/spring-projects/spring-framework/blob/master/spring-web/src/main/java/org/springframework/web/context/request/async/StandardServletAsyncWebRequest.java#L137
This does not trigger any error handling but just completes the async operation.
When the error is I/O then this is not a problem as the implementation handles it as described above, but if it is another type of error then it will not be handled properly.
What do you think?
Regards,
Violeta
Affects: 5.0 RC1
Issue Links:
- WebAsyncManager concurrency issue with SseEmitter when client disconnect [SPR-16058] #20607 WebAsyncManager concurrency issue with SseEmitter when client disconnect
- Improve docs and handling of send errors in ResponseBodyEmitter [SPR-16548] #21091 Improve docs and handling of send errors in ResponseBodyEmitter
Referenced from: commits e0678ba