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 b4ceb9b50634a27e20312d9fe1cf77462fd83177 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 8b31ebc319..49b9734561 100644 --- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java +++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java @@ -1879,9 +1879,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 6bdb05696a..48c7ab33f6 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