tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject [tomcat] branch 9.0.x updated: Add debug logging after test failure on Travis CI
Date Wed, 17 Mar 2021 09:20:40 GMT
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 1520961  Add debug logging after test failure on Travis CI
1520961 is described below

commit 1520961b082d6a7c7e9c9e6466ff7fe5031cbf72
Author: Mark Thomas <markt@apache.org>
AuthorDate: Wed Mar 17 09:19:03 2021 +0000

    Add debug logging after test failure on Travis CI
    
    Error was:
    Exception in thread "http-nio2-127.0.0.1-auto-1-exec-6"
    java.nio.BufferOverflowException
    	at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:213)
    	at org.apache.coyote.http2.Http2Parser.readDataFrame(Http2Parser.java:200)
        ...
    
    So far, I ahven't been able to identify a code path that could trigger
    this so enabling debug logging to gather more info.
---
 .../apache/coyote/http2/TestCancelledUpload.java   | 121 +++++++++++----------
 1 file changed, 64 insertions(+), 57 deletions(-)

diff --git a/test/org/apache/coyote/http2/TestCancelledUpload.java b/test/org/apache/coyote/http2/TestCancelledUpload.java
index accd4b3..a3ad010 100644
--- a/test/org/apache/coyote/http2/TestCancelledUpload.java
+++ b/test/org/apache/coyote/http2/TestCancelledUpload.java
@@ -19,6 +19,8 @@ package org.apache.coyote.http2;
 import java.io.IOException;
 import java.io.InputStream;
 import java.nio.ByteBuffer;
+import java.util.logging.Level;
+import java.util.logging.LogManager;
 
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
@@ -37,72 +39,77 @@ public class TestCancelledUpload extends Http2TestBase {
     public void testCancelledRequest() throws Exception {
         http2Connect();
 
-        http2Protocol.setAllowedTrailerHeaders(TRAILER_HEADER_NAME);
+        LogManager.getLogManager().getLogger("org.apache.coyote.http2").setLevel(Level.ALL);
+        try {
+            http2Protocol.setAllowedTrailerHeaders(TRAILER_HEADER_NAME);
 
-        int bodySize = 8192;
-        int bodyCount = 20;
+            int bodySize = 8192;
+            int bodyCount = 20;
 
-        byte[] headersFrameHeader = new byte[9];
-        ByteBuffer headersPayload = ByteBuffer.allocate(128);
-        byte[] dataFrameHeader = new byte[9];
-        ByteBuffer dataPayload = ByteBuffer.allocate(bodySize);
-        byte[] trailerFrameHeader = new byte[9];
-        ByteBuffer trailerPayload = ByteBuffer.allocate(256);
+            byte[] headersFrameHeader = new byte[9];
+            ByteBuffer headersPayload = ByteBuffer.allocate(128);
+            byte[] dataFrameHeader = new byte[9];
+            ByteBuffer dataPayload = ByteBuffer.allocate(bodySize);
+            byte[] trailerFrameHeader = new byte[9];
+            ByteBuffer trailerPayload = ByteBuffer.allocate(256);
 
-        buildPostRequest(headersFrameHeader, headersPayload, false, dataFrameHeader, dataPayload,
-                null, trailerFrameHeader, trailerPayload, 3);
+            buildPostRequest(headersFrameHeader, headersPayload, false, dataFrameHeader,
dataPayload,
+                    null, trailerFrameHeader, trailerPayload, 3);
 
-        // Write the headers
-        writeFrame(headersFrameHeader, headersPayload);
-        // Body
-        for (int i = 0; i < bodyCount; i++) {
-            writeFrame(dataFrameHeader, dataPayload);
-        }
+            // Write the headers
+            writeFrame(headersFrameHeader, headersPayload);
+            // Body
+            for (int i = 0; i < bodyCount; i++) {
+                writeFrame(dataFrameHeader, dataPayload);
+            }
 
-        // Trailers
-        writeFrame(trailerFrameHeader, trailerPayload);
-
-        // The Server will process the request on a separate thread to the
-        // incoming frames.
-        // The request processing thread will:
-        // - read up to 128 bytes of request body
-        //   (and issue a window update for bytes read)
-        // - write a 403 response with no response body
-        // The connection processing thread will:
-        // - read the request body until the flow control window is exhausted
-        // - reset the stream if further DATA frames are received
-        parser.readFrame(true);
-
-        // Check for reset and exit if found
-        if (checkReset()) {
-            return;
-        }
+            // Trailers
+            writeFrame(trailerFrameHeader, trailerPayload);
+
+            // The Server will process the request on a separate thread to the
+            // incoming frames.
+            // The request processing thread will:
+            // - read up to 128 bytes of request body
+            //   (and issue a window update for bytes read)
+            // - write a 403 response with no response body
+            // The connection processing thread will:
+            // - read the request body until the flow control window is exhausted
+            // - reset the stream if further DATA frames are received
+            parser.readFrame(true);
 
-        // Not window update, not reset, must be the headers
-        Assert.assertEquals("3-HeadersStart\n" +
-                "3-Header-[:status]-[403]\n" +
-                "3-Header-[content-length]-[0]\n" +
-                "3-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]\n" +
-                "3-HeadersEnd\n",
-                output.getTrace());
-        output.clearTrace();
-        parser.readFrame(true);
-
-        // Check for reset and exit if found
-        if (checkReset()) {
-            return;
-        }
+            // Check for reset and exit if found
+            if (checkReset()) {
+                return;
+            }
+
+            // Not window update, not reset, must be the headers
+            Assert.assertEquals("3-HeadersStart\n" +
+                    "3-Header-[:status]-[403]\n" +
+                    "3-Header-[content-length]-[0]\n" +
+                    "3-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]\n" +
+                    "3-HeadersEnd\n",
+                    output.getTrace());
+            output.clearTrace();
+            parser.readFrame(true);
 
-        // Not window update, not reset, must be the response body
-        Assert.assertEquals("3-Body-0\n" +
-                "3-EndOfStream\n",
-                output.getTrace());
-        output.clearTrace();
-        parser.readFrame(true);
+            // Check for reset and exit if found
+            if (checkReset()) {
+                return;
+            }
 
-        Assert.assertTrue(checkReset());
+            // Not window update, not reset, must be the response body
+            Assert.assertEquals("3-Body-0\n" +
+                    "3-EndOfStream\n",
+                    output.getTrace());
+            output.clearTrace();
+            parser.readFrame(true);
+
+            Assert.assertTrue(checkReset());
 
-        // If there are any more frames after this, ignore them
+            // If there are any more frames after this, ignore them
+        } finally {
+            LogManager.getLogManager().getLogger("org.apache.coyote.http2").setLevel(Level.INFO);
+        }
     }
 
 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message