On Thu, 9 Jan 2025 20:50:22 GMT, Daniel Fuchs <[email protected]> wrote:
> The HTTP/2 flow control logic has a potential race condition where some of
> the unprocessed data may be counted twice for the connection window.
> A protocol exception may be raised incorrectly if there are several
> concurrent streams producing data and the connection window is close from
> being exhausted.
src/java.net.http/share/classes/jdk/internal/net/http/WindowUpdateSender.java
line 135:
> 133: private boolean checkWindowSizeExceeded(long received, long len) {
> 134: // because windowSize is bound by Integer.MAX_VALUE
> 135: // we will never reach the point where received.get() + len
Nit - the method param `received` shadows the class level field and the comment
that says "received.get()" would need to be reworded too. It might be better to
rename the method param to something else.
src/java.net.http/share/classes/jdk/internal/net/http/WindowUpdateSender.java
line 206:
> 204: int tosend = (int)Math.min(received.get(),
> Integer.MAX_VALUE);
> 205: if (tosend > limit) {
> 206: received.addAndGet(-tosend);
I'm guessing the change on this line is to merely be consistent with some
others parts of the code in this class? Semantically, both these methods would
be the same since we don't use the return value.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23018#discussion_r1910476646
PR Review Comment: https://git.openjdk.org/jdk/pull/23018#discussion_r1910479605