Commit c16f526
committed
http2: invoke pending write callback on stream destroy
When an HTTP/2 stream is destroyed while a write is in progress, the
pending write callback may never be called if the write data has already
been consumed by nghttp2 and moved to the session's outgoing_buffers_.
In this case, the C++ side's SetImmediate cleanup finds nothing in the
stream's write queue, and the callback depends on session socket write
completion — which may never happen during shutdown.
This leaves the Writable stream's internal state stuck, preventing
cleanup of buffered writes and keeping references alive that block
event loop exit.
Track the pending write callback on the stream and invoke it in
_destroy() before calling handle.destroy(), ensuring the Writable
stream can clean up properly. The callback is made idempotent so
duplicate invocations from the C++ side are harmless no-ops.
Fixes: #58252
Refs: #582531 parent 95245a7 commit c16f526
1 file changed
+10
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
| 256 | + | |
256 | 257 | | |
257 | 258 | | |
258 | 259 | | |
| |||
2276 | 2277 | | |
2277 | 2278 | | |
2278 | 2279 | | |
| 2280 | + | |
| 2281 | + | |
2279 | 2282 | | |
2280 | 2283 | | |
2281 | 2284 | | |
2282 | 2285 | | |
| 2286 | + | |
2283 | 2287 | | |
2284 | 2288 | | |
2285 | 2289 | | |
| |||
2445 | 2449 | | |
2446 | 2450 | | |
2447 | 2451 | | |
| 2452 | + | |
| 2453 | + | |
| 2454 | + | |
| 2455 | + | |
| 2456 | + | |
| 2457 | + | |
2448 | 2458 | | |
2449 | 2459 | | |
2450 | 2460 | | |
| |||
0 commit comments