This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 570e2c8f0fd1b5f1d4029613effaeb71b6bb2931 Author: Mark Thomas <ma...@apache.org> AuthorDate: Wed Oct 9 21:52:31 2019 +0100 Fix instance where pipelined data may be missed after an async request --- java/org/apache/coyote/AbstractProcessorLight.java | 27 +++++++++++++++------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/java/org/apache/coyote/AbstractProcessorLight.java b/java/org/apache/coyote/AbstractProcessorLight.java index 049797d..b26b41f 100644 --- a/java/org/apache/coyote/AbstractProcessorLight.java +++ b/java/org/apache/coyote/AbstractProcessorLight.java @@ -50,18 +50,14 @@ public abstract class AbstractProcessorLight implements Processor { getLog().debug("Processing dispatch type: [" + nextDispatch + "]"); } state = dispatch(nextDispatch.getSocketStatus()); + if (!dispatches.hasNext()) { + state = checkForPipelinedData(state, socketWrapper); + } } else if (status == SocketEvent.DISCONNECT) { // Do nothing here, just wait for it to get recycled } else if (isAsync() || isUpgrade() || state == SocketState.ASYNC_END) { state = dispatch(status); - if (state == SocketState.OPEN) { - // There may be pipe-lined data to read. If the data isn't - // processed now, execution will exit this loop and call - // release() which will recycle the processor (and input - // buffer) deleting any pipe-lined data. To avoid this, - // process it now. - state = service(socketWrapper); - } + state = checkForPipelinedData(state, socketWrapper); } else if (status == SocketEvent.OPEN_WRITE) { // Extra write event likely after async, ignore state = SocketState.LONG; @@ -101,6 +97,21 @@ public abstract class AbstractProcessorLight implements Processor { } + private SocketState checkForPipelinedData(SocketState inState, SocketWrapperBase<?> socketWrapper) + throws IOException { + if (inState == SocketState.OPEN) { + // There may be pipe-lined data to read. If the data isn't + // processed now, execution will exit this loop and call + // release() which will recycle the processor (and input + // buffer) deleting any pipe-lined data. To avoid this, + // process it now. + return service(socketWrapper); + } else { + return inState; + } + } + + public void addDispatch(DispatchType dispatchType) { synchronized (dispatches) { dispatches.add(dispatchType); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org