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 a26f1734e3 Improve error message when cancelling stream due to an
invalid write
a26f1734e3 is described below
commit a26f1734e364d85abc61dd56a49455ffc89fc402
Author: Mark Thomas <[email protected]>
AuthorDate: Mon Nov 7 13:00:36 2022 +0000
Improve error message when cancelling stream due to an invalid write
---
java/org/apache/coyote/http2/Http2UpgradeHandler.java | 3 ++-
java/org/apache/coyote/http2/LocalStrings.properties | 2 +-
java/org/apache/coyote/http2/StreamStateMachine.java | 3 +++
webapps/docs/changelog.xml | 5 +++++
4 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
index e9d982b95c..ce4bbc8ec8 100644
--- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
@@ -912,7 +912,8 @@ class Http2UpgradeHandler extends AbstractStream implements
InternalHttpUpgradeH
synchronized (this) {
if (!stream.canWrite()) {
stream.doStreamCancel(sm.getString("upgradeHandler.stream.notWritable",
- stream.getConnectionId(), stream.getIdAsString()),
Http2Error.STREAM_CLOSED);
+ stream.getConnectionId(), stream.getIdAsString(),
stream.state.getCurrentStateName() ),
+ Http2Error.STREAM_CLOSED);
}
long windowSize = getWindowSize();
if (stream.getConnectionAllocationMade() > 0) {
diff --git a/java/org/apache/coyote/http2/LocalStrings.properties
b/java/org/apache/coyote/http2/LocalStrings.properties
index 05f2b125bf..563d624a34 100644
--- a/java/org/apache/coyote/http2/LocalStrings.properties
+++ b/java/org/apache/coyote/http2/LocalStrings.properties
@@ -153,7 +153,7 @@ upgradeHandler.startRequestBodyFrame.result=Connection
[{0}], Stream [{1}] start
upgradeHandler.stream.closed=Stream [{0}] has been closed for some time
upgradeHandler.stream.error=Connection [{0}], Stream [{1}] Closed due to error
upgradeHandler.stream.even=A new remote stream ID of [{0}] was requested but
all remote streams must use odd identifiers
-upgradeHandler.stream.notWritable=Connection [{0}], Stream [{1}], This stream
is not writable
+upgradeHandler.stream.notWritable=Connection [{0}], Stream [{1}], This stream
is in state [{2}] and is not writable
upgradeHandler.stream.old=A new remote stream ID of [{0}] was requested but
the most recent stream was [{1}]
upgradeHandler.tooManyRemoteStreams=The client attempted to use more than
[{0}] active streams
upgradeHandler.tooMuchOverhead=Connection [{0}], Too much overhead so the
connection will be closed
diff --git a/java/org/apache/coyote/http2/StreamStateMachine.java
b/java/org/apache/coyote/http2/StreamStateMachine.java
index 72028fd4a4..6ec79ff81c 100644
--- a/java/org/apache/coyote/http2/StreamStateMachine.java
+++ b/java/org/apache/coyote/http2/StreamStateMachine.java
@@ -164,6 +164,9 @@ class StreamStateMachine {
stateChange(State.IDLE, State.CLOSED_FINAL);
}
+ final synchronized String getCurrentStateName() {
+ return state.name();
+ }
private enum State {
IDLE (false, false, false, true,
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 3d49ec6b9b..aea7fc4a18 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -132,6 +132,11 @@
A single space rather than a single dash should be used to separate the
day, month and year components to be compliant with RFC 6265. (markt)
</fix>
+ <add>
+ Include the name of the current stream state in the error message when
a
+ stream is cancelled due to an attempt to write to the stream when it is
+ in a state that does not permit writes. (markt)
+ </add>
</changelog>
</subsection>
<subsection name="Jasper">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]