On 25/05/2022 10:07, Rémy Maucherat wrote:
On Tue, May 24, 2022 at 6:46 PM <[email protected]> wrote:
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new 680db4448d Additional fixes for 66076
680db4448d is described below
commit 680db4448d392752fb57b91639e7ab34a3f58105
Author: Mark Thomas <[email protected]>
AuthorDate: Tue May 24 17:46:20 2022 +0100
Additional fixes for 66076
The vectored IO version of the fix.
<snip/>
diff --git a/java/org/apache/tomcat/util/net/SocketWrapperBase.java
b/java/org/apache/tomcat/util/net/SocketWrapperBase.java
index bcb0119fc6..d95a31a15d 100644
--- a/java/org/apache/tomcat/util/net/SocketWrapperBase.java
+++ b/java/org/apache/tomcat/util/net/SocketWrapperBase.java
@@ -1036,6 +1036,8 @@ public abstract class SocketWrapperBase<E> {
*/
protected abstract boolean isInline();
+ protected abstract boolean hasOutboundRemaining();
+
/**
* Process the operation using the connector executor.
* @return true if the operation was accepted, false if the executor
@@ -1087,7 +1089,7 @@ public abstract class SocketWrapperBase<E> {
boolean completion = true;
if (state.check != null) {
CompletionHandlerCall call =
state.check.callHandler(currentState, state.buffers, state.offset,
state.length);
- if (call == CompletionHandlerCall.CONTINUE) {
+ if (call == CompletionHandlerCall.CONTINUE ||
state.hasOutboundRemaining()) {
I understand why it's there (the operation will indeed seem complete
in that case, but it's not fully complete), but it needs to check
state.read then (looping a read operation will most likely not do
anything good; maybe it shouldn't happen, but it's a lot better to be
safe), so:
if (call == CompletionHandlerCall.CONTINUE || (!state.read &&
state.hasOutboundRemaining())) {
Overall the change is more convoluted than I expected, and I would
have messed it up without a test case.
Thanks for the review. I'd missed that case and I agree bad things would
happen if state.hasOutboundRemaining() happened to be true while a read
was completing.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]