This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 11.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 82da53e84c2b1bf75da4d867970352aa1731ea9c Author: Mark Thomas <ma...@apache.org> AuthorDate: Tue Oct 1 18:23:07 2024 +0100 Better comment and some trace level logging --- java/org/apache/coyote/http2/Http2UpgradeHandler.java | 16 +++++++++++++++- java/org/apache/coyote/http2/LocalStrings.properties | 2 ++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java b/java/org/apache/coyote/http2/Http2UpgradeHandler.java index 22b4f37849..de0a69d2d5 100644 --- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java +++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java @@ -1803,9 +1803,23 @@ class Http2UpgradeHandler extends AbstractStream implements InternalHttpUpgradeH void replaceStream(AbstractNonZeroStream original, AbstractNonZeroStream replacement) { AbstractNonZeroStream current = streams.get(original.getIdentifier()); - // Only replace the stream if it currently uses the full implementation. + /* + * Only replace the Stream once. No point replacing one RecycledStream instance with another. + * + * This method is called from both StreamProcessor and Http2UpgradeHandler which may be operating on the Stream + * concurrently. It is therefore expected that there will be duplicate calls to this method - primarily + * triggered by stream errors when processing incoming frames. + */ if (current instanceof Stream) { + if (log.isTraceEnabled()) { + log.trace(sm.getString("upgradeHandler.replace.first", getConnectionId(), original.getIdAsString())); + } streams.put(original.getIdentifier(), replacement); + } else { + if (log.isTraceEnabled()) { + log.trace(sm.getString( + "upgradeHandler.replace.duplicate", getConnectionId(), original.getIdAsString())); + } } } diff --git a/java/org/apache/coyote/http2/LocalStrings.properties b/java/org/apache/coyote/http2/LocalStrings.properties index 4861c582f3..2efeefedd8 100644 --- a/java/org/apache/coyote/http2/LocalStrings.properties +++ b/java/org/apache/coyote/http2/LocalStrings.properties @@ -148,6 +148,8 @@ upgradeHandler.pruneIncomplete=Connection [{0}], Stream [{1}], Failed to fully p upgradeHandler.pruneStart=Connection [{0}] Starting pruning of old streams. Limit is [{1}] and there are currently [{2}] streams. upgradeHandler.pruned=Connection [{0}] Pruned completed stream [{1}] upgradeHandler.releaseBacklog=Connection [{0}], Stream [{1}] released from backlog +upgradeHandler.replace.duplicate=Connection [{0}], Stream [{1}] duplicate attempt to replace stream with lightweight implementation has been ignored +upgradeHandler.replace.first=Connection [{0}], Stream [{1}] replaced with lightweight stream implementation upgradeHandler.reset.receive=Connection [{0}], Stream [{1}], Reset received due to [{2}] upgradeHandler.rst.debug=Connection [{0}], Stream [{1}], Error [{2}], Message [{3}], RST (closing stream) upgradeHandler.sendPrefaceFail=Connection [{0}], Failed to send preface to client --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org