Commit a365564
http2: fix graceful session close
Fix issue where session.close() prematurely destroys the session
when response.end() was called with an empty payload while active
http2 streams still existed. This change ensures that sessions are
closed gracefully only after all http2 streams complete and clients
properly receive the GOAWAY frame as per the HTTP/2 spec.
Refs: https://nodejs.org/api/http2.html\#http2sessionclosecallback
PR-URL: #57808
Fixes: #57809
Refs: https://nodejs.org/api/http2.html%5C#http2sessionclosecallback
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Tim Perry <pimterry@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>1 parent 46fc497 commit a365564Copy full SHA for a365564
File tree
Expand file treeCollapse file tree
6 files changed
+142
-9
lines changedOpen diff view settings
Filter options
- lib/internal/http2
- src
- test/parallel
Expand file treeCollapse file tree
6 files changed
+142
-9
lines changedOpen diff view settings
Collapse file
+9-2Lines changed: 9 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
1068 | 1068 | |
1069 | 1069 | |
1070 | 1070 | |
| 1071 | + |
1071 | 1072 | |
1072 | 1073 | |
1073 | 1074 | |
| ||
1589 | 1590 | |
1590 | 1591 | |
1591 | 1592 | |
| 1593 | + |
| 1594 | + |
| 1595 | + |
| 1596 | + |
1592 | 1597 | |
1593 | 1598 | |
1594 | 1599 | |
| ||
1609 | 1614 | |
1610 | 1615 | |
1611 | 1616 | |
| 1617 | + |
| 1618 | + |
1612 | 1619 | |
1613 | 1620 | |
1614 | 1621 | |
1615 | 1622 | |
1616 | | - |
| 1623 | + |
1617 | 1624 | |
1618 | 1625 | |
1619 | 1626 | |
| ||
3300 | 3307 | |
3301 | 3308 | |
3302 | 3309 | |
3303 | | - |
| 3310 | + |
3304 | 3311 | |
3305 | 3312 | |
3306 | 3313 | |
|
Collapse file
+1Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
285 | 285 | |
286 | 286 | |
287 | 287 | |
| 288 | + |
288 | 289 | |
289 | 290 | |
290 | 291 | |
|
Collapse file
+58-1Lines changed: 58 additions & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
559 | 559 | |
560 | 560 | |
561 | 561 | |
562 | | - |
| 562 | + |
| 563 | + |
563 | 564 | |
564 | 565 | |
565 | 566 | |
| ||
765 | 766 | |
766 | 767 | |
767 | 768 | |
| 769 | + |
| 770 | + |
| 771 | + |
| 772 | + |
| 773 | + |
| 774 | + |
| 775 | + |
| 776 | + |
| 777 | + |
| 778 | + |
| 779 | + |
| 780 | + |
| 781 | + |
| 782 | + |
| 783 | + |
| 784 | + |
| 785 | + |
| 786 | + |
768 | 787 | |
769 | 788 | |
770 | 789 | |
| ||
1743 | 1762 | |
1744 | 1763 | |
1745 | 1764 | |
| 1765 | + |
1746 | 1766 | |
1747 | 1767 | |
1748 | 1768 | |
| ||
1965 | 1985 | |
1966 | 1986 | |
1967 | 1987 | |
| 1988 | + |
1968 | 1989 | |
1969 | 1990 | |
1970 | 1991 | |
| ||
3476 | 3497 | |
3477 | 3498 | |
3478 | 3499 | |
| 3500 | + |
| 3501 | + |
3479 | 3502 | |
3480 | 3503 | |
3481 | 3504 | |
| ||
3496 | 3519 | |
3497 | 3520 | |
3498 | 3521 | |
| 3522 | + |
| 3523 | + |
3499 | 3524 | |
3500 | 3525 | |
3501 | 3526 | |
| ||
3550 | 3575 | |
3551 | 3576 | |
3552 | 3577 | |
| 3578 | + |
| 3579 | + |
| 3580 | + |
| 3581 | + |
| 3582 | + |
| 3583 | + |
| 3584 | + |
| 3585 | + |
| 3586 | + |
| 3587 | + |
| 3588 | + |
| 3589 | + |
| 3590 | + |
| 3591 | + |
| 3592 | + |
| 3593 | + |
| 3594 | + |
| 3595 | + |
| 3596 | + |
| 3597 | + |
| 3598 | + |
| 3599 | + |
| 3600 | + |
| 3601 | + |
| 3602 | + |
| 3603 | + |
| 3604 | + |
| 3605 | + |
| 3606 | + |
| 3607 | + |
| 3608 | + |
| 3609 | + |
3553 | 3610 | |
3554 | 3611 | |
3555 | 3612 | |
|
Collapse file
+15Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
712 | 712 | |
713 | 713 | |
714 | 714 | |
| 715 | + |
715 | 716 | |
716 | 717 | |
717 | 718 | |
| ||
723 | 724 | |
724 | 725 | |
725 | 726 | |
| 727 | + |
726 | 728 | |
727 | 729 | |
728 | 730 | |
| ||
735 | 737 | |
736 | 738 | |
737 | 739 | |
| 740 | + |
738 | 741 | |
739 | 742 | |
740 | 743 | |
| ||
785 | 788 | |
786 | 789 | |
787 | 790 | |
| 791 | + |
| 792 | + |
| 793 | + |
| 794 | + |
| 795 | + |
| 796 | + |
| 797 | + |
788 | 798 | |
789 | 799 | |
790 | 800 | |
| ||
951 | 961 | |
952 | 962 | |
953 | 963 | |
| 964 | + |
| 965 | + |
954 | 966 | |
955 | 967 | |
| 968 | + |
| 969 | + |
| 970 | + |
956 | 971 | |
957 | 972 | |
958 | 973 | |
|
Collapse file
test/parallel/test-http2-client-rststream-before-connect.js
Copy file name to clipboardExpand all lines: test/parallel/test-http2-client-rststream-before-connect.js+11-6Lines changed: 11 additions & 6 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
5 | 5 | |
6 | 6 | |
7 | 7 | |
| 8 | + |
8 | 9 | |
9 | 10 | |
10 | 11 | |
11 | | - |
12 | | - |
13 | | - |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
14 | 21 | |
15 | 22 | |
16 | 23 | |
17 | | - |
| 24 | + |
18 | 25 | |
19 | 26 | |
20 | 27 | |
| ||
52 | 59 | |
53 | 60 | |
54 | 61 | |
55 | | - |
56 | | - |
57 | 62 | |
58 | 63 | |
59 | 64 | |
|
Collapse file
test/parallel/test-http2-session-graceful-close.js
Copy file name to clipboard+48Lines changed: 48 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | + |
0 commit comments