-
Bug
-
Resolution: Duplicate
-
Major
-
None
-
4.5.8.Final
-
None
-
None
-
Undefined
When using the AsyncOutputStream, if the completion callback to the application causes more data to be written, it's possible for the reference to the new async operation to be lost so the application will never be able to continue streaming.
The cause seems to be this function in HttpServletResponseWrapper$DeferredOutputStream:
private void flushQueue(ServletOutputStream sos) { if(lastAsyncOperation != null) { lastAsyncOperation.future.complete(null); lastAsyncOperation = null; } while(!asyncQueue.isEmpty() && sos.isReady()) { lastAsyncOperation = asyncQueue.poll(); lastAsyncOperation.work(sos); } }
The future.complete() call may cause a further write by the application, which will end up calling flushQueue() again, potentially setting a new value for lastAsyncOperation, if sos.isReady() becomes false after this write. The lastAsyncOperation reference will be set to null after complete() returns, so that the last enqueued operation will never be resolved.
- duplicates
-
RESTEASY-3046 ProviderHelper's writeTo stalls due to DeferredOutstream flush (on Tomcat)
-
- Resolved
-