Fix memory leak in WebTransport::closed_potentially_pending_streams [chromium/src : main]

0 views
Skip to first unread message

krishna dheeraj Pannala (Gerrit)

unread,
Nov 14, 2025, 1:09:46 AMNov 14
to suresh potti, Mayur Patil, Chromium LUCI CQ, chromium...@chromium.org, blink-...@chromium.org

krishna dheeraj Pannala voted Commit-Queue+1

Commit-Queue+1
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ia165f1fa2b18b0471743eff5d202940f64a44519
Gerrit-Change-Number: 7155488
Gerrit-PatchSet: 3
Gerrit-Owner: krishna dheeraj Pannala <kpan...@microsoft.com>
Gerrit-Reviewer: krishna dheeraj Pannala <kpan...@microsoft.com>
Gerrit-CC: Mayur Patil <patil...@microsoft.com>
Gerrit-CC: suresh potti <sures...@microsoft.com>
Gerrit-Comment-Date: Fri, 14 Nov 2025 06:09:21 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

krishna dheeraj Pannala (Gerrit)

unread,
Nov 14, 2025, 1:50:56 AMNov 14
to suresh potti, Mayur Patil, Chromium LUCI CQ, chromium...@chromium.org, blink-...@chromium.org
Attention needed from krishna dheeraj Pannala

Message from krishna dheeraj Pannala

Set Ready For Review

Open in Gerrit

Related details

Attention is currently required from:
  • krishna dheeraj Pannala
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ia165f1fa2b18b0471743eff5d202940f64a44519
Gerrit-Change-Number: 7155488
Gerrit-PatchSet: 3
Gerrit-Owner: krishna dheeraj Pannala <kpan...@microsoft.com>
Gerrit-Reviewer: krishna dheeraj Pannala <kpan...@microsoft.com>
Gerrit-CC: Mayur Patil <patil...@microsoft.com>
Gerrit-CC: suresh potti <sures...@microsoft.com>
Gerrit-Attention: krishna dheeraj Pannala <kpan...@microsoft.com>
Gerrit-Comment-Date: Fri, 14 Nov 2025 06:50:24 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

krishna dheeraj Pannala (Gerrit)

unread,
Nov 17, 2025, 11:05:31 PMNov 17
to Adam Rice, Hayato Ito, suresh potti, Mayur Patil, Chromium LUCI CQ, chromium...@chromium.org, blink-...@chromium.org
Attention needed from Adam Rice and Hayato Ito

krishna dheeraj Pannala added 1 comment

Patchset-level comments
File-level comment, Patchset 3 (Latest):
krishna dheeraj Pannala . resolved

@adam, @hayato, can you please review this CL

Open in Gerrit

Related details

Attention is currently required from:
  • Adam Rice
  • Hayato Ito
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ia165f1fa2b18b0471743eff5d202940f64a44519
Gerrit-Change-Number: 7155488
Gerrit-PatchSet: 3
Gerrit-Owner: krishna dheeraj Pannala <kpan...@microsoft.com>
Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
Gerrit-Reviewer: Hayato Ito <hay...@chromium.org>
Gerrit-Reviewer: krishna dheeraj Pannala <kpan...@microsoft.com>
Gerrit-CC: Mayur Patil <patil...@microsoft.com>
Gerrit-CC: suresh potti <sures...@microsoft.com>
Gerrit-Attention: Adam Rice <ri...@chromium.org>
Gerrit-Attention: Hayato Ito <hay...@chromium.org>
Gerrit-Comment-Date: Tue, 18 Nov 2025 04:04:58 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Hayato Ito (Gerrit)

unread,
Nov 17, 2025, 11:36:35 PMNov 17
to krishna dheeraj Pannala, Adam Rice, suresh potti, Mayur Patil, Chromium LUCI CQ, chromium...@chromium.org, blink-...@chromium.org
Attention needed from Adam Rice

Hayato Ito added 1 comment

Patchset-level comments
Hayato Ito . resolved

Adam, could you please take a look at this first? I don't have any expertise in WebTransport. While this could be a good opportunity for me to familiarize myself with this area, I'm concerned it might take some time.

Open in Gerrit

Related details

Attention is currently required from:
  • Adam Rice
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ia165f1fa2b18b0471743eff5d202940f64a44519
Gerrit-Change-Number: 7155488
Gerrit-PatchSet: 3
Gerrit-Owner: krishna dheeraj Pannala <kpan...@microsoft.com>
Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
Gerrit-Reviewer: Hayato Ito <hay...@chromium.org>
Gerrit-Reviewer: krishna dheeraj Pannala <kpan...@microsoft.com>
Gerrit-CC: Mayur Patil <patil...@microsoft.com>
Gerrit-CC: suresh potti <sures...@microsoft.com>
Gerrit-Attention: Adam Rice <ri...@chromium.org>
Gerrit-Comment-Date: Tue, 18 Nov 2025 04:35:53 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Mayur Patil (Gerrit)

unread,
Nov 17, 2025, 11:49:53 PMNov 17
to krishna dheeraj Pannala, Adam Rice, Hayato Ito, suresh potti, Chromium LUCI CQ, chromium...@chromium.org, blink-...@chromium.org
Attention needed from Adam Rice and krishna dheeraj Pannala

Mayur Patil added 1 comment

File third_party/blink/renderer/modules/webtransport/web_transport.cc
Line 1464, Patchset 3 (Latest): known_incoming_stream_ids_.clear(); // Clear stream tracking state.
Mayur Patil . unresolved

nit : move comments at top of statement.

Ditto for bottom statement also

Open in Gerrit

Related details

Attention is currently required from:
  • Adam Rice
  • krishna dheeraj Pannala
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ia165f1fa2b18b0471743eff5d202940f64a44519
    Gerrit-Change-Number: 7155488
    Gerrit-PatchSet: 3
    Gerrit-Owner: krishna dheeraj Pannala <kpan...@microsoft.com>
    Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
    Gerrit-Reviewer: Hayato Ito <hay...@chromium.org>
    Gerrit-Reviewer: krishna dheeraj Pannala <kpan...@microsoft.com>
    Gerrit-CC: Mayur Patil <patil...@microsoft.com>
    Gerrit-CC: suresh potti <sures...@microsoft.com>
    Gerrit-Attention: krishna dheeraj Pannala <kpan...@microsoft.com>
    Gerrit-Attention: Adam Rice <ri...@chromium.org>
    Gerrit-Comment-Date: Tue, 18 Nov 2025 04:49:21 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Adam Rice (Gerrit)

    unread,
    Nov 18, 2025, 2:00:01 AMNov 18
    to krishna dheeraj Pannala, Hayato Ito, suresh potti, Mayur Patil, Chromium LUCI CQ, chromium...@chromium.org, blink-...@chromium.org
    Attention needed from krishna dheeraj Pannala

    Adam Rice added 2 comments

    File third_party/blink/renderer/modules/webtransport/web_transport.h
    Line 210, Patchset 3 (Latest): HashSet<uint32_t, IntWithZeroKeyHashTraits<uint32_t>>
    Adam Rice . unresolved

    Isn't this also effectively a memory leak? Couldn't we remove entries once we've had a close notification for them?

    Line 136, Patchset 3 (Latest): bool HasPendingClosedStreamForTesting(uint32_t stream_id) const {
    Adam Rice . unresolved

    I suggest making this out-of-line, since it isn't trivial, and I don't think the check that ForTesting symbols haven't leaked into the production binary works if the function gets inlined.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • krishna dheeraj Pannala
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ia165f1fa2b18b0471743eff5d202940f64a44519
    Gerrit-Change-Number: 7155488
    Gerrit-PatchSet: 3
    Gerrit-Owner: krishna dheeraj Pannala <kpan...@microsoft.com>
    Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
    Gerrit-Reviewer: Hayato Ito <hay...@chromium.org>
    Gerrit-Reviewer: krishna dheeraj Pannala <kpan...@microsoft.com>
    Gerrit-CC: Mayur Patil <patil...@microsoft.com>
    Gerrit-CC: suresh potti <sures...@microsoft.com>
    Gerrit-Attention: krishna dheeraj Pannala <kpan...@microsoft.com>
    Gerrit-Comment-Date: Tue, 18 Nov 2025 06:59:28 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    krishna dheeraj Pannala (Gerrit)

    unread,
    Nov 25, 2025, 4:08:15 AMNov 25
    to Adam Rice, Hayato Ito, suresh potti, Mayur Patil, Chromium LUCI CQ, chromium...@chromium.org, blink-...@chromium.org
    Attention needed from Adam Rice and Hayato Ito

    krishna dheeraj Pannala added 3 comments

    File third_party/blink/renderer/modules/webtransport/web_transport.h
    Line 210, Patchset 3: HashSet<uint32_t, IntWithZeroKeyHashTraits<uint32_t>>
    Adam Rice . resolved

    Isn't this also effectively a memory leak? Couldn't we remove entries once we've had a close notification for them?

    krishna dheeraj Pannala
    I've replaced the unbounded known_incoming_stream_ids_ HashSet with a bounded LRU cache:
    - recently_closed_incoming_stream_ids_ (Deque) + recently_closed_incoming_stream_ids_set_ (HashSet)
    - Capped at 512 entries to cover typical QUIC stream limits (100-256 concurrent streams)
    - Older entries are evicted in FIFO order
    - Evicted duplicates are harmlessly treated as pending closes

    This bounds memory usage while still preventing the original bug where duplicate close notifications caused unbounded growth in closed_potentially_pending_streams_.

    Line 136, Patchset 3: bool HasPendingClosedStreamForTesting(uint32_t stream_id) const {
    Adam Rice . resolved

    I suggest making this out-of-line, since it isn't trivial, and I don't think the check that ForTesting symbols haven't leaked into the production binary works if the function gets inlined.

    krishna dheeraj Pannala

    Done. Moved HasPendingClosedStreamForTesting() to the .cc file.

    File third_party/blink/renderer/modules/webtransport/web_transport.cc
    Line 1464, Patchset 3: known_incoming_stream_ids_.clear(); // Clear stream tracking state.
    Mayur Patil . resolved

    nit : move comments at top of statement.

    Ditto for bottom statement also

    krishna dheeraj Pannala

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Adam Rice
    • Hayato Ito
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Ia165f1fa2b18b0471743eff5d202940f64a44519
      Gerrit-Change-Number: 7155488
      Gerrit-PatchSet: 7
      Gerrit-Owner: krishna dheeraj Pannala <kpan...@microsoft.com>
      Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
      Gerrit-Reviewer: Hayato Ito <hay...@chromium.org>
      Gerrit-Reviewer: krishna dheeraj Pannala <kpan...@microsoft.com>
      Gerrit-CC: Mayur Patil <patil...@microsoft.com>
      Gerrit-CC: suresh potti <sures...@microsoft.com>
      Gerrit-Attention: Adam Rice <ri...@chromium.org>
      Gerrit-Attention: Hayato Ito <hay...@chromium.org>
      Gerrit-Comment-Date: Tue, 25 Nov 2025 09:07:50 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Mayur Patil <patil...@microsoft.com>
      Comment-In-Reply-To: Adam Rice <ri...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      krishna dheeraj Pannala (Gerrit)

      unread,
      Nov 25, 2025, 11:26:30 PMNov 25
      to Adam Rice, Hayato Ito, suresh potti, Mayur Patil, Chromium LUCI CQ, chromium...@chromium.org, blink-...@chromium.org
      Attention needed from Adam Rice and Hayato Ito

      New activity on the change

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Adam Rice
      • Hayato Ito
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Ia165f1fa2b18b0471743eff5d202940f64a44519
      Gerrit-Change-Number: 7155488
      Gerrit-PatchSet: 8
      Gerrit-Owner: krishna dheeraj Pannala <kpan...@microsoft.com>
      Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
      Gerrit-Reviewer: Hayato Ito <hay...@chromium.org>
      Gerrit-Reviewer: krishna dheeraj Pannala <kpan...@microsoft.com>
      Gerrit-CC: Mayur Patil <patil...@microsoft.com>
      Gerrit-CC: suresh potti <sures...@microsoft.com>
      Gerrit-Attention: Adam Rice <ri...@chromium.org>
      Gerrit-Attention: Hayato Ito <hay...@chromium.org>
      Gerrit-Comment-Date: Wed, 26 Nov 2025 04:26:03 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Adam Rice (Gerrit)

      unread,
      Nov 27, 2025, 12:52:59 PMNov 27
      to krishna dheeraj Pannala, Hayato Ito, suresh potti, Mayur Patil, Chromium LUCI CQ, chromium...@chromium.org, blink-...@chromium.org
      Attention needed from Hayato Ito and krishna dheeraj Pannala

      Adam Rice added 9 comments

      Commit Message
      Line 13, Patchset 8 (Latest):We now track every incoming stream ID in known_incoming_stream_ids_,
      Adam Rice . unresolved

      CL description needs an update.

      File third_party/blink/renderer/modules/webtransport/web_transport.h
      Line 217, Patchset 8 (Latest): Deque<uint32_t> recently_closed_incoming_stream_ids_;
      Adam Rice . unresolved

      It would be good to wrap these two members in a small nested class that only exposes the methods that are needed (Insert() and Contains() I think). You could call it LRUEvictionUint32Set or something similar.

      "closed" is ambiguous in this context because it doesn't say who did the closing. `recently_forgotten_incoming_stream_ids_` might be a better name.

      File third_party/blink/renderer/modules/webtransport/web_transport.cc
      Line 702, Patchset 8 (Latest): web_transport_->incoming_stream_map_.erase(stream_id);
      Adam Rice . unresolved

      This erase() is unnecessary, and could cause the stream to be garbage collected prematurely. OnIncomingStreamClosed() will trigger a call to ForgetIncomingStream() when the stream has read all the data.

      Line 703, Patchset 8 (Latest): web_transport_->RecordIncomingStreamClose(stream_id);
      Adam Rice . unresolved

      We don't need to record the `stream_id` here. We know that OnIncomingStreamClosed() has been called for this stream_id, so it won't be called again.

      Line 1110, Patchset 8 (Latest): incoming_stream_map_.erase(it);
      Adam Rice . unresolved

      `stream->OnIncomingStreamClosed(fin_received)` will call `erase()` via the `on_abort_` callback. There's no need to call it explicitly, although it might be good to add a comment of why we don't need to call it explicitly.

      Line 1111, Patchset 8 (Latest): RecordIncomingStreamClose(stream_id);
      Adam Rice . unresolved

      We don't need to record the `stream_id` here, because `OnIncomingStreamClosed()` won't be called again for the same id.

      Line 1124, Patchset 8 (Latest): bool is_new_entry =
      Adam Rice . unresolved

      I think `is_new_entry` must always be true, so
      ```
      CHECK(is_new_entry);
      ```

      Line 1254, Patchset 8 (Latest): RecordIncomingStreamClose(stream_id);
      Adam Rice . unresolved

      We only need to record this if the stream we are forgetting hasn't had OnIncomingStreamClosed called on it. Probably the cleanest way to do this would be to add an extra parameter to ForgetIncomingStream() called `has_received_fin` or something like that.

      Line 1497, Patchset 8 (Latest): // Clear stream tracking state.
      Adam Rice . unresolved

      It is probably more efficient not to clear these sets explicitly, and just let the garbage collector free the memory.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Hayato Ito
      • krishna dheeraj Pannala
      Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement is not satisfiedCode-Owners
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: Ia165f1fa2b18b0471743eff5d202940f64a44519
        Gerrit-Change-Number: 7155488
        Gerrit-PatchSet: 8
        Gerrit-Owner: krishna dheeraj Pannala <kpan...@microsoft.com>
        Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
        Gerrit-Reviewer: Hayato Ito <hay...@chromium.org>
        Gerrit-Reviewer: krishna dheeraj Pannala <kpan...@microsoft.com>
        Gerrit-CC: Mayur Patil <patil...@microsoft.com>
        Gerrit-CC: suresh potti <sures...@microsoft.com>
        Gerrit-Attention: krishna dheeraj Pannala <kpan...@microsoft.com>
        Gerrit-Attention: Hayato Ito <hay...@chromium.org>
        Gerrit-Comment-Date: Thu, 27 Nov 2025 17:52:23 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        krishna dheeraj Pannala (Gerrit)

        unread,
        Dec 15, 2025, 9:52:57 AM (13 days ago) Dec 15
        to Adam Rice, Hayato Ito, suresh potti, Mayur Patil, Chromium LUCI CQ, chromium...@chromium.org, blink-...@chromium.org
        Attention needed from Adam Rice

        krishna dheeraj Pannala added 11 comments

        krishna dheeraj Pannala . resolved

        Thanks for reviewing, Sorry for the delayed reply.

        Commit Message
        Line 13, Patchset 8:We now track every incoming stream ID in known_incoming_stream_ids_,
        Adam Rice . resolved

        CL description needs an update.

        krishna dheeraj Pannala

        Done

        File third_party/blink/renderer/modules/webtransport/web_transport.h
        Line 217, Patchset 8: Deque<uint32_t> recently_closed_incoming_stream_ids_;
        Adam Rice . resolved

        It would be good to wrap these two members in a small nested class that only exposes the methods that are needed (Insert() and Contains() I think). You could call it LRUEvictionUint32Set or something similar.

        "closed" is ambiguous in this context because it doesn't say who did the closing. `recently_forgotten_incoming_stream_ids_` might be a better name.

        krishna dheeraj Pannala

        Done. Created `RecentlyForgottenStreamIdSet` nested class exposing only `Insert()` and `Contains()`. Named it with "FIFO eviction" (not LRU since we don't update on access). Renamed member to `recently_forgotten_incoming_stream_ids_.`

        Line 210, Patchset 3: HashSet<uint32_t, IntWithZeroKeyHashTraits<uint32_t>>
        Adam Rice . resolved

        Isn't this also effectively a memory leak? Couldn't we remove entries once we've had a close notification for them?

        krishna dheeraj Pannala
        I've replaced the unbounded known_incoming_stream_ids_ HashSet with a bounded LRU cache:
        - recently_closed_incoming_stream_ids_ (Deque) + recently_closed_incoming_stream_ids_set_ (HashSet)
        - Capped at 512 entries to cover typical QUIC stream limits (100-256 concurrent streams)
        - Older entries are evicted in FIFO order
        - Evicted duplicates are harmlessly treated as pending closes

        This bounds memory usage while still preventing the original bug where duplicate close notifications caused unbounded growth in closed_potentially_pending_streams_.

        krishna dheeraj Pannala

        Done. With the new logic, we only track streams forgotten before receiving `OnIncomingStreamClosed()`. Streams that receive the close notification don't get added to the tracking set, so entries are naturally limited to those that
        need tracking.

        File third_party/blink/renderer/modules/webtransport/web_transport.cc
        Line 702, Patchset 8: web_transport_->incoming_stream_map_.erase(stream_id);
        Adam Rice . resolved

        This erase() is unnecessary, and could cause the stream to be garbage collected prematurely. OnIncomingStreamClosed() will trigger a call to ForgetIncomingStream() when the stream has read all the data.

        krishna dheeraj Pannala

        Done. Removed the premature `erase()`. Added comment explaining that cleanup happens via the `on_abort_` callback to `ForgetIncomingStream()` .

        Line 703, Patchset 8: web_transport_->RecordIncomingStreamClose(stream_id);
        Adam Rice . resolved

        We don't need to record the `stream_id` here. We know that OnIncomingStreamClosed() has been called for this stream_id, so it won't be called again.

        krishna dheeraj Pannala

        Done. Removed `RecordIncomingStreamClose()` call here.

        Line 1110, Patchset 8: incoming_stream_map_.erase(it);
        Adam Rice . resolved

        `stream->OnIncomingStreamClosed(fin_received)` will call `erase()` via the `on_abort_` callback. There's no need to call it explicitly, although it might be good to add a comment of why we don't need to call it explicitly.

        krishna dheeraj Pannala

        Done. Removed the explicit `erase()` and added comment:
        > "Note: stream-> OnIncomingStreamClosed() will eventually trigger ForgetIncomingStream() via the on_abort_ callback, which handles removal from incoming_stream_map_."

        Line 1111, Patchset 8: RecordIncomingStreamClose(stream_id);
        Adam Rice . resolved

        We don't need to record the `stream_id` here, because `OnIncomingStreamClosed()` won't be called again for the same id.

        krishna dheeraj Pannala

        Done. Removed `RecordIncomingStreamClose()` call. Added comment explaining we don't need to record because `OnIncomingStreamClosed()` won't be called again for the same `stream_id`.

        Line 1124, Patchset 8: bool is_new_entry =
        Adam Rice . resolved

        I think `is_new_entry` must always be true, so
        ```
        CHECK(is_new_entry);
        ```

        krishna dheeraj Pannala

        Done. Added CHECK(result.is_new_entry); with comment
        > "Should always be new given our call sites."

        Line 1254, Patchset 8: RecordIncomingStreamClose(stream_id);
        Adam Rice . resolved

        We only need to record this if the stream we are forgetting hasn't had OnIncomingStreamClosed called on it. Probably the cleanest way to do this would be to add an extra parameter to ForgetIncomingStream() called `has_received_fin` or something like that.

        krishna dheeraj Pannala

        Done. Added `bool has_received_close` parameter to `ForgetIncomingStream()`. Updated on_abort_ callback signature to pass `fin_received_.has_value()` from `AbortAndReset()`. Only insert into tracking set when `!has_received_close`.

        Line 1497, Patchset 8: // Clear stream tracking state.
        Adam Rice . resolved

        It is probably more efficient not to clear these sets explicitly, and just let the garbage collector free the memory.

        krishna dheeraj Pannala

        Done. Removed explicit `.clear()` calls.

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Adam Rice
        Submit Requirements:
          • requirement satisfiedCode-Coverage
          • requirement is not satisfiedCode-Owners
          • requirement is not satisfiedCode-Review
          • requirement is not satisfiedReview-Enforcement
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: Ia165f1fa2b18b0471743eff5d202940f64a44519
          Gerrit-Change-Number: 7155488
          Gerrit-PatchSet: 10
          Gerrit-Owner: krishna dheeraj Pannala <kpan...@microsoft.com>
          Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
          Gerrit-Reviewer: Hayato Ito <hay...@chromium.org>
          Gerrit-Reviewer: krishna dheeraj Pannala <kpan...@microsoft.com>
          Gerrit-CC: Mayur Patil <patil...@microsoft.com>
          Gerrit-CC: suresh potti <sures...@microsoft.com>
          Gerrit-Attention: Adam Rice <ri...@chromium.org>
          Gerrit-Comment-Date: Mon, 15 Dec 2025 14:52:21 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No
          Comment-In-Reply-To: krishna dheeraj Pannala <kpan...@microsoft.com>
          Comment-In-Reply-To: Adam Rice <ri...@chromium.org>
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          Adam Rice (Gerrit)

          unread,
          Dec 19, 2025, 3:27:45 AM (9 days ago) Dec 19
          to krishna dheeraj Pannala, Hayato Ito, suresh potti, Mayur Patil, Chromium LUCI CQ, chromium...@chromium.org, blink-...@chromium.org
          Attention needed from krishna dheeraj Pannala

          Adam Rice added 5 comments

          Patchset-level comments
          Adam Rice . resolved

          Almost done. One functional change and some nits.

          File third_party/blink/renderer/modules/webtransport/web_transport.h
          Line 156, Patchset 10 (Latest): Deque<uint32_t> ids_;
          Adam Rice . unresolved
          I think you can make the implementation of this simpler by using `LinkedHashSet<uint32_t>` as the underlying data structure. Then eviction can be implemented as
          ```
          if (id_set_.size() > kMaxSize) {
          id_set_.RemoveFirst();
          }
          ```
          This will also allow you to easily implement `Erase(id)` so that once an element has been found in `OnIncomingStreamClosed()` you can immediately remove it from the set, since you know `OnIncomingStreamClosed()` will not be called again for the same ID.
          Line 151, Patchset 10 (Latest):
          Adam Rice . unresolved

          Nit: it's good practice to protect against accidental copies. Even when the class is private, someone might add code that accidentally copies it in future.
          ```
          RecentlyForgottenStreamIdSet() = default;
          RecentlyForgottenStreamIdSet(const RecentlyForgottenStreamIdSet&) = delete;
          RecentlyForgottenStreamIdSet& operator=(const RecentlyForgottenStreamIdSet&) = delete;
          ```

          Line 138, Patchset 10 (Latest): // closed_potentially_pending_streams_ are properly consumed or cleared.
          Adam Rice . unresolved
          Nit: put `closed_potentially_pending_streams_` in backticks so that it will be linkified in code search.
          ```suggestion
          // `closed_potentially_pending_streams_` are properly consumed or cleared.
          ```
          File third_party/blink/renderer/modules/webtransport/web_transport.cc
          Line 1102, Patchset 10 (Latest): DVLOG(1) << "WebTransport::OnIncomingStreamClosed() ignoring duplicate "
          Adam Rice . unresolved

          Nit: It's not really a "duplicate". It might be better to have a message like
          "WebTransport::OnIncomingStreamClosed() correctly ignoring close on recently forgotten stream stream_id=". The word "correctly" is just so that somebody who sees the message doesn't mistake it for an error.

          Open in Gerrit

          Related details

          Attention is currently required from:
          • krishna dheeraj Pannala
          Submit Requirements:
            • requirement satisfiedCode-Coverage
            • requirement is not satisfiedCode-Owners
            • requirement is not satisfiedCode-Review
            • requirement is not satisfiedNo-Unresolved-Comments
            • requirement is not satisfiedReview-Enforcement
            Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
            Gerrit-MessageType: comment
            Gerrit-Project: chromium/src
            Gerrit-Branch: main
            Gerrit-Change-Id: Ia165f1fa2b18b0471743eff5d202940f64a44519
            Gerrit-Change-Number: 7155488
            Gerrit-PatchSet: 10
            Gerrit-Owner: krishna dheeraj Pannala <kpan...@microsoft.com>
            Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
            Gerrit-Reviewer: Hayato Ito <hay...@chromium.org>
            Gerrit-Reviewer: krishna dheeraj Pannala <kpan...@microsoft.com>
            Gerrit-CC: Mayur Patil <patil...@microsoft.com>
            Gerrit-CC: suresh potti <sures...@microsoft.com>
            Gerrit-Attention: krishna dheeraj Pannala <kpan...@microsoft.com>
            Gerrit-Comment-Date: Fri, 19 Dec 2025 08:27:21 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: No
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            krishna dheeraj Pannala (Gerrit)

            unread,
            Dec 25, 2025, 3:59:37 PM (3 days ago) Dec 25
            to Adam Rice, Hayato Ito, suresh potti, Mayur Patil, Chromium LUCI CQ, chromium...@chromium.org, blink-...@chromium.org
            Attention needed from Adam Rice

            krishna dheeraj Pannala added 4 comments

            File third_party/blink/renderer/modules/webtransport/web_transport.h
            Line 156, Patchset 10: Deque<uint32_t> ids_;
            Adam Rice . resolved
            I think you can make the implementation of this simpler by using `LinkedHashSet<uint32_t>` as the underlying data structure. Then eviction can be implemented as
            ```
            if (id_set_.size() > kMaxSize) {
            id_set_.RemoveFirst();
            }
            ```
            This will also allow you to easily implement `Erase(id)` so that once an element has been found in `OnIncomingStreamClosed()` you can immediately remove it from the set, since you know `OnIncomingStreamClosed()` will not be called again for the same ID.
            krishna dheeraj Pannala

            Refactored to use LinkedHashSet for FIFO eviction.

            Line 151, Patchset 10:
            Adam Rice . resolved

            Nit: it's good practice to protect against accidental copies. Even when the class is private, someone might add code that accidentally copies it in future.
            ```
            RecentlyForgottenStreamIdSet() = default;
            RecentlyForgottenStreamIdSet(const RecentlyForgottenStreamIdSet&) = delete;
            RecentlyForgottenStreamIdSet& operator=(const RecentlyForgottenStreamIdSet&) = delete;
            ```

            krishna dheeraj Pannala

            Good point. Added explicit deletion of copy constructor and copy assignment operator to guard against accidental copies in future code changes.

            Line 138, Patchset 10: // closed_potentially_pending_streams_ are properly consumed or cleared.
            Adam Rice . resolved
            Nit: put `closed_potentially_pending_streams_` in backticks so that it will be linkified in code search.
            ```suggestion
            // `closed_potentially_pending_streams_` are properly consumed or cleared.
            ```
            krishna dheeraj Pannala

            Done

            File third_party/blink/renderer/modules/webtransport/web_transport.cc
            Line 1102, Patchset 10: DVLOG(1) << "WebTransport::OnIncomingStreamClosed() ignoring duplicate "
            Adam Rice . resolved

            Nit: It's not really a "duplicate". It might be better to have a message like
            "WebTransport::OnIncomingStreamClosed() correctly ignoring close on recently forgotten stream stream_id=". The word "correctly" is just so that somebody who sees the message doesn't mistake it for an error.

            krishna dheeraj Pannala

            Updated the message to:
            "WebTransport::OnIncomingStreamClosed() correctly ignoring close on recently forgotten stream stream_id=..."
            The word "correctly" makes it clear this is expected behavior, not an error.

            Open in Gerrit

            Related details

            Attention is currently required from:
            • Adam Rice
            Submit Requirements:
              • requirement satisfiedCode-Coverage
              • requirement is not satisfiedCode-Owners
              • requirement is not satisfiedCode-Review
              • requirement is not satisfiedReview-Enforcement
              Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
              Gerrit-MessageType: comment
              Gerrit-Project: chromium/src
              Gerrit-Branch: main
              Gerrit-Change-Id: Ia165f1fa2b18b0471743eff5d202940f64a44519
              Gerrit-Change-Number: 7155488
              Gerrit-PatchSet: 11
              Gerrit-Owner: krishna dheeraj Pannala <kpan...@microsoft.com>
              Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
              Gerrit-Reviewer: Hayato Ito <hay...@chromium.org>
              Gerrit-Reviewer: krishna dheeraj Pannala <kpan...@microsoft.com>
              Gerrit-CC: Mayur Patil <patil...@microsoft.com>
              Gerrit-CC: suresh potti <sures...@microsoft.com>
              Gerrit-Attention: Adam Rice <ri...@chromium.org>
              Gerrit-Comment-Date: Thu, 25 Dec 2025 20:58:57 +0000
              Gerrit-HasComments: Yes
              Gerrit-Has-Labels: No
              Comment-In-Reply-To: Adam Rice <ri...@chromium.org>
              satisfied_requirement
              unsatisfied_requirement
              open
              diffy
              Reply all
              Reply to author
              Forward
              0 new messages