RFR: 8347373: HTTP/2 flow control checks may count unprocessed data twice
Jaikiran Pai
jpai at openjdk.org
Fri Jan 10 14:51:37 UTC 2025
On Thu, 9 Jan 2025 20:50:22 GMT, Daniel Fuchs <dfuchs at openjdk.org> 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
More information about the net-dev
mailing list