You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ResponseBodyEmitter instance is normally initialized by the framework upon returned by the RestController method.
The messages that are passed in the meantime are collected in a LinkedHashSet.
When the connection is dropped by the client early enough then the initialization will never be invoked.
These instances keep collecting the messages with no limitation.
To make matters worse, these instances are not evicted when timeout is reached.
This may result in OutOfMemoryError on the long run.
Steps to reproduce:
Start Server app in debug mode
Add breakpoint to org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitterReturnValueHandler:129 //emitter.initialize(handler);
I can't reproduce the exact scenario. The ISE "Async request already returned to container" from the logs is under WebAsyncRequest#startDeferredResultProcessing which is a couple of lines before emitter.initialize(handler). That means the connection must have been closed by then. I tried dropping the connection at that stage but I still can't get startDeferredResultProcessing to raise the same error.
In any case it's clear that we need to protect against very early connection issues.
Details
Component: spring-webmvc
Affects: 5.2.7.RELEASE
Impact: Memory leak
Description
The ResponseBodyEmitter instance is normally initialized by the framework upon returned by the RestController method.
The messages that are passed in the meantime are collected in a LinkedHashSet.
When the connection is dropped by the client early enough then the initialization will never be invoked.
These instances keep collecting the messages with no limitation.
To make matters worse, these instances are not evicted when timeout is reached.
This may result in OutOfMemoryError on the long run.
Steps to reproduce:
Attachments
Ideas
In my opinion this may be addressed by
The text was updated successfully, but these errors were encountered: