Conversation
Greptile SummaryThis PR fixes a race condition in H2 stream cleanup where received data could fail to be acknowledged. The fix moves the Confidence Score: 5/5Safe to merge — the fix is correct and consistent across both cleanup sites with no new logic risks. The only finding is a P2 suggestion about missing streaming-path test coverage, which is non-blocking. The core logic change is sound and the race condition fix is well-targeted. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant CL as Cleanup (finally)
participant WL as _write_lock
participant RL as RecvLoop
participant H2 as h2 layer
note over CL,H2: OLD behaviour (race condition)
CL->>CL: _take_all_unacked_flow_bytes() → reads & zeroes state (no lock)
RL-->>WL: acquires _write_lock, increments unacked_flow_bytes
RL-->>H2: receive_data / handle events
RL-->>WL: releases _write_lock
CL->>WL: await ack_data() → acquires lock
CL->>H2: acknowledge_received_data(old_nbytes) ← new bytes MISSED
note over CL,H2: NEW behaviour (this PR)
CL->>WL: await ack_all_data() → acquires _write_lock
WL-->>RL: recv loop blocked until lock released
CL->>CL: read & zero unacked_flow_bytes inside lock
CL->>H2: acknowledge_received_data(all bytes) ← nothing missed
CL-->>WL: releases _write_lock
|
No description provided.