[Bug 64671] HTTP/2 Stream.receivedData method throwing continuous NullPointerException in the logs

2020-08-18 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=64671

--- Comment #4 from Mark Thomas  ---
1. It will trigger the closure of the entire connection which is probably not
what you want.
2. Yes, it is already in the 9.0.x source code.
3. Sorry, no. It varies based in a number of factors. It typically happens in
the second week of the month although since there hasn't been an August release
I'm going to try and release in the first week of September.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 03/03: Expand to ensure clean closure with connection flow control error

2020-08-18 Thread markt
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 d56541ffad0d2b12cdd41a413d7f3e67edc65223
Author: Mark Thomas 
AuthorDate: Tue Aug 18 21:12:46 2020 +0100

Expand to ensure clean closure with connection flow control error
---
 .../apache/coyote/http2/TestHttp2Section_5_1.java  | 63 +-
 1 file changed, 62 insertions(+), 1 deletion(-)

diff --git a/test/org/apache/coyote/http2/TestHttp2Section_5_1.java 
b/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
index 7f8448f..a9c3635 100644
--- a/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
+++ b/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
@@ -339,7 +339,7 @@ public class TestHttp2Section_5_1 extends Http2TestBase {
 
 
 @Test
-public void testErrorOnWaitingStream() throws Exception {
+public void testErrorOnWaitingStream01() throws Exception {
 // http2Connect() - modified
 enableHttp2(1);
 configureAndStartWebApplication();
@@ -392,4 +392,65 @@ public class TestHttp2Section_5_1 extends Http2TestBase {
 parser.readFrame(true);
 Assert.assertEquals("3-RST-[" + 
Http2Error.FLOW_CONTROL_ERROR.getCode() + "]\n", output.getTrace());
 }
+
+
+@Test
+public void testErrorOnWaitingStream02() throws Exception {
+// http2Connect() - modified
+enableHttp2(1);
+configureAndStartWebApplication();
+openClientConnection();
+doHttpUpgrade();
+sendClientPreface();
+
+// validateHttp2InitialResponse() - modified
+parser.readFrame(true);
+parser.readFrame(true);
+parser.readFrame(true);
+parser.readFrame(true);
+parser.readFrame(true);
+
+Assert.assertEquals("0-Settings-[3]-[1]\n" +
+"0-Settings-End\n" +
+"0-Settings-Ack\n" +
+"0-Ping-[0,0,0,0,0,0,0,1]\n" +
+getSimpleResponseTrace(1)
+, output.getTrace());
+output.clearTrace();
+
+sendLargeGetRequest(3);
+
+sendSimpleGetRequest(5);
+
+// Default connection window size is 64k-1.
+// Initial request will have used 8k leaving 56k-1.
+// Stream window will be 64k-1.
+
+// Increase Connection window by 16k
+sendWindowUpdate(0, 16 * 1024);
+
+// Expecting
+// 1 * headers
+// 64k-1 of body (8 * ~8k)
+// 1 * error (could be in any order)
+for (int i = 0; i < 9; i++) {
+parser.readFrame(true);
+}
+parser.readFrame(true);
+
+Assert.assertTrue(output.getTrace(),
+output.getTrace().contains("5-RST-[" + 
Http2Error.REFUSED_STREAM.getCode() + "]"));
+output.clearTrace();
+
+// Connection window is 8k.
+// Stream window is zero.
+
+// Expand the connection window too much to trigger an error
+// Allow for the 8k still in the connection window
+sendWindowUpdate(0, (1 << 31) - 1);
+
+parser.readFrame(true);
+Assert.assertTrue(output.getTrace(),
+output.getTrace().contains("0-Goaway-[5]-[" + 
Http2Error.FLOW_CONTROL_ERROR.getCode() + "]"));
+}
 }


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



[tomcat] branch 8.5.x updated (50ae519 -> d56541f)

2020-08-18 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a change to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git.


from 50ae519  Re-word
 new 32c2e19  Refactor for more consistent error code after client sends 
stream reset
 new f126ebf  Improve handling of flow control errors.
 new d56541f  Expand to ensure clean closure with connection flow control 
error

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/coyote/http2/Http2UpgradeHandler.java   |  7 +--
 java/org/apache/coyote/http2/Stream.java   |  1 +
 .../coyote/http2/WindowAllocationManager.java  | 38 ++--
 .../apache/coyote/http2/TestHttp2Section_5_1.java  | 69 --
 webapps/docs/changelog.xml | 10 
 5 files changed, 99 insertions(+), 26 deletions(-)


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



[tomcat] 02/03: Improve handling of flow control errors.

2020-08-18 Thread markt
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 f126ebf390dbc4ad7ccc1e2b183688471e6282b0
Author: Mark Thomas 
AuthorDate: Tue Aug 18 20:50:01 2020 +0100

Improve handling of flow control errors.
---
 java/org/apache/coyote/http2/Stream.java   |  1 +
 .../coyote/http2/WindowAllocationManager.java  | 38 --
 .../apache/coyote/http2/TestHttp2Section_5_1.java  |  4 +--
 webapps/docs/changelog.xml |  5 +++
 4 files changed, 29 insertions(+), 19 deletions(-)

diff --git a/java/org/apache/coyote/http2/Stream.java 
b/java/org/apache/coyote/http2/Stream.java
index 1927fe7..3a52074 100644
--- a/java/org/apache/coyote/http2/Stream.java
+++ b/java/org/apache/coyote/http2/Stream.java
@@ -677,6 +677,7 @@ public class Stream extends AbstractStream implements 
HeaderEmitter {
 se.getError()));
 }
 state.sendReset();
+cancelAllocationRequests();
 handler.sendStreamReset(se);
 } catch (IOException ioe) {
 ConnectionException ce = new ConnectionException(
diff --git a/java/org/apache/coyote/http2/WindowAllocationManager.java 
b/java/org/apache/coyote/http2/WindowAllocationManager.java
index f286430..973ce59 100644
--- a/java/org/apache/coyote/http2/WindowAllocationManager.java
+++ b/java/org/apache/coyote/http2/WindowAllocationManager.java
@@ -17,6 +17,7 @@
 package org.apache.coyote.http2;
 
 import org.apache.coyote.ActionCode;
+import org.apache.coyote.Response;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.util.res.StringManager;
@@ -184,24 +185,27 @@ class WindowAllocationManager {
 // to stream.notify(). Additional notify() calls may trigger
 // unexpected timeouts.
 waitingFor = NONE;
-if (stream.getCoyoteResponse().getWriteListener() == null) {
-// Blocking, so use notify to release StreamOutputBuffer
-if (log.isDebugEnabled()) {
-
log.debug(sm.getString("windowAllocationManager.notified",
-stream.getConnectionId(), 
stream.getIdentifier()));
+Response response = stream.getCoyoteResponse();
+if (response != null) {
+if (response.getWriteListener() == null) {
+// Blocking, so use notify to release 
StreamOutputBuffer
+if (log.isDebugEnabled()) {
+
log.debug(sm.getString("windowAllocationManager.notified",
+stream.getConnectionId(), 
stream.getIdentifier()));
+}
+stream.notify();
+} else {
+// Non-blocking so dispatch
+if (log.isDebugEnabled()) {
+
log.debug(sm.getString("windowAllocationManager.dispatched",
+stream.getConnectionId(), 
stream.getIdentifier()));
+}
+response.action(ActionCode.DISPATCH_WRITE, null);
+// Need to explicitly execute dispatches on the 
StreamProcessor
+// as this thread is being processed by an 
UpgradeProcessor
+// which won't see this dispatch
+response.action(ActionCode.DISPATCH_EXECUTE, null);
 }
-stream.notify();
-} else {
-// Non-blocking so dispatch
-if (log.isDebugEnabled()) {
-
log.debug(sm.getString("windowAllocationManager.dispatched",
-stream.getConnectionId(), 
stream.getIdentifier()));
-}
-
stream.getCoyoteResponse().action(ActionCode.DISPATCH_WRITE, null);
-// Need to explicitly execute dispatches on the 
StreamProcessor
-// as this thread is being processed by an UpgradeProcessor
-// which won't see this dispatch
-
stream.getCoyoteResponse().action(ActionCode.DISPATCH_EXECUTE, null);
 }
 }
 }
diff --git a/test/org/apache/coyote/http2/TestHttp2Section_5_1.java 
b/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
index c9182c8..7f8448f 100644
--- a/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
+++ b/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
@@ -379,8 +379,7 @@ public class TestHttp2Section_5_1 extends Http2TestBase {
 parser.readFrame(true);
 
 Assert.assertTrue(output.getTrace(),
-output.getTrace().contains("5-RST-[" +

[tomcat] 01/03: Refactor for more consistent error code after client sends stream reset

2020-08-18 Thread markt
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 32c2e19d94546653e2cc18656d4df32d3a9bb1db
Author: Mark Thomas 
AuthorDate: Tue Aug 18 20:24:53 2020 +0100

Refactor for more consistent error code after client sends stream reset
---
 java/org/apache/coyote/http2/Http2UpgradeHandler.java  | 7 ++-
 test/org/apache/coyote/http2/TestHttp2Section_5_1.java | 2 +-
 webapps/docs/changelog.xml | 5 +
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java 
b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
index 08ff5e7..62e1423 100644
--- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
@@ -38,7 +38,6 @@ import java.util.concurrent.atomic.AtomicReference;
 import javax.servlet.http.WebConnection;
 
 import org.apache.coyote.Adapter;
-import org.apache.coyote.CloseNowException;
 import org.apache.coyote.ProtocolException;
 import org.apache.coyote.Request;
 import org.apache.coyote.http11.upgrade.InternalHttpUpgradeHandler;
@@ -836,9 +835,7 @@ public class Http2UpgradeHandler extends AbstractStream 
implements InternalHttpU
 do {
 synchronized (this) {
 if (!stream.canWrite()) {
-throw new CloseNowException(
-
sm.getString("upgradeHandler.stream.notWritable",
-stream.getConnectionId(), 
stream.getIdentifier()));
+
stream.doStreamCancel(sm.getString("upgradeHandler.stream.notWritable"), 
Http2Error.STREAM_CLOSED);
 }
 long windowSize = getWindowSize();
 if (windowSize < 1 || backLogSize > 0) {
@@ -910,7 +907,7 @@ public class Http2UpgradeHandler extends AbstractStream 
implements InternalHttpU
 error = Http2Error.ENHANCE_YOUR_CALM;
 } else {
 msg = sm.getString("stream.clientCancel");
-error = Http2Error.CANCEL;
+error = Http2Error.STREAM_CLOSED;
 }
 // Close the stream
 // This thread is in application code so need
diff --git a/test/org/apache/coyote/http2/TestHttp2Section_5_1.java 
b/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
index 7bf83dd..c9182c8 100644
--- a/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
+++ b/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
@@ -321,7 +321,7 @@ public class TestHttp2Section_5_1 extends Http2TestBase {
 // Client reset triggers a write error which in turn triggers a 
server
 // reset
 parser.readFrame(true);
-Assert.assertEquals("3-RST-[8]\n", output.getTrace());
+Assert.assertEquals("3-RST-[5]\n", output.getTrace());
 output.clearTrace();
 
 // Open up the connection window.
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index c703e00..8a8ef8e 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -99,6 +99,11 @@
 in the previous release to reduce the memory footprint of closed HTTP/2
 streams. (markt)
   
+  
+Refactor the HTTP/2 implementation to more consistently return a stream
+closed error if errors occur after a stream has been reset by the
+client. (markt)
+  
 
   
   


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



[tomcat] 02/03: Improve handling of flow control errors.

2020-08-18 Thread markt
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

commit 342b7cdea45cbaad054708a92d22b7ed384cba34
Author: Mark Thomas 
AuthorDate: Tue Aug 18 20:50:01 2020 +0100

Improve handling of flow control errors.
---
 java/org/apache/coyote/http2/Stream.java   |  1 +
 .../coyote/http2/WindowAllocationManager.java  | 38 --
 .../apache/coyote/http2/TestHttp2Section_5_1.java  |  4 +--
 webapps/docs/changelog.xml |  5 +++
 4 files changed, 29 insertions(+), 19 deletions(-)

diff --git a/java/org/apache/coyote/http2/Stream.java 
b/java/org/apache/coyote/http2/Stream.java
index 2f40e28..208ea1b 100644
--- a/java/org/apache/coyote/http2/Stream.java
+++ b/java/org/apache/coyote/http2/Stream.java
@@ -729,6 +729,7 @@ class Stream extends AbstractStream implements 
HeaderEmitter {
 se.getError()));
 }
 state.sendReset();
+cancelAllocationRequests();
 handler.sendStreamReset(se);
 } catch (IOException ioe) {
 ConnectionException ce = new ConnectionException(
diff --git a/java/org/apache/coyote/http2/WindowAllocationManager.java 
b/java/org/apache/coyote/http2/WindowAllocationManager.java
index f286430..973ce59 100644
--- a/java/org/apache/coyote/http2/WindowAllocationManager.java
+++ b/java/org/apache/coyote/http2/WindowAllocationManager.java
@@ -17,6 +17,7 @@
 package org.apache.coyote.http2;
 
 import org.apache.coyote.ActionCode;
+import org.apache.coyote.Response;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.util.res.StringManager;
@@ -184,24 +185,27 @@ class WindowAllocationManager {
 // to stream.notify(). Additional notify() calls may trigger
 // unexpected timeouts.
 waitingFor = NONE;
-if (stream.getCoyoteResponse().getWriteListener() == null) {
-// Blocking, so use notify to release StreamOutputBuffer
-if (log.isDebugEnabled()) {
-
log.debug(sm.getString("windowAllocationManager.notified",
-stream.getConnectionId(), 
stream.getIdentifier()));
+Response response = stream.getCoyoteResponse();
+if (response != null) {
+if (response.getWriteListener() == null) {
+// Blocking, so use notify to release 
StreamOutputBuffer
+if (log.isDebugEnabled()) {
+
log.debug(sm.getString("windowAllocationManager.notified",
+stream.getConnectionId(), 
stream.getIdentifier()));
+}
+stream.notify();
+} else {
+// Non-blocking so dispatch
+if (log.isDebugEnabled()) {
+
log.debug(sm.getString("windowAllocationManager.dispatched",
+stream.getConnectionId(), 
stream.getIdentifier()));
+}
+response.action(ActionCode.DISPATCH_WRITE, null);
+// Need to explicitly execute dispatches on the 
StreamProcessor
+// as this thread is being processed by an 
UpgradeProcessor
+// which won't see this dispatch
+response.action(ActionCode.DISPATCH_EXECUTE, null);
 }
-stream.notify();
-} else {
-// Non-blocking so dispatch
-if (log.isDebugEnabled()) {
-
log.debug(sm.getString("windowAllocationManager.dispatched",
-stream.getConnectionId(), 
stream.getIdentifier()));
-}
-
stream.getCoyoteResponse().action(ActionCode.DISPATCH_WRITE, null);
-// Need to explicitly execute dispatches on the 
StreamProcessor
-// as this thread is being processed by an UpgradeProcessor
-// which won't see this dispatch
-
stream.getCoyoteResponse().action(ActionCode.DISPATCH_EXECUTE, null);
 }
 }
 }
diff --git a/test/org/apache/coyote/http2/TestHttp2Section_5_1.java 
b/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
index 3538516..00c0495 100644
--- a/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
+++ b/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
@@ -374,8 +374,7 @@ public class TestHttp2Section_5_1 extends Http2TestBase {
 parser.readFrame(true);
 
 Assert.assertTrue(output.getTrace(),
-output.getTrace().contains("5-RST-[" +
-   

[tomcat] 01/03: Refactor for more consistent error code after client sends stream reset

2020-08-18 Thread markt
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

commit d9669e4ec2b9cc0bcfa2f74375bdb8d51f9632cf
Author: Mark Thomas 
AuthorDate: Tue Aug 18 20:24:53 2020 +0100

Refactor for more consistent error code after client sends stream reset
---
 java/org/apache/coyote/http2/Http2UpgradeHandler.java  | 7 ++-
 test/org/apache/coyote/http2/TestHttp2Section_5_1.java | 2 +-
 webapps/docs/changelog.xml | 5 +
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java 
b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
index 367fe95..a1feb4d 100644
--- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
@@ -36,7 +36,6 @@ import java.util.concurrent.atomic.AtomicReference;
 import javax.servlet.http.WebConnection;
 
 import org.apache.coyote.Adapter;
-import org.apache.coyote.CloseNowException;
 import org.apache.coyote.ProtocolException;
 import org.apache.coyote.Request;
 import org.apache.coyote.http11.upgrade.InternalHttpUpgradeHandler;
@@ -839,9 +838,7 @@ class Http2UpgradeHandler extends AbstractStream implements 
InternalHttpUpgradeH
 do {
 synchronized (this) {
 if (!stream.canWrite()) {
-throw new CloseNowException(
-
sm.getString("upgradeHandler.stream.notWritable",
-stream.getConnectionId(), 
stream.getIdentifier()));
+
stream.doStreamCancel(sm.getString("upgradeHandler.stream.notWritable"), 
Http2Error.STREAM_CLOSED);
 }
 long windowSize = getWindowSize();
 if (windowSize < 1 || backLogSize > 0) {
@@ -913,7 +910,7 @@ class Http2UpgradeHandler extends AbstractStream implements 
InternalHttpUpgradeH
 error = Http2Error.ENHANCE_YOUR_CALM;
 } else {
 msg = sm.getString("stream.clientCancel");
-error = Http2Error.CANCEL;
+error = Http2Error.STREAM_CLOSED;
 }
 // Close the stream
 // This thread is in application code so need
diff --git a/test/org/apache/coyote/http2/TestHttp2Section_5_1.java 
b/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
index 6583b8d..3538516 100644
--- a/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
+++ b/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
@@ -316,7 +316,7 @@ public class TestHttp2Section_5_1 extends Http2TestBase {
 // Client reset triggers a write error which in turn triggers a 
server
 // reset
 parser.readFrame(true);
-Assert.assertEquals("3-RST-[8]\n", output.getTrace());
+Assert.assertEquals("3-RST-[5]\n", output.getTrace());
 output.clearTrace();
 
 // Open up the connection window.
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 1037b63..197eac9 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -110,6 +110,11 @@
 in the previous release to reduce the memory footprint of closed HTTP/2
 streams. (markt)
   
+  
+Refactor the HTTP/2 implementation to more consistently return a stream
+closed error if errors occur after a stream has been reset by the
+client. (markt)
+  
 
   
   


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



[tomcat] 02/03: Improve handling of flow control errors.

2020-08-18 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 244c938bc09649c246126c6be0b18029396e42fb
Author: Mark Thomas 
AuthorDate: Tue Aug 18 20:50:01 2020 +0100

Improve handling of flow control errors.
---
 java/org/apache/coyote/http2/Stream.java   |  1 +
 .../coyote/http2/WindowAllocationManager.java  | 38 --
 .../apache/coyote/http2/TestHttp2Section_5_1.java  |  4 +--
 webapps/docs/changelog.xml |  5 +++
 4 files changed, 29 insertions(+), 19 deletions(-)

diff --git a/java/org/apache/coyote/http2/Stream.java 
b/java/org/apache/coyote/http2/Stream.java
index 11e662b..00220dc 100644
--- a/java/org/apache/coyote/http2/Stream.java
+++ b/java/org/apache/coyote/http2/Stream.java
@@ -729,6 +729,7 @@ class Stream extends AbstractStream implements 
HeaderEmitter {
 se.getError()));
 }
 state.sendReset();
+cancelAllocationRequests();
 handler.sendStreamReset(se);
 } catch (IOException ioe) {
 ConnectionException ce = new ConnectionException(
diff --git a/java/org/apache/coyote/http2/WindowAllocationManager.java 
b/java/org/apache/coyote/http2/WindowAllocationManager.java
index f286430..973ce59 100644
--- a/java/org/apache/coyote/http2/WindowAllocationManager.java
+++ b/java/org/apache/coyote/http2/WindowAllocationManager.java
@@ -17,6 +17,7 @@
 package org.apache.coyote.http2;
 
 import org.apache.coyote.ActionCode;
+import org.apache.coyote.Response;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.util.res.StringManager;
@@ -184,24 +185,27 @@ class WindowAllocationManager {
 // to stream.notify(). Additional notify() calls may trigger
 // unexpected timeouts.
 waitingFor = NONE;
-if (stream.getCoyoteResponse().getWriteListener() == null) {
-// Blocking, so use notify to release StreamOutputBuffer
-if (log.isDebugEnabled()) {
-
log.debug(sm.getString("windowAllocationManager.notified",
-stream.getConnectionId(), 
stream.getIdentifier()));
+Response response = stream.getCoyoteResponse();
+if (response != null) {
+if (response.getWriteListener() == null) {
+// Blocking, so use notify to release 
StreamOutputBuffer
+if (log.isDebugEnabled()) {
+
log.debug(sm.getString("windowAllocationManager.notified",
+stream.getConnectionId(), 
stream.getIdentifier()));
+}
+stream.notify();
+} else {
+// Non-blocking so dispatch
+if (log.isDebugEnabled()) {
+
log.debug(sm.getString("windowAllocationManager.dispatched",
+stream.getConnectionId(), 
stream.getIdentifier()));
+}
+response.action(ActionCode.DISPATCH_WRITE, null);
+// Need to explicitly execute dispatches on the 
StreamProcessor
+// as this thread is being processed by an 
UpgradeProcessor
+// which won't see this dispatch
+response.action(ActionCode.DISPATCH_EXECUTE, null);
 }
-stream.notify();
-} else {
-// Non-blocking so dispatch
-if (log.isDebugEnabled()) {
-
log.debug(sm.getString("windowAllocationManager.dispatched",
-stream.getConnectionId(), 
stream.getIdentifier()));
-}
-
stream.getCoyoteResponse().action(ActionCode.DISPATCH_WRITE, null);
-// Need to explicitly execute dispatches on the 
StreamProcessor
-// as this thread is being processed by an UpgradeProcessor
-// which won't see this dispatch
-
stream.getCoyoteResponse().action(ActionCode.DISPATCH_EXECUTE, null);
 }
 }
 }
diff --git a/test/org/apache/coyote/http2/TestHttp2Section_5_1.java 
b/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
index 3538516..00c0495 100644
--- a/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
+++ b/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
@@ -374,8 +374,7 @@ public class TestHttp2Section_5_1 extends Http2TestBase {
 parser.readFrame(true);
 
 Assert.assertTrue(output.getTrace(),
-output.getTrace().contains("5-RST-[" +
-  

[tomcat] 03/03: Expand to ensure clean closure with connection flow control error

2020-08-18 Thread markt
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

commit 6b731d091c1976ba0ec4144bb51530ba46b6b338
Author: Mark Thomas 
AuthorDate: Tue Aug 18 21:12:46 2020 +0100

Expand to ensure clean closure with connection flow control error
---
 .../apache/coyote/http2/TestHttp2Section_5_1.java  | 63 +-
 1 file changed, 62 insertions(+), 1 deletion(-)

diff --git a/test/org/apache/coyote/http2/TestHttp2Section_5_1.java 
b/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
index 00c0495..6ec315a 100644
--- a/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
+++ b/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
@@ -334,7 +334,7 @@ public class TestHttp2Section_5_1 extends Http2TestBase {
 
 
 @Test
-public void testErrorOnWaitingStream() throws Exception {
+public void testErrorOnWaitingStream01() throws Exception {
 // http2Connect() - modified
 enableHttp2(1);
 configureAndStartWebApplication();
@@ -387,4 +387,65 @@ public class TestHttp2Section_5_1 extends Http2TestBase {
 parser.readFrame(true);
 Assert.assertEquals("3-RST-[" + 
Http2Error.FLOW_CONTROL_ERROR.getCode() + "]\n", output.getTrace());
 }
+
+
+@Test
+public void testErrorOnWaitingStream02() throws Exception {
+// http2Connect() - modified
+enableHttp2(1);
+configureAndStartWebApplication();
+openClientConnection();
+doHttpUpgrade();
+sendClientPreface();
+
+// validateHttp2InitialResponse() - modified
+parser.readFrame(true);
+parser.readFrame(true);
+parser.readFrame(true);
+parser.readFrame(true);
+parser.readFrame(true);
+
+Assert.assertEquals("0-Settings-[3]-[1]\n" +
+"0-Settings-End\n" +
+"0-Settings-Ack\n" +
+"0-Ping-[0,0,0,0,0,0,0,1]\n" +
+getSimpleResponseTrace(1)
+, output.getTrace());
+output.clearTrace();
+
+sendLargeGetRequest(3);
+
+sendSimpleGetRequest(5);
+
+// Default connection window size is 64k-1.
+// Initial request will have used 8k leaving 56k-1.
+// Stream window will be 64k-1.
+
+// Increase Connection window by 16k
+sendWindowUpdate(0, 16 * 1024);
+
+// Expecting
+// 1 * headers
+// 64k-1 of body (8 * ~8k)
+// 1 * error (could be in any order)
+for (int i = 0; i < 9; i++) {
+parser.readFrame(true);
+}
+parser.readFrame(true);
+
+Assert.assertTrue(output.getTrace(),
+output.getTrace().contains("5-RST-[" + 
Http2Error.REFUSED_STREAM.getCode() + "]"));
+output.clearTrace();
+
+// Connection window is 8k.
+// Stream window is zero.
+
+// Expand the connection window too much to trigger an error
+// Allow for the 8k still in the connection window
+sendWindowUpdate(0, (1 << 31) - 1);
+
+parser.readFrame(true);
+Assert.assertTrue(output.getTrace(),
+output.getTrace().contains("0-Goaway-[5]-[" + 
Http2Error.FLOW_CONTROL_ERROR.getCode() + "]"));
+}
 }


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



[tomcat] branch 9.0.x updated (437a8dd -> 6b731d0)

2020-08-18 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a change to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git.


from 437a8dd  Re-word
 new d9669e4  Refactor for more consistent error code after client sends 
stream reset
 new 342b7cd  Improve handling of flow control errors.
 new 6b731d0  Expand to ensure clean closure with connection flow control 
error

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/coyote/http2/Http2UpgradeHandler.java   |  7 +--
 java/org/apache/coyote/http2/Stream.java   |  1 +
 .../coyote/http2/WindowAllocationManager.java  | 38 ++--
 .../apache/coyote/http2/TestHttp2Section_5_1.java  | 69 --
 webapps/docs/changelog.xml | 10 
 5 files changed, 99 insertions(+), 26 deletions(-)


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



[tomcat] 03/03: Expand to ensure clean closure with connection flow control error

2020-08-18 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit ae5e5a96d51f3e826f5401300e99d5d378038e12
Author: Mark Thomas 
AuthorDate: Tue Aug 18 21:12:46 2020 +0100

Expand to ensure clean closure with connection flow control error
---
 .../apache/coyote/http2/TestHttp2Section_5_1.java  | 63 +-
 1 file changed, 62 insertions(+), 1 deletion(-)

diff --git a/test/org/apache/coyote/http2/TestHttp2Section_5_1.java 
b/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
index 00c0495..6ec315a 100644
--- a/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
+++ b/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
@@ -334,7 +334,7 @@ public class TestHttp2Section_5_1 extends Http2TestBase {
 
 
 @Test
-public void testErrorOnWaitingStream() throws Exception {
+public void testErrorOnWaitingStream01() throws Exception {
 // http2Connect() - modified
 enableHttp2(1);
 configureAndStartWebApplication();
@@ -387,4 +387,65 @@ public class TestHttp2Section_5_1 extends Http2TestBase {
 parser.readFrame(true);
 Assert.assertEquals("3-RST-[" + 
Http2Error.FLOW_CONTROL_ERROR.getCode() + "]\n", output.getTrace());
 }
+
+
+@Test
+public void testErrorOnWaitingStream02() throws Exception {
+// http2Connect() - modified
+enableHttp2(1);
+configureAndStartWebApplication();
+openClientConnection();
+doHttpUpgrade();
+sendClientPreface();
+
+// validateHttp2InitialResponse() - modified
+parser.readFrame(true);
+parser.readFrame(true);
+parser.readFrame(true);
+parser.readFrame(true);
+parser.readFrame(true);
+
+Assert.assertEquals("0-Settings-[3]-[1]\n" +
+"0-Settings-End\n" +
+"0-Settings-Ack\n" +
+"0-Ping-[0,0,0,0,0,0,0,1]\n" +
+getSimpleResponseTrace(1)
+, output.getTrace());
+output.clearTrace();
+
+sendLargeGetRequest(3);
+
+sendSimpleGetRequest(5);
+
+// Default connection window size is 64k-1.
+// Initial request will have used 8k leaving 56k-1.
+// Stream window will be 64k-1.
+
+// Increase Connection window by 16k
+sendWindowUpdate(0, 16 * 1024);
+
+// Expecting
+// 1 * headers
+// 64k-1 of body (8 * ~8k)
+// 1 * error (could be in any order)
+for (int i = 0; i < 9; i++) {
+parser.readFrame(true);
+}
+parser.readFrame(true);
+
+Assert.assertTrue(output.getTrace(),
+output.getTrace().contains("5-RST-[" + 
Http2Error.REFUSED_STREAM.getCode() + "]"));
+output.clearTrace();
+
+// Connection window is 8k.
+// Stream window is zero.
+
+// Expand the connection window too much to trigger an error
+// Allow for the 8k still in the connection window
+sendWindowUpdate(0, (1 << 31) - 1);
+
+parser.readFrame(true);
+Assert.assertTrue(output.getTrace(),
+output.getTrace().contains("0-Goaway-[5]-[" + 
Http2Error.FLOW_CONTROL_ERROR.getCode() + "]"));
+}
 }


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



[tomcat] branch master updated (e83d79e -> ae5e5a9)

2020-08-18 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git.


from e83d79e  Re-word
 new ff027c4  Refactor for more consistent error code after client sends 
stream reset
 new 244c938  Improve handling of flow control errors.
 new ae5e5a9  Expand to ensure clean closure with connection flow control 
error

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/coyote/http2/Http2UpgradeHandler.java   |  7 +--
 java/org/apache/coyote/http2/Stream.java   |  1 +
 .../coyote/http2/WindowAllocationManager.java  | 38 ++--
 .../apache/coyote/http2/TestHttp2Section_5_1.java  | 69 --
 webapps/docs/changelog.xml | 10 
 5 files changed, 99 insertions(+), 26 deletions(-)


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



[tomcat] 01/03: Refactor for more consistent error code after client sends stream reset

2020-08-18 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit ff027c479e585a3454c4928d7310841ec71b8075
Author: Mark Thomas 
AuthorDate: Tue Aug 18 20:24:53 2020 +0100

Refactor for more consistent error code after client sends stream reset
---
 java/org/apache/coyote/http2/Http2UpgradeHandler.java  | 7 ++-
 test/org/apache/coyote/http2/TestHttp2Section_5_1.java | 2 +-
 webapps/docs/changelog.xml | 5 +
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java 
b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
index c5c36df..bb5e038 100644
--- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
@@ -36,7 +36,6 @@ import java.util.concurrent.atomic.AtomicReference;
 import jakarta.servlet.http.WebConnection;
 
 import org.apache.coyote.Adapter;
-import org.apache.coyote.CloseNowException;
 import org.apache.coyote.ProtocolException;
 import org.apache.coyote.Request;
 import org.apache.coyote.http11.upgrade.InternalHttpUpgradeHandler;
@@ -839,9 +838,7 @@ class Http2UpgradeHandler extends AbstractStream implements 
InternalHttpUpgradeH
 do {
 synchronized (this) {
 if (!stream.canWrite()) {
-throw new CloseNowException(
-
sm.getString("upgradeHandler.stream.notWritable",
-stream.getConnectionId(), 
stream.getIdentifier()));
+
stream.doStreamCancel(sm.getString("upgradeHandler.stream.notWritable"), 
Http2Error.STREAM_CLOSED);
 }
 long windowSize = getWindowSize();
 if (windowSize < 1 || backLogSize > 0) {
@@ -913,7 +910,7 @@ class Http2UpgradeHandler extends AbstractStream implements 
InternalHttpUpgradeH
 error = Http2Error.ENHANCE_YOUR_CALM;
 } else {
 msg = sm.getString("stream.clientCancel");
-error = Http2Error.CANCEL;
+error = Http2Error.STREAM_CLOSED;
 }
 // Close the stream
 // This thread is in application code so need
diff --git a/test/org/apache/coyote/http2/TestHttp2Section_5_1.java 
b/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
index 6583b8d..3538516 100644
--- a/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
+++ b/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
@@ -316,7 +316,7 @@ public class TestHttp2Section_5_1 extends Http2TestBase {
 // Client reset triggers a write error which in turn triggers a 
server
 // reset
 parser.readFrame(true);
-Assert.assertEquals("3-RST-[8]\n", output.getTrace());
+Assert.assertEquals("3-RST-[5]\n", output.getTrace());
 output.clearTrace();
 
 // Open up the connection window.
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 5908d93..de49ffc 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -114,6 +114,11 @@
 in the previous release to reduce the memory footprint of closed HTTP/2
 streams. (markt)
   
+  
+Refactor the HTTP/2 implementation to more consistently return a stream
+closed error if errors occur after a stream has been reset by the
+client. (markt)
+  
 
   
   


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



[tomcat] branch 8.5.x updated: Re-word

2020-08-18 Thread markt
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


The following commit(s) were added to refs/heads/8.5.x by this push:
 new 50ae519  Re-word
50ae519 is described below

commit 50ae519c9f7539c4112f5368af8e3acadb65e2a1
Author: Mark Thomas 
AuthorDate: Tue Aug 18 16:50:24 2020 +0100

Re-word
---
 java/org/apache/coyote/AbstractProcessor.java | 2 +-
 java/org/apache/coyote/http2/Http2UpgradeHandler.java | 4 ++--
 java/org/apache/coyote/http2/LocalStrings.properties  | 2 +-
 java/org/apache/coyote/http2/Stream.java  | 4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/java/org/apache/coyote/AbstractProcessor.java 
b/java/org/apache/coyote/AbstractProcessor.java
index 646578d..abd73da 100644
--- a/java/org/apache/coyote/AbstractProcessor.java
+++ b/java/org/apache/coyote/AbstractProcessor.java
@@ -438,7 +438,7 @@ public abstract class AbstractProcessor extends 
AbstractProcessorLight implement
 break;
 }
 case DISABLE_SWALLOW_INPUT: {
-// Aborted upload or similar.
+// Cancelled upload or similar.
 // No point reading the remainder of the request.
 disableSwallowRequest();
 // This is an error state. Make sure it is marked as such.
diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java 
b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
index 8f34a40..08ff5e7 100644
--- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
@@ -909,14 +909,14 @@ public class Http2UpgradeHandler extends AbstractStream 
implements InternalHttpU
 msg = sm.getString("stream.writeTimeout");
 error = Http2Error.ENHANCE_YOUR_CALM;
 } else {
-msg = sm.getString("stream.clientAbort");
+msg = sm.getString("stream.clientCancel");
 error = Http2Error.CANCEL;
 }
 // Close the stream
 // This thread is in application code so need
 // to signal to the application that the
 // stream is closing
-stream.doStreamAbort(msg, error);
+stream.doStreamCancel(msg, error);
 }
 } catch (InterruptedException e) {
 throw new IOException(sm.getString(
diff --git a/java/org/apache/coyote/http2/LocalStrings.properties 
b/java/org/apache/coyote/http2/LocalStrings.properties
index 36a33cf..596b126 100644
--- a/java/org/apache/coyote/http2/LocalStrings.properties
+++ b/java/org/apache/coyote/http2/LocalStrings.properties
@@ -73,7 +73,7 @@ http2Parser.swallow.debug=Connection [{0}], Stream [{1}], 
Swallowed [{2}] bytes
 
 pingManager.roundTripTime=Connection [{0}] Round trip time measured as [{1}]ns
 
-stream.clientAbort=Client reset the stream before the response was complete
+stream.clientCancel=Client reset the stream before the response was complete
 stream.closed=Connection [{0}], Stream [{1}], Unable to write to stream once 
it has been closed
 stream.header.case=Connection [{0}], Stream [{1}], HTTP header name [{2}] must 
be in lower case
 stream.header.connection=Connection [{0}], Stream [{1}], HTTP header 
[connection] is not permitted in an HTTP/2 request
diff --git a/java/org/apache/coyote/http2/Stream.java 
b/java/org/apache/coyote/http2/Stream.java
index 189bdfb..1927fe7 100644
--- a/java/org/apache/coyote/http2/Stream.java
+++ b/java/org/apache/coyote/http2/Stream.java
@@ -272,7 +272,7 @@ public class Stream extends AbstractStream implements 
HeaderEmitter {
 allocationManager.waitForStream(writeTimeout);
 windowSize = getWindowSize();
 if (windowSize == 0) {
-doStreamAbort(sm.getString("stream.writeTimeout"), 
Http2Error.ENHANCE_YOUR_CALM);
+doStreamCancel(sm.getString("stream.writeTimeout"), 
Http2Error.ENHANCE_YOUR_CALM);
 }
 } catch (InterruptedException e) {
 // Possible shutdown / rst or similar. Use an IOException 
to
@@ -296,7 +296,7 @@ public class Stream extends AbstractStream implements 
HeaderEmitter {
 }
 
 
-void doStreamAbort(String msg, Http2Error error) throws CloseNowException {
+void doStreamCancel(String msg, Http2Error error) throws CloseNowException 
{
 StreamException se = new StreamException(msg, error, getIdAsInt());
 // Prevent the application making further writes
 streamOutputBuffer.closed = 

[tomcat] branch 9.0.x updated: Re-word

2020-08-18 Thread markt
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 437a8dd  Re-word
437a8dd is described below

commit 437a8dd7c64286d6d84a3f6d1c922de2ff211fb7
Author: Mark Thomas 
AuthorDate: Tue Aug 18 16:50:24 2020 +0100

Re-word
---
 java/org/apache/coyote/AbstractProcessor.java | 2 +-
 java/org/apache/coyote/http2/Http2UpgradeHandler.java | 4 ++--
 java/org/apache/coyote/http2/LocalStrings.properties  | 2 +-
 java/org/apache/coyote/http2/Stream.java  | 4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/java/org/apache/coyote/AbstractProcessor.java 
b/java/org/apache/coyote/AbstractProcessor.java
index 87d504a..3ab18dd 100644
--- a/java/org/apache/coyote/AbstractProcessor.java
+++ b/java/org/apache/coyote/AbstractProcessor.java
@@ -433,7 +433,7 @@ public abstract class AbstractProcessor extends 
AbstractProcessorLight implement
 break;
 }
 case DISABLE_SWALLOW_INPUT: {
-// Aborted upload or similar.
+// Cancelled upload or similar.
 // No point reading the remainder of the request.
 disableSwallowRequest();
 // This is an error state. Make sure it is marked as such.
diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java 
b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
index d5da3dc..367fe95 100644
--- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
@@ -912,14 +912,14 @@ class Http2UpgradeHandler extends AbstractStream 
implements InternalHttpUpgradeH
 msg = sm.getString("stream.writeTimeout");
 error = Http2Error.ENHANCE_YOUR_CALM;
 } else {
-msg = sm.getString("stream.clientAbort");
+msg = sm.getString("stream.clientCancel");
 error = Http2Error.CANCEL;
 }
 // Close the stream
 // This thread is in application code so need
 // to signal to the application that the
 // stream is closing
-stream.doStreamAbort(msg, error);
+stream.doStreamCancel(msg, error);
 }
 } catch (InterruptedException e) {
 throw new IOException(sm.getString(
diff --git a/java/org/apache/coyote/http2/LocalStrings.properties 
b/java/org/apache/coyote/http2/LocalStrings.properties
index fadfa0f..4ba59c1 100644
--- a/java/org/apache/coyote/http2/LocalStrings.properties
+++ b/java/org/apache/coyote/http2/LocalStrings.properties
@@ -74,7 +74,7 @@ http2Parser.swallow.debug=Connection [{0}], Stream [{1}], 
Swallowed [{2}] bytes
 
 pingManager.roundTripTime=Connection [{0}] Round trip time measured as [{1}]ns
 
-stream.clientAbort=Client reset the stream before the response was complete
+stream.clientCancel=Client reset the stream before the response was complete
 stream.closed=Connection [{0}], Stream [{1}], Unable to write to stream once 
it has been closed
 stream.header.case=Connection [{0}], Stream [{1}], HTTP header name [{2}] must 
be in lower case
 stream.header.connection=Connection [{0}], Stream [{1}], HTTP header 
[connection] is not permitted in an HTTP/2 request
diff --git a/java/org/apache/coyote/http2/Stream.java 
b/java/org/apache/coyote/http2/Stream.java
index fe69f8f..2f40e28 100644
--- a/java/org/apache/coyote/http2/Stream.java
+++ b/java/org/apache/coyote/http2/Stream.java
@@ -275,7 +275,7 @@ class Stream extends AbstractStream implements 
HeaderEmitter {
 allocationManager.waitForStream(writeTimeout);
 windowSize = getWindowSize();
 if (windowSize == 0) {
-doStreamAbort(sm.getString("stream.writeTimeout"), 
Http2Error.ENHANCE_YOUR_CALM);
+doStreamCancel(sm.getString("stream.writeTimeout"), 
Http2Error.ENHANCE_YOUR_CALM);
 }
 } catch (InterruptedException e) {
 // Possible shutdown / rst or similar. Use an IOException 
to
@@ -299,7 +299,7 @@ class Stream extends AbstractStream implements 
HeaderEmitter {
 }
 
 
-void doStreamAbort(String msg, Http2Error error) throws CloseNowException {
+void doStreamCancel(String msg, Http2Error error) throws CloseNowException 
{
 StreamException se = new StreamException(msg, error, getIdAsInt());
 // Prevent the application making further writes
 streamOutputBuffer.closed = true;



[tomcat] branch master updated: Re-word

2020-08-18 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new e83d79e  Re-word
e83d79e is described below

commit e83d79e2f9f01e1088ada8eb2e40c6bdda08dab9
Author: Mark Thomas 
AuthorDate: Tue Aug 18 16:50:24 2020 +0100

Re-word
---
 java/org/apache/coyote/AbstractProcessor.java | 2 +-
 java/org/apache/coyote/http2/Http2UpgradeHandler.java | 4 ++--
 java/org/apache/coyote/http2/LocalStrings.properties  | 2 +-
 java/org/apache/coyote/http2/Stream.java  | 4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/java/org/apache/coyote/AbstractProcessor.java 
b/java/org/apache/coyote/AbstractProcessor.java
index 46b96a0..01b71c0 100644
--- a/java/org/apache/coyote/AbstractProcessor.java
+++ b/java/org/apache/coyote/AbstractProcessor.java
@@ -433,7 +433,7 @@ public abstract class AbstractProcessor extends 
AbstractProcessorLight implement
 break;
 }
 case DISABLE_SWALLOW_INPUT: {
-// Aborted upload or similar.
+// Cancelled upload or similar.
 // No point reading the remainder of the request.
 disableSwallowRequest();
 // This is an error state. Make sure it is marked as such.
diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java 
b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
index 5ca89be..c5c36df 100644
--- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
@@ -912,14 +912,14 @@ class Http2UpgradeHandler extends AbstractStream 
implements InternalHttpUpgradeH
 msg = sm.getString("stream.writeTimeout");
 error = Http2Error.ENHANCE_YOUR_CALM;
 } else {
-msg = sm.getString("stream.clientAbort");
+msg = sm.getString("stream.clientCancel");
 error = Http2Error.CANCEL;
 }
 // Close the stream
 // This thread is in application code so need
 // to signal to the application that the
 // stream is closing
-stream.doStreamAbort(msg, error);
+stream.doStreamCancel(msg, error);
 }
 } catch (InterruptedException e) {
 throw new IOException(sm.getString(
diff --git a/java/org/apache/coyote/http2/LocalStrings.properties 
b/java/org/apache/coyote/http2/LocalStrings.properties
index fadfa0f..4ba59c1 100644
--- a/java/org/apache/coyote/http2/LocalStrings.properties
+++ b/java/org/apache/coyote/http2/LocalStrings.properties
@@ -74,7 +74,7 @@ http2Parser.swallow.debug=Connection [{0}], Stream [{1}], 
Swallowed [{2}] bytes
 
 pingManager.roundTripTime=Connection [{0}] Round trip time measured as [{1}]ns
 
-stream.clientAbort=Client reset the stream before the response was complete
+stream.clientCancel=Client reset the stream before the response was complete
 stream.closed=Connection [{0}], Stream [{1}], Unable to write to stream once 
it has been closed
 stream.header.case=Connection [{0}], Stream [{1}], HTTP header name [{2}] must 
be in lower case
 stream.header.connection=Connection [{0}], Stream [{1}], HTTP header 
[connection] is not permitted in an HTTP/2 request
diff --git a/java/org/apache/coyote/http2/Stream.java 
b/java/org/apache/coyote/http2/Stream.java
index fbc550a..11e662b 100644
--- a/java/org/apache/coyote/http2/Stream.java
+++ b/java/org/apache/coyote/http2/Stream.java
@@ -275,7 +275,7 @@ class Stream extends AbstractStream implements 
HeaderEmitter {
 allocationManager.waitForStream(writeTimeout);
 windowSize = getWindowSize();
 if (windowSize == 0) {
-doStreamAbort(sm.getString("stream.writeTimeout"), 
Http2Error.ENHANCE_YOUR_CALM);
+doStreamCancel(sm.getString("stream.writeTimeout"), 
Http2Error.ENHANCE_YOUR_CALM);
 }
 } catch (InterruptedException e) {
 // Possible shutdown / rst or similar. Use an IOException 
to
@@ -299,7 +299,7 @@ class Stream extends AbstractStream implements 
HeaderEmitter {
 }
 
 
-void doStreamAbort(String msg, Http2Error error) throws CloseNowException {
+void doStreamCancel(String msg, Http2Error error) throws CloseNowException 
{
 StreamException se = new StreamException(msg, error, getIdAsInt());
 // Prevent the application making further writes
 streamOutputBuffer.closed = true;



[tomcat] branch 7.0.x updated: Change calculation of new file times to avoid Travis failures

2020-08-18 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/7.0.x by this push:
 new 43a964e  Change calculation of new file times to avoid Travis failures
43a964e is described below

commit 43a964eeed265af60c97a718c7bf7a51968f0cca
Author: Mark Thomas 
AuthorDate: Tue Aug 18 16:45:16 2020 +0100

Change calculation of new file times to avoid Travis failures

Sometimes deployment would take ~8s on Travis. Using a new modification
time of current time - 10 seconds meant the new time was within 1s of
the old time and, therefore, not seen as different by Tomcat.
---
 .../startup/TestHostConfigAutomaticDeployment.java | 30 ++
 1 file changed, 14 insertions(+), 16 deletions(-)

diff --git 
a/test/org/apache/catalina/startup/TestHostConfigAutomaticDeployment.java 
b/test/org/apache/catalina/startup/TestHostConfigAutomaticDeployment.java
index 319636b..dd4b181 100644
--- a/test/org/apache/catalina/startup/TestHostConfigAutomaticDeployment.java
+++ b/test/org/apache/catalina/startup/TestHostConfigAutomaticDeployment.java
@@ -1097,6 +1097,8 @@ public class TestHostConfigAutomaticDeployment extends 
TomcatBaseTest {
 File war = null;
 File dir = null;
 
+long testStartTime = System.currentTimeMillis();
+
 if (startXml && !startExternalWar && !startExternalDir) {
 xml = createXmlInConfigBaseForAppbase();
 }
@@ -1130,40 +1132,36 @@ public class TestHostConfigAutomaticDeployment extends 
TomcatBaseTest {
 if (xml == null) {
 Assert.fail();
 } else {
-xml.setLastModified(System.currentTimeMillis() -
-10 * HostConfig.FILE_MODIFICATION_RESOLUTION_MS);
+Assert.assertTrue("Failed to set last modified for [" + 
xml + "]. " +
+"This is expected (due to a JVM bug) with Java 6 
on Windows.", xml.setLastModified(
+testStartTime - 10 * 
HostConfig.FILE_MODIFICATION_RESOLUTION_MS));
 }
 break;
 case EXT:
 if (ext == null) {
 Assert.fail();
 } else {
-if (!ext.setLastModified(System.currentTimeMillis() -
-10 * HostConfig.FILE_MODIFICATION_RESOLUTION_MS)){
-Assert.fail("Failed to set last modified time for " +
-"external WAR file. This is expected (due to " 
+
-"a JVM bug) with Java 6 on Windows.");
-}
+Assert.assertTrue("Failed to set last modified for [" + 
ext + "]. " +
+"This is expected (due to a JVM bug) with Java 6 
on Windows.", ext.setLastModified(
+testStartTime - 10 * 
HostConfig.FILE_MODIFICATION_RESOLUTION_MS));
 }
 break;
 case WAR:
 if (war == null) {
 Assert.fail();
 } else {
-if (!war.setLastModified(System.currentTimeMillis() -
-10 * HostConfig.FILE_MODIFICATION_RESOLUTION_MS)) {
-Assert.fail("Failed to set last modified time for WAR 
" +
-"file. This is expected (due to a JVM bug) " +
-"with Java 6 on Windows.");
-}
+Assert.assertTrue("Failed to set last modified for [" + 
war + "]. " +
+"This is expected (due to a JVM bug) with Java 6 
on Windows.", war.setLastModified(
+testStartTime - 10 * 
HostConfig.FILE_MODIFICATION_RESOLUTION_MS));
 }
 break;
 case DIR:
 if (dir == null) {
 Assert.fail();
 } else {
-dir.setLastModified(System.currentTimeMillis() -
-10 * HostConfig.FILE_MODIFICATION_RESOLUTION_MS);
+Assert.assertTrue("Failed to set last modified for [" + 
dir + "]. " +
+"This is expected (due to a JVM bug) with Java 6 
on Windows.", dir.setLastModified(
+testStartTime - 10 * 
HostConfig.FILE_MODIFICATION_RESOLUTION_MS));
 }
 break;
 default:


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



[tomcat] branch 8.5.x updated: Change calculation of new file times to avoid Travis failures

2020-08-18 Thread markt
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


The following commit(s) were added to refs/heads/8.5.x by this push:
 new 33a71ab  Change calculation of new file times to avoid Travis failures
33a71ab is described below

commit 33a71ab42ac0a7d37ca39e79bfc8001ed68dd1c8
Author: Mark Thomas 
AuthorDate: Tue Aug 18 16:37:00 2020 +0100

Change calculation of new file times to avoid Travis failures

Sometimes deployment would take ~8s on Travis. Using a new modification
time of current time - 10 seconds meant the new time was within 1s of
the old time and, therefore, not seen as different by Tomcat.
---
 .../startup/TestHostConfigAutomaticDeployment.java | 14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git 
a/test/org/apache/catalina/startup/TestHostConfigAutomaticDeployment.java 
b/test/org/apache/catalina/startup/TestHostConfigAutomaticDeployment.java
index d37b765..9769f77 100644
--- a/test/org/apache/catalina/startup/TestHostConfigAutomaticDeployment.java
+++ b/test/org/apache/catalina/startup/TestHostConfigAutomaticDeployment.java
@@ -1090,6 +1090,8 @@ public class TestHostConfigAutomaticDeployment extends 
TomcatBaseTest {
 File war = null;
 File dir = null;
 
+long testStartTime = System.currentTimeMillis();
+
 if (startXml && !startExternalWar && !startExternalDir) {
 xml = createXmlInConfigBaseForAppbase();
 }
@@ -1117,14 +1119,16 @@ public class TestHostConfigAutomaticDeployment extends 
TomcatBaseTest {
 host.backgroundProcess();
 
 // Update the last modified time. Make sure that the OS reports a 
change
-// in modification time that HostConfig can detect.
+// in modification time that HostConfig can detect. Change is made
+// relative to test start time to ensure new modification times are
+// sufficiently different.
 switch (toModify) {
 case XML:
 if (xml == null) {
 Assert.fail();
 } else {
 Assert.assertTrue("Failed to set last modified for [" + 
xml + "]", xml.setLastModified(
-System.currentTimeMillis() - 10 * 
HostConfig.FILE_MODIFICATION_RESOLUTION_MS));
+testStartTime - 10 * 
HostConfig.FILE_MODIFICATION_RESOLUTION_MS));
 }
 break;
 case EXT:
@@ -1132,7 +1136,7 @@ public class TestHostConfigAutomaticDeployment extends 
TomcatBaseTest {
 Assert.fail();
 } else {
 Assert.assertTrue("Failed to set last modified for [" + 
ext + "]", ext.setLastModified(
-System.currentTimeMillis() - 10 * 
HostConfig.FILE_MODIFICATION_RESOLUTION_MS));
+testStartTime - 10 * 
HostConfig.FILE_MODIFICATION_RESOLUTION_MS));
 }
 break;
 case WAR:
@@ -1140,7 +1144,7 @@ public class TestHostConfigAutomaticDeployment extends 
TomcatBaseTest {
 Assert.fail();
 } else {
 Assert.assertTrue("Failed to set last modified for [" + 
war + "]", war.setLastModified(
-System.currentTimeMillis() - 10 * 
HostConfig.FILE_MODIFICATION_RESOLUTION_MS));
+testStartTime - 10 * 
HostConfig.FILE_MODIFICATION_RESOLUTION_MS));
 }
 break;
 case DIR:
@@ -1148,7 +1152,7 @@ public class TestHostConfigAutomaticDeployment extends 
TomcatBaseTest {
 Assert.fail();
 } else {
 Assert.assertTrue("Failed to set last modified for [" + 
dir + "]", dir.setLastModified(
-System.currentTimeMillis() - 10 * 
HostConfig.FILE_MODIFICATION_RESOLUTION_MS));
+testStartTime - 10 * 
HostConfig.FILE_MODIFICATION_RESOLUTION_MS));
 }
 break;
 default:


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



[tomcat] branch 9.0.x updated: Change calculation of new file times to avoid Travis failures

2020-08-18 Thread markt
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 0b6b24b  Change calculation of new file times to avoid Travis failures
0b6b24b is described below

commit 0b6b24b765db159b92262c9c1804e104e6da44d5
Author: Mark Thomas 
AuthorDate: Tue Aug 18 16:37:00 2020 +0100

Change calculation of new file times to avoid Travis failures

Sometimes deployment would take ~8s on Travis. Using a new modification
time of current time - 10 seconds meant the new time was within 1s of
the old time and, therefore, not seen as different by Tomcat.
---
 .../startup/TestHostConfigAutomaticDeployment.java | 14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git 
a/test/org/apache/catalina/startup/TestHostConfigAutomaticDeployment.java 
b/test/org/apache/catalina/startup/TestHostConfigAutomaticDeployment.java
index d37b765..9769f77 100644
--- a/test/org/apache/catalina/startup/TestHostConfigAutomaticDeployment.java
+++ b/test/org/apache/catalina/startup/TestHostConfigAutomaticDeployment.java
@@ -1090,6 +1090,8 @@ public class TestHostConfigAutomaticDeployment extends 
TomcatBaseTest {
 File war = null;
 File dir = null;
 
+long testStartTime = System.currentTimeMillis();
+
 if (startXml && !startExternalWar && !startExternalDir) {
 xml = createXmlInConfigBaseForAppbase();
 }
@@ -1117,14 +1119,16 @@ public class TestHostConfigAutomaticDeployment extends 
TomcatBaseTest {
 host.backgroundProcess();
 
 // Update the last modified time. Make sure that the OS reports a 
change
-// in modification time that HostConfig can detect.
+// in modification time that HostConfig can detect. Change is made
+// relative to test start time to ensure new modification times are
+// sufficiently different.
 switch (toModify) {
 case XML:
 if (xml == null) {
 Assert.fail();
 } else {
 Assert.assertTrue("Failed to set last modified for [" + 
xml + "]", xml.setLastModified(
-System.currentTimeMillis() - 10 * 
HostConfig.FILE_MODIFICATION_RESOLUTION_MS));
+testStartTime - 10 * 
HostConfig.FILE_MODIFICATION_RESOLUTION_MS));
 }
 break;
 case EXT:
@@ -1132,7 +1136,7 @@ public class TestHostConfigAutomaticDeployment extends 
TomcatBaseTest {
 Assert.fail();
 } else {
 Assert.assertTrue("Failed to set last modified for [" + 
ext + "]", ext.setLastModified(
-System.currentTimeMillis() - 10 * 
HostConfig.FILE_MODIFICATION_RESOLUTION_MS));
+testStartTime - 10 * 
HostConfig.FILE_MODIFICATION_RESOLUTION_MS));
 }
 break;
 case WAR:
@@ -1140,7 +1144,7 @@ public class TestHostConfigAutomaticDeployment extends 
TomcatBaseTest {
 Assert.fail();
 } else {
 Assert.assertTrue("Failed to set last modified for [" + 
war + "]", war.setLastModified(
-System.currentTimeMillis() - 10 * 
HostConfig.FILE_MODIFICATION_RESOLUTION_MS));
+testStartTime - 10 * 
HostConfig.FILE_MODIFICATION_RESOLUTION_MS));
 }
 break;
 case DIR:
@@ -1148,7 +1152,7 @@ public class TestHostConfigAutomaticDeployment extends 
TomcatBaseTest {
 Assert.fail();
 } else {
 Assert.assertTrue("Failed to set last modified for [" + 
dir + "]", dir.setLastModified(
-System.currentTimeMillis() - 10 * 
HostConfig.FILE_MODIFICATION_RESOLUTION_MS));
+testStartTime - 10 * 
HostConfig.FILE_MODIFICATION_RESOLUTION_MS));
 }
 break;
 default:


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



[tomcat] branch master updated: Change calculation of new file times to avoid Travis failures

2020-08-18 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new f84b8f2  Change calculation of new file times to avoid Travis failures
f84b8f2 is described below

commit f84b8f23a975b3999137afc3796a73d557fed00b
Author: Mark Thomas 
AuthorDate: Tue Aug 18 16:37:00 2020 +0100

Change calculation of new file times to avoid Travis failures

Sometimes deployment would take ~8s on Travis. Using a new modification
time of current time - 10 seconds meant the new time was within 1s of
the old time and, therefore, not seen as different by Tomcat.
---
 .../startup/TestHostConfigAutomaticDeployment.java | 14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git 
a/test/org/apache/catalina/startup/TestHostConfigAutomaticDeployment.java 
b/test/org/apache/catalina/startup/TestHostConfigAutomaticDeployment.java
index d37b765..9769f77 100644
--- a/test/org/apache/catalina/startup/TestHostConfigAutomaticDeployment.java
+++ b/test/org/apache/catalina/startup/TestHostConfigAutomaticDeployment.java
@@ -1090,6 +1090,8 @@ public class TestHostConfigAutomaticDeployment extends 
TomcatBaseTest {
 File war = null;
 File dir = null;
 
+long testStartTime = System.currentTimeMillis();
+
 if (startXml && !startExternalWar && !startExternalDir) {
 xml = createXmlInConfigBaseForAppbase();
 }
@@ -1117,14 +1119,16 @@ public class TestHostConfigAutomaticDeployment extends 
TomcatBaseTest {
 host.backgroundProcess();
 
 // Update the last modified time. Make sure that the OS reports a 
change
-// in modification time that HostConfig can detect.
+// in modification time that HostConfig can detect. Change is made
+// relative to test start time to ensure new modification times are
+// sufficiently different.
 switch (toModify) {
 case XML:
 if (xml == null) {
 Assert.fail();
 } else {
 Assert.assertTrue("Failed to set last modified for [" + 
xml + "]", xml.setLastModified(
-System.currentTimeMillis() - 10 * 
HostConfig.FILE_MODIFICATION_RESOLUTION_MS));
+testStartTime - 10 * 
HostConfig.FILE_MODIFICATION_RESOLUTION_MS));
 }
 break;
 case EXT:
@@ -1132,7 +1136,7 @@ public class TestHostConfigAutomaticDeployment extends 
TomcatBaseTest {
 Assert.fail();
 } else {
 Assert.assertTrue("Failed to set last modified for [" + 
ext + "]", ext.setLastModified(
-System.currentTimeMillis() - 10 * 
HostConfig.FILE_MODIFICATION_RESOLUTION_MS));
+testStartTime - 10 * 
HostConfig.FILE_MODIFICATION_RESOLUTION_MS));
 }
 break;
 case WAR:
@@ -1140,7 +1144,7 @@ public class TestHostConfigAutomaticDeployment extends 
TomcatBaseTest {
 Assert.fail();
 } else {
 Assert.assertTrue("Failed to set last modified for [" + 
war + "]", war.setLastModified(
-System.currentTimeMillis() - 10 * 
HostConfig.FILE_MODIFICATION_RESOLUTION_MS));
+testStartTime - 10 * 
HostConfig.FILE_MODIFICATION_RESOLUTION_MS));
 }
 break;
 case DIR:
@@ -1148,7 +1152,7 @@ public class TestHostConfigAutomaticDeployment extends 
TomcatBaseTest {
 Assert.fail();
 } else {
 Assert.assertTrue("Failed to set last modified for [" + 
dir + "]", dir.setLastModified(
-System.currentTimeMillis() - 10 * 
HostConfig.FILE_MODIFICATION_RESOLUTION_MS));
+testStartTime - 10 * 
HostConfig.FILE_MODIFICATION_RESOLUTION_MS));
 }
 break;
 default:


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



[tomcat] branch 8.5.x updated: Additional debug logging

2020-08-18 Thread markt
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


The following commit(s) were added to refs/heads/8.5.x by this push:
 new 7db379b  Additional debug logging
7db379b is described below

commit 7db379bf5ee649a80ed30063ddced829e439f744
Author: Mark Thomas 
AuthorDate: Tue Aug 18 15:53:08 2020 +0100

Additional debug logging
---
 .../apache/coyote/http2/TestHttp2Section_5_1.java  | 120 +++--
 .../tomcat/websocket/TestWebSocketFrameClient.java |   2 +-
 2 files changed, 66 insertions(+), 56 deletions(-)

diff --git a/test/org/apache/coyote/http2/TestHttp2Section_5_1.java 
b/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
index 9375516..7bf83dd 100644
--- a/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
+++ b/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
@@ -17,6 +17,8 @@
 package org.apache.coyote.http2;
 
 import java.nio.ByteBuffer;
+import java.util.logging.Level;
+import java.util.logging.LogManager;
 
 import org.junit.Assert;
 import org.junit.Test;
@@ -263,68 +265,76 @@ public class TestHttp2Section_5_1 extends Http2TestBase {
 @Test
 public void testExceedMaxActiveStreams02() throws Exception {
 
-// http2Connect() - modified
-enableHttp2(1);
-configureAndStartWebApplication();
-openClientConnection();
-doHttpUpgrade();
-sendClientPreface();
+
LogManager.getLogManager().getLogger("org.apache.coyote").setLevel(Level.ALL);
+try {
+// temporary debug logging to investigate intermittent CI failures
 
-// validateHttp2InitialResponse() - modified
-parser.readFrame(true);
-parser.readFrame(true);
-parser.readFrame(true);
-parser.readFrame(true);
-parser.readFrame(true);
 
-Assert.assertEquals("0-Settings-[3]-[1]\n" +
-"0-Settings-End\n" +
-"0-Settings-Ack\n" +
-"0-Ping-[0,0,0,0,0,0,0,1]\n" +
-getSimpleResponseTrace(1)
-, output.getTrace());
-output.clearTrace();
-
-sendLargeGetRequest(3);
-
-sendSimpleGetRequest(5);
+// http2Connect() - modified
+enableHttp2(1);
+configureAndStartWebApplication();
+openClientConnection();
+doHttpUpgrade();
+sendClientPreface();
 
-// Default connection window size is 64k-1.
-// Initial request will have used 8k leaving 56k-1.
-// Stream window will be 64k-1.
-// Expecting
-// 1 * headers
-// 56k-1 of body (7 * ~8k)
-// 1 * error
-// for a total of 9 frames (could be in any order)
-for (int i = 0; i < 9; i++) {
+// validateHttp2InitialResponse() - modified
+parser.readFrame(true);
+parser.readFrame(true);
+parser.readFrame(true);
+parser.readFrame(true);
 parser.readFrame(true);
-}
-
-Assert.assertTrue(output.getTrace(),
-output.getTrace().contains("5-RST-[" +
-Http2Error.REFUSED_STREAM.getCode() + "]"));
-output.clearTrace();
-
-// Connection window is zero.
-// Stream window is 8k
 
-// Reset stream 3 (client cancel)
-sendRst(3, Http2Error.NO_ERROR.getCode());
-// Client reset triggers a write error which in turn triggers a server
-// reset
-parser.readFrame(true);
-Assert.assertEquals("3-RST-[8]\n", output.getTrace());
-output.clearTrace();
+Assert.assertEquals("0-Settings-[3]-[1]\n" +
+"0-Settings-End\n" +
+"0-Settings-Ack\n" +
+"0-Ping-[0,0,0,0,0,0,0,1]\n" +
+getSimpleResponseTrace(1)
+, output.getTrace());
+output.clearTrace();
+
+sendLargeGetRequest(3);
+
+sendSimpleGetRequest(5);
+
+// Default connection window size is 64k-1.
+// Initial request will have used 8k leaving 56k-1.
+// Stream window will be 64k-1.
+// Expecting
+// 1 * headers
+// 56k-1 of body (7 * ~8k)
+// 1 * error
+// for a total of 9 frames (could be in any order)
+for (int i = 0; i < 9; i++) {
+parser.readFrame(true);
+}
+
+Assert.assertTrue(output.getTrace(),
+output.getTrace().contains("5-RST-[" +
+Http2Error.REFUSED_STREAM.getCode() + "]"));
+output.clearTrace();
+
+// Connection window is zero.
+// Stream window is 8k
+
+// Reset stream 3 (client cancel)
+sendRst(3, Http2Error.NO_ERROR.getCode());
+// Client reset triggers a write error 

[tomcat] branch 9.0.x updated: Additional debug logging

2020-08-18 Thread markt
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 f5a5586  Additional debug logging
f5a5586 is described below

commit f5a5586188b8741599304c3b26cc6c5fd40e3352
Author: Mark Thomas 
AuthorDate: Tue Aug 18 15:53:08 2020 +0100

Additional debug logging
---
 .../apache/coyote/http2/TestHttp2Section_5_1.java  | 120 +++--
 .../tomcat/websocket/TestWebSocketFrameClient.java |   2 +-
 2 files changed, 66 insertions(+), 56 deletions(-)

diff --git a/test/org/apache/coyote/http2/TestHttp2Section_5_1.java 
b/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
index 163f99a..6583b8d 100644
--- a/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
+++ b/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
@@ -17,6 +17,8 @@
 package org.apache.coyote.http2;
 
 import java.nio.ByteBuffer;
+import java.util.logging.Level;
+import java.util.logging.LogManager;
 
 import org.junit.Assert;
 import org.junit.Test;
@@ -258,68 +260,76 @@ public class TestHttp2Section_5_1 extends Http2TestBase {
 @Test
 public void testExceedMaxActiveStreams02() throws Exception {
 
-// http2Connect() - modified
-enableHttp2(1);
-configureAndStartWebApplication();
-openClientConnection();
-doHttpUpgrade();
-sendClientPreface();
+
LogManager.getLogManager().getLogger("org.apache.coyote").setLevel(Level.ALL);
+try {
+// temporary debug logging to investigate intermittent CI failures
 
-// validateHttp2InitialResponse() - modified
-parser.readFrame(true);
-parser.readFrame(true);
-parser.readFrame(true);
-parser.readFrame(true);
-parser.readFrame(true);
 
-Assert.assertEquals("0-Settings-[3]-[1]\n" +
-"0-Settings-End\n" +
-"0-Settings-Ack\n" +
-"0-Ping-[0,0,0,0,0,0,0,1]\n" +
-getSimpleResponseTrace(1)
-, output.getTrace());
-output.clearTrace();
-
-sendLargeGetRequest(3);
-
-sendSimpleGetRequest(5);
+// http2Connect() - modified
+enableHttp2(1);
+configureAndStartWebApplication();
+openClientConnection();
+doHttpUpgrade();
+sendClientPreface();
 
-// Default connection window size is 64k-1.
-// Initial request will have used 8k leaving 56k-1.
-// Stream window will be 64k-1.
-// Expecting
-// 1 * headers
-// 56k-1 of body (7 * ~8k)
-// 1 * error
-// for a total of 9 frames (could be in any order)
-for (int i = 0; i < 9; i++) {
+// validateHttp2InitialResponse() - modified
+parser.readFrame(true);
+parser.readFrame(true);
+parser.readFrame(true);
+parser.readFrame(true);
 parser.readFrame(true);
-}
-
-Assert.assertTrue(output.getTrace(),
-output.getTrace().contains("5-RST-[" +
-Http2Error.REFUSED_STREAM.getCode() + "]"));
-output.clearTrace();
-
-// Connection window is zero.
-// Stream window is 8k
 
-// Reset stream 3 (client cancel)
-sendRst(3, Http2Error.NO_ERROR.getCode());
-// Client reset triggers a write error which in turn triggers a server
-// reset
-parser.readFrame(true);
-Assert.assertEquals("3-RST-[8]\n", output.getTrace());
-output.clearTrace();
+Assert.assertEquals("0-Settings-[3]-[1]\n" +
+"0-Settings-End\n" +
+"0-Settings-Ack\n" +
+"0-Ping-[0,0,0,0,0,0,0,1]\n" +
+getSimpleResponseTrace(1)
+, output.getTrace());
+output.clearTrace();
+
+sendLargeGetRequest(3);
+
+sendSimpleGetRequest(5);
+
+// Default connection window size is 64k-1.
+// Initial request will have used 8k leaving 56k-1.
+// Stream window will be 64k-1.
+// Expecting
+// 1 * headers
+// 56k-1 of body (7 * ~8k)
+// 1 * error
+// for a total of 9 frames (could be in any order)
+for (int i = 0; i < 9; i++) {
+parser.readFrame(true);
+}
+
+Assert.assertTrue(output.getTrace(),
+output.getTrace().contains("5-RST-[" +
+Http2Error.REFUSED_STREAM.getCode() + "]"));
+output.clearTrace();
+
+// Connection window is zero.
+// Stream window is 8k
+
+// Reset stream 3 (client cancel)
+sendRst(3, Http2Error.NO_ERROR.getCode());
+// Client reset triggers a write error 

[tomcat] branch master updated: Additional debug logging

2020-08-18 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 20c1b43  Additional debug logging
20c1b43 is described below

commit 20c1b439bc52c8817d7265cb65ce9fadd664ccac
Author: Mark Thomas 
AuthorDate: Tue Aug 18 15:53:08 2020 +0100

Additional debug logging
---
 .../apache/coyote/http2/TestHttp2Section_5_1.java  | 120 +++--
 .../tomcat/websocket/TestWebSocketFrameClient.java |   2 +-
 2 files changed, 66 insertions(+), 56 deletions(-)

diff --git a/test/org/apache/coyote/http2/TestHttp2Section_5_1.java 
b/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
index 163f99a..6583b8d 100644
--- a/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
+++ b/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
@@ -17,6 +17,8 @@
 package org.apache.coyote.http2;
 
 import java.nio.ByteBuffer;
+import java.util.logging.Level;
+import java.util.logging.LogManager;
 
 import org.junit.Assert;
 import org.junit.Test;
@@ -258,68 +260,76 @@ public class TestHttp2Section_5_1 extends Http2TestBase {
 @Test
 public void testExceedMaxActiveStreams02() throws Exception {
 
-// http2Connect() - modified
-enableHttp2(1);
-configureAndStartWebApplication();
-openClientConnection();
-doHttpUpgrade();
-sendClientPreface();
+
LogManager.getLogManager().getLogger("org.apache.coyote").setLevel(Level.ALL);
+try {
+// temporary debug logging to investigate intermittent CI failures
 
-// validateHttp2InitialResponse() - modified
-parser.readFrame(true);
-parser.readFrame(true);
-parser.readFrame(true);
-parser.readFrame(true);
-parser.readFrame(true);
 
-Assert.assertEquals("0-Settings-[3]-[1]\n" +
-"0-Settings-End\n" +
-"0-Settings-Ack\n" +
-"0-Ping-[0,0,0,0,0,0,0,1]\n" +
-getSimpleResponseTrace(1)
-, output.getTrace());
-output.clearTrace();
-
-sendLargeGetRequest(3);
-
-sendSimpleGetRequest(5);
+// http2Connect() - modified
+enableHttp2(1);
+configureAndStartWebApplication();
+openClientConnection();
+doHttpUpgrade();
+sendClientPreface();
 
-// Default connection window size is 64k-1.
-// Initial request will have used 8k leaving 56k-1.
-// Stream window will be 64k-1.
-// Expecting
-// 1 * headers
-// 56k-1 of body (7 * ~8k)
-// 1 * error
-// for a total of 9 frames (could be in any order)
-for (int i = 0; i < 9; i++) {
+// validateHttp2InitialResponse() - modified
+parser.readFrame(true);
+parser.readFrame(true);
+parser.readFrame(true);
+parser.readFrame(true);
 parser.readFrame(true);
-}
-
-Assert.assertTrue(output.getTrace(),
-output.getTrace().contains("5-RST-[" +
-Http2Error.REFUSED_STREAM.getCode() + "]"));
-output.clearTrace();
-
-// Connection window is zero.
-// Stream window is 8k
 
-// Reset stream 3 (client cancel)
-sendRst(3, Http2Error.NO_ERROR.getCode());
-// Client reset triggers a write error which in turn triggers a server
-// reset
-parser.readFrame(true);
-Assert.assertEquals("3-RST-[8]\n", output.getTrace());
-output.clearTrace();
+Assert.assertEquals("0-Settings-[3]-[1]\n" +
+"0-Settings-End\n" +
+"0-Settings-Ack\n" +
+"0-Ping-[0,0,0,0,0,0,0,1]\n" +
+getSimpleResponseTrace(1)
+, output.getTrace());
+output.clearTrace();
+
+sendLargeGetRequest(3);
+
+sendSimpleGetRequest(5);
+
+// Default connection window size is 64k-1.
+// Initial request will have used 8k leaving 56k-1.
+// Stream window will be 64k-1.
+// Expecting
+// 1 * headers
+// 56k-1 of body (7 * ~8k)
+// 1 * error
+// for a total of 9 frames (could be in any order)
+for (int i = 0; i < 9; i++) {
+parser.readFrame(true);
+}
+
+Assert.assertTrue(output.getTrace(),
+output.getTrace().contains("5-RST-[" +
+Http2Error.REFUSED_STREAM.getCode() + "]"));
+output.clearTrace();
+
+// Connection window is zero.
+// Stream window is 8k
+
+// Reset stream 3 (client cancel)
+sendRst(3, Http2Error.NO_ERROR.getCode());
+// Client reset triggers a write 

buildbot success in on tomcat-9-trunk

2020-08-18 Thread buildbot
The Buildbot has detected a restored build on builder tomcat-9-trunk while 
building tomcat. Full details are available at:
https://ci.apache.org/builders/tomcat-9-trunk/builds/375

Buildbot URL: https://ci.apache.org/

Buildslave for this Build: asf946_ubuntu

Build Reason: The AnyBranchScheduler scheduler named 'on-tomcat-9-commit' 
triggered this build
Build Source Stamp: [branch 9.0.x] 918146f9d04af67d904b47c440acaab14380521b
Blamelist: Mark Thomas 

Build succeeded!

Sincerely,
 -The Buildbot




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



[tomcat] branch 8.5.x updated: Additional debug logging prompted by intermittent CI failures

2020-08-18 Thread markt
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


The following commit(s) were added to refs/heads/8.5.x by this push:
 new 3811dd9  Additional debug logging prompted by intermittent CI failures
3811dd9 is described below

commit 3811dd9bad3edad5c3646cea9344f273e906bf4f
Author: Mark Thomas 
AuthorDate: Tue Aug 18 15:13:01 2020 +0100

Additional debug logging prompted by intermittent CI failures
---
 java/org/apache/coyote/http11/Http11InputBuffer.java | 8 
 1 file changed, 8 insertions(+)

diff --git a/java/org/apache/coyote/http11/Http11InputBuffer.java 
b/java/org/apache/coyote/http11/Http11InputBuffer.java
index a3f9a46..3b2c118 100644
--- a/java/org/apache/coyote/http11/Http11InputBuffer.java
+++ b/java/org/apache/coyote/http11/Http11InputBuffer.java
@@ -768,6 +768,14 @@ public class Http11InputBuffer implements InputBuffer, 
ApplicationBufferHandler
  */
 private boolean fill(boolean block) throws IOException {
 
+if (log.isDebugEnabled()) {
+log.debug("parsingHeader: [" + parsingHeader +
+"], parsingRequestLine: [" + parsingRequestLine +
+"], parsingRequestLinePhase: [" + parsingRequestLinePhase +
+"], parsingRequestLineStart: [" + parsingRequestLineStart +
+"], byteBuffer.position() [" + byteBuffer.position() + 
"]");
+}
+
 if (parsingHeader) {
 if (byteBuffer.limit() >= headerBufferSize) {
 if (parsingRequestLine) {


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



[tomcat] branch master updated: Additional debug logging prompted by intermittent CI failures

2020-08-18 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 94607d0  Additional debug logging prompted by intermittent CI failures
94607d0 is described below

commit 94607d00aefdd8467d23da7fcde739a0167c31d6
Author: Mark Thomas 
AuthorDate: Tue Aug 18 15:13:01 2020 +0100

Additional debug logging prompted by intermittent CI failures
---
 java/org/apache/coyote/http11/Http11InputBuffer.java | 8 
 1 file changed, 8 insertions(+)

diff --git a/java/org/apache/coyote/http11/Http11InputBuffer.java 
b/java/org/apache/coyote/http11/Http11InputBuffer.java
index 822558f0..ca0b785 100644
--- a/java/org/apache/coyote/http11/Http11InputBuffer.java
+++ b/java/org/apache/coyote/http11/Http11InputBuffer.java
@@ -764,6 +764,14 @@ public class Http11InputBuffer implements InputBuffer, 
ApplicationBufferHandler
  */
 private boolean fill(boolean block) throws IOException {
 
+if (log.isDebugEnabled()) {
+log.debug("parsingHeader: [" + parsingHeader +
+"], parsingRequestLine: [" + parsingRequestLine +
+"], parsingRequestLinePhase: [" + parsingRequestLinePhase +
+"], parsingRequestLineStart: [" + parsingRequestLineStart +
+"], byteBuffer.position() [" + byteBuffer.position() + 
"]");
+}
+
 if (parsingHeader) {
 if (byteBuffer.limit() >= headerBufferSize) {
 if (parsingRequestLine) {


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



[tomcat] branch 9.0.x updated: Additional debug logging prompted by intermittent CI failures

2020-08-18 Thread markt
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 918146f  Additional debug logging prompted by intermittent CI failures
918146f is described below

commit 918146f9d04af67d904b47c440acaab14380521b
Author: Mark Thomas 
AuthorDate: Tue Aug 18 15:13:01 2020 +0100

Additional debug logging prompted by intermittent CI failures
---
 java/org/apache/coyote/http11/Http11InputBuffer.java | 8 
 1 file changed, 8 insertions(+)

diff --git a/java/org/apache/coyote/http11/Http11InputBuffer.java 
b/java/org/apache/coyote/http11/Http11InputBuffer.java
index 71ba804..2d8b69f 100644
--- a/java/org/apache/coyote/http11/Http11InputBuffer.java
+++ b/java/org/apache/coyote/http11/Http11InputBuffer.java
@@ -764,6 +764,14 @@ public class Http11InputBuffer implements InputBuffer, 
ApplicationBufferHandler
  */
 private boolean fill(boolean block) throws IOException {
 
+if (log.isDebugEnabled()) {
+log.debug("parsingHeader: [" + parsingHeader +
+"], parsingRequestLine: [" + parsingRequestLine +
+"], parsingRequestLinePhase: [" + parsingRequestLinePhase +
+"], parsingRequestLineStart: [" + parsingRequestLineStart +
+"], byteBuffer.position() [" + byteBuffer.position() + 
"]");
+}
+
 if (parsingHeader) {
 if (byteBuffer.limit() >= headerBufferSize) {
 if (parsingRequestLine) {


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



[Bug 64671] HTTP/2 Stream.receivedData method throwing continuous NullPointerException in the logs

2020-08-18 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=64671

--- Comment #3 from Raghavendran V  ---
As the heap issue (CVE-2020-13934) is a bit critical, we are planning to take
9.0.37 for time being. For that, a few more inputs we need on the NPE bug fix.

1. If the NPE issue fix is not included in the production (i.e., if we go with
9.0.37), is it only the logs that will be flooded with NPE, or are you seeing
any other critical side effects (say memory leaks, etc.) due to the NPE issue?
2. Will this NPE fix be included in the 9.0.38 build (Sept release)?
3. You've indicated that 9.0.38 will be available in early September.  Is there
a tentative date?

Thanks a ton for the support, in advance.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: [Bug 64672] New: I have done this only to get backlink. please dont remove it

2020-08-18 Thread Felix Schumacher
Am 18.08.20 um 02:41 schrieb bugzi...@apache.org:

> https://bz.apache.org/bugzilla/show_bug.cgi?id=64672

Spam reverted and the account has been disabled.

 Felix



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



[Bug 64671] HTTP/2 Stream.receivedData method throwing continuous NullPointerException in the logs

2020-08-18 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=64671

--- Comment #2 from Raghavendran V  ---
Thank you so much for the swift response Mark! This is of great help for us. We
will check on how we can take this in.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 64621] HTTP/2 Tomcat Server responds with RST_STREAM (REFUSED_STREAM) continuously in one of the TCP connection.

2020-08-18 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=64621

--- Comment #9 from Raghavendran V  ---
Thank you so much for the swift response Mark! This is of great help for us. We
will check on how we can take this in.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org