Commit 143e897
net.http: track h2 server connections for idle shutdown once, not per frame (#27435)
The HTTP/2 server registered each connection's fd in the TLS idle-conn
tracker around every frame read (mark_idle before, unmark_idle after), so
the shared tracker mutex -- and an O(n) handle-list scan in unmark -- was
hit on the hot path for every frame on every connection.
Register the connection once for its serve lifetime instead. The reader
spends almost all of its time blocked in a frame read, so the per-frame
churn bought nothing: close_idle still interrupts the reader on shutdown
by shutting the fd down. An h2 request in flight when the server stops is
now interrupted rather than allowed to finish, which is acceptable at
shutdown and is not relied on by any caller -- the graceful "wait for the
active request" guarantee is HTTP/1.1-only and unaffected.
Refs #27433.
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>1 parent 75789c6 commit 143e897
1 file changed
Lines changed: 20 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
77 | 95 | | |
78 | 96 | | |
79 | | - | |
| 97 | + | |
80 | 98 | | |
81 | 99 | | |
82 | 100 | | |
| |||
88 | 106 | | |
89 | 107 | | |
90 | 108 | | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | 109 | | |
119 | 110 | | |
120 | 111 | | |
| |||
0 commit comments