Closed kgcsabi closed 4 years ago
+1
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