Commit b6bcfe8
fix(storage): close HTTP2 response bodies to prevent flow-control leaks (#14324)
Fixes an issue where HTTP2 stream connections might exhaust flow-control
quota and cause INTERNAL_ERROR in long-lived connections.
- Modifies `httpReader.Read` to properly close the previous stream body
before reopening it.
- Adds a defer block in `parseReadResponse` to ensure response bodies
aren't leaked when an error is returned during header parsing.
- Ensures bodies are closed when stream discarding (`io.CopyN`) or
`X-Goog-Generation` header parsing fails in `readerReopen`. These fixes
apply equally to both the JSON and XML reader code paths.
---------
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: krishnamd-jkp <230955344+krishnamd-jkp@users.noreply.github.com>1 parent 01b7e13 commit b6bcfe8
1 file changed
Lines changed: 18 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1424 | 1424 | | |
1425 | 1425 | | |
1426 | 1426 | | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
1427 | 1432 | | |
1428 | 1433 | | |
1429 | 1434 | | |
1430 | 1435 | | |
1431 | 1436 | | |
1432 | | - | |
1433 | 1437 | | |
1434 | 1438 | | |
1435 | 1439 | | |
| |||
1523 | 1527 | | |
1524 | 1528 | | |
1525 | 1529 | | |
| 1530 | + | |
1526 | 1531 | | |
1527 | 1532 | | |
1528 | 1533 | | |
| |||
1536 | 1541 | | |
1537 | 1542 | | |
1538 | 1543 | | |
1539 | | - | |
1540 | | - | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
1541 | 1550 | | |
1542 | 1551 | | |
1543 | 1552 | | |
| |||
1547 | 1556 | | |
1548 | 1557 | | |
1549 | 1558 | | |
1550 | | - | |
| 1559 | + | |
| 1560 | + | |
1551 | 1561 | | |
1552 | 1562 | | |
1553 | 1563 | | |
1554 | 1564 | | |
1555 | 1565 | | |
1556 | | - | |
| 1566 | + | |
| 1567 | + | |
1557 | 1568 | | |
1558 | 1569 | | |
1559 | 1570 | | |
1560 | 1571 | | |
1561 | 1572 | | |
1562 | 1573 | | |
1563 | | - | |
| 1574 | + | |
| 1575 | + | |
1564 | 1576 | | |
1565 | 1577 | | |
1566 | 1578 | | |
| |||
0 commit comments