Skip to content

Purge closed HTTP/2 streams regardless of connection output window - #1542

Merged
arturobernalg merged 1 commit into
apache:masterfrom
arturobernalg:h2-purge-closed-streams-despite-window
Dec 2, 2026
Merged

arturobernalg merged 1 commit into
apache:masterfrom
arturobernalg:h2-purge-closed-streams-despite-window

Conversation

@arturobernalg

Copy link
Copy Markdown
Member

Closed streams were removed from the stream table only while producing output, which is skipped when the connection output window is exhausted or the peer SETTINGS have not been acknowledged. A peer withholding connection-level WINDOW_UPDATE could thus keep completed streams in the table indefinitely.

Stream removal is now a separate pass in onOutput that runs right after output production, regardless of flow control state.

@ok2c

ok2c commented Nov 29, 2026

Copy link
Copy Markdown
Member

@arturobernalg I do not think this is a good idea, especially in a bug release. And it, again, this change adds an extra scan of all streams

If you want this logic executed, please put it here

            if (connOutputWindow.get() > 0 && remoteSettingState == SettingsHandshake.ACKED) {
                produceOutput();
            } else {
                // RST_STREAM is not subject to flow control
                for (final Iterator<H2Stream> it = streams.iterator(); it.hasNext(); ) {
                    it.next().resetIfCancelled();
                    // --> Drop closed 
                }
            }

Closed streams were removed from the stream table only while producing output, which is skipped when the connection output window is exhausted or the peer SETTINGS have not been acknowledged. A peer withholding connection-level WINDOW_UPDATE could thus keep completed streams in the table indefinitely.

Drop them in the existing resetIfCancelled loop for that case instead of adding a separate pass over all streams.
@arturobernalg
arturobernalg force-pushed the h2-purge-closed-streams-despite-window branch from c3848ba to 29f9734 Compare November 29, 2026 12:35
@arturobernalg

Copy link
Copy Markdown
Member Author

Fixed, pushed. Moved the drop into the existing resetIfCancelled loop, no separate pass.

@arturobernalg
arturobernalg requested a review from ok2c November 29, 2026 12:43
@ok2c ok2c added this to the 5.5.1 milestone Nov 29, 2026
@arturobernalg
arturobernalg merged commit c360255 into apache:master Dec 2, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants