This is an automated email from the ASF dual-hosted git repository.
markt-asf 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 de3a8e9318 Allow for either order of events in the sendfile reset test
de3a8e9318 is described below
commit de3a8e931887d08f70dd576dec124bfe986f84bb
Author: Mark Thomas <[email protected]>
AuthorDate: Tue Dec 1 21:33:53 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 5e74935a4c..2520b2eb48 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]