This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push: new 814492bce4 Fix potential (not observed) concurrency issues 814492bce4 is described below commit 814492bce4906bf0a3b40fb49d05c4862bf63b68 Author: Mark Thomas <ma...@apache.org> AuthorDate: Tue Jun 28 19:42:31 2022 +0100 Fix potential (not observed) concurrency issues I have been investigating some HTTP/2 test failures and noticed that these fields could be accessed by multiple threads. Make the fields volatile to ensure that the changes made by the previous thread are visible to the current thread. --- java/org/apache/coyote/http2/Http2AsyncParser.java | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/java/org/apache/coyote/http2/Http2AsyncParser.java b/java/org/apache/coyote/http2/Http2AsyncParser.java index 94cd096fb6..d01497051d 100644 --- a/java/org/apache/coyote/http2/Http2AsyncParser.java +++ b/java/org/apache/coyote/http2/Http2AsyncParser.java @@ -59,12 +59,12 @@ class Http2AsyncParser extends Http2Parser { private class PrefaceCompletionHandler extends FrameCompletionHandler { - private boolean prefaceValidated = false; - private final WebConnection webConnection; private final Stream stream; private final byte[] prefaceData; + private volatile boolean prefaceValidated = false; + private PrefaceCompletionHandler(WebConnection webConnection, Stream stream, byte[] prefaceData, ByteBuffer... buffers) { super(FrameType.SETTINGS, buffers); this.webConnection = webConnection; @@ -166,15 +166,15 @@ class Http2AsyncParser extends Http2Parser { private final FrameType expected; protected final ByteBuffer[] buffers; - private boolean parsedFrameHeader = false; - private boolean validated = false; - private CompletionState state = null; - protected int payloadSize; - protected int frameTypeId; - protected FrameType frameType; - protected int flags; - protected int streamId; - protected boolean streamException = false; + private volatile boolean parsedFrameHeader = false; + private volatile boolean validated = false; + private volatile CompletionState state = null; + protected volatile int payloadSize; + protected volatile int frameTypeId; + protected volatile FrameType frameType; + protected volatile int flags; + protected volatile int streamId; + protected volatile boolean streamException = false; private FrameCompletionHandler(FrameType expected, ByteBuffer... buffers) { this.expected = expected; --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org