Skip to content

Handle onError events that are sent by the servlet containers [SPR-15614] #20173

Closed
@spring-projects-issues

Description

@spring-projects-issues

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:

Referenced from: commits e0678ba

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions