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 562250db94 Additional fix for BZ 65118 - NPE on HTTP/2 prune
562250db94 is described below
commit 562250db9497d199b827ed2060f4440125ada6bc
Author: Mark Thomas <[email protected]>
AuthorDate: Fri May 27 11:26:33 2022 +0100
Additional fix for BZ 65118 - NPE on HTTP/2 prune
Expand priorityTree sync to include looking up the streams to be
reprioritised.
---
.../org/apache/coyote/http2/Http2UpgradeHandler.java | 20 ++++++++++++--------
webapps/docs/changelog.xml | 5 +++++
2 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
index b1119a7135..e93e29dc49 100644
--- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
@@ -1760,15 +1760,19 @@ class Http2UpgradeHandler extends AbstractStream
implements InternalHttpUpgradeH
increaseOverheadCount(FrameType.PRIORITY);
- AbstractNonZeroStream abstractNonZeroStream =
getAbstractNonZeroStream(streamId);
- if (abstractNonZeroStream == null) {
- abstractNonZeroStream = createRemoteStream(streamId);
- }
- AbstractStream parentStream = getAbstractNonZeroStream(parentStreamId);
- if (parentStream == null) {
- parentStream = this;
- }
synchronized (priorityTreeLock) {
+ // Need to look up stream and parent stream inside the lock else it
+ // is possible for a stream to be recycled before it is
+ // reprioritised. This can result in incorrect references to the
+ // non-recycled stream being retained after reprioritisation.
+ AbstractNonZeroStream abstractNonZeroStream =
getAbstractNonZeroStream(streamId);
+ if (abstractNonZeroStream == null) {
+ abstractNonZeroStream = createRemoteStream(streamId);
+ }
+ AbstractStream parentStream =
getAbstractNonZeroStream(parentStreamId);
+ if (parentStream == null) {
+ parentStream = this;
+ }
abstractNonZeroStream.rePrioritise(parentStream, exclusive,
weight);
}
}
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 234fdadb3b..5d14420169 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -129,6 +129,11 @@
</subsection>
<subsection name="Coyote">
<changelog>
+ <fix>
+ Additional fix for <bug>65118</bug>. Fix a potential
+ <code>NullPointerException</code> when pruning closed HTTP/2 streams
+ from the connection. (markt)
+ </fix>
<fix>
<bug>66076</bug>: When using TLS with non-blocking writes and the NIO
connector, ensure that flushing the buffers attempts to empty all of
the
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]