This is an automated email from the ASF dual-hosted git repository.
markt-asf pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new eeb9d7e029 Allow for either order of events in the sendfile reset test
eeb9d7e029 is described below
commit eeb9d7e029f626f5883bcc355138be076b9c1682
Author: Mark Thomas <[email protected]>
AuthorDate: Tue Dec 1 21:22:15 2026 +0000
Allow for either order of events in the sendfile reset test
After the client resets the stream, the event for the reset is usually
processed
while the sendfile write is still pending, which defers the clean-up. If the
write that is in progress completes first, it finds that the stream has been
reset, abandons the operation and performs the clean-up itself, leaving
nothing
to defer. Both orders are valid but the test only allowed for the first so
it
failed intermittently while waiting for the deferral. Accept either.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
---
test/org/apache/coyote/http2/TestHttp2Sendfile.java | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/test/org/apache/coyote/http2/TestHttp2Sendfile.java
b/test/org/apache/coyote/http2/TestHttp2Sendfile.java
index 95cf0a9b62..8820582cab 100644
--- a/test/org/apache/coyote/http2/TestHttp2Sendfile.java
+++ b/test/org/apache/coyote/http2/TestHttp2Sendfile.java
@@ -413,9 +413,16 @@ public class TestHttp2Sendfile extends Http2TestBase {
StreamProcessor processor = awaitSendfileStalled(stream);
sendRst(3, Http2Error.CANCEL.getCode());
- // Once the reset has been processed the clean-up is deferred until
the write finishes
- waitFor("The clean-up was not deferred",
processor::isSendfileCleanupDeferred);
- Assert.assertFalse("The stream was recycled while a sendfile write was
pending", stream.isRecycled());
+ /*
+ * The reset is processed in one of two orders, both of which are
valid. Usually the event for the reset is
+ * processed while the write is still pending and the clean-up is
deferred until the write finishes. If the
+ * write that is in progress completes first it finds that the stream
has been reset, abandons the operation and
+ * performs the clean-up itself. In that case there is nothing left to
defer.
+ */
+ waitFor("The reset was not processed", () ->
processor.isSendfileCleanupDeferred() || stream.isRecycled());
+ if (processor.isSendfileCleanupDeferred()) {
+ Assert.assertFalse("The stream was recycled while a sendfile write
was pending", stream.isRecycled());
+ }
// Read again so that the pending write finishes
readUntil("The write did not finish", stream::isRecycleComplete);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]