Commit a6884ce
net.http: serialize H2MuxConn GOAWAY flag with the HEADERS write section
do_on_stream rechecks the terminal admission flags (closed/goaway/shutting_down)
under smu while holding wmu, then releases smu and writes the request HEADERS
still under wmu. The GOAWAY handler set c.goaway under smu only, so a GOAWAY
could be observed in the narrow window between that recheck and the HEADERS
write. The behavior in that window was already functionally correct -- a stream
above last_stream_id is failed and retried, and one at or below it is within the
range the peer promised to process -- but writing HEADERS for a new stream after
a GOAWAY has been received is a conformance deviation from RFC 7540 §6.8
("Receivers of a GOAWAY frame MUST NOT open additional streams").
Tighten this by taking wmu before smu (the permitted wmu -> smu nesting) in the
GOAWAY handler so c.goaway cannot be set while any writer holds wmu; the recheck
in do_on_stream then becomes authoritative. The reader already acquires wmu in
the SETTINGS and PING ACK paths, so this introduces no new lock-ordering or
liveness property -- and it only sets a flag under wmu rather than writing, so it
holds the lock more briefly than those existing paths. Found by Codex on #27413.
Co-Authored-By: WOZCODE <contact@withwoz.com>1 parent 4496950 commit a6884ce
1 file changed
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1062 | 1062 | | |
1063 | 1063 | | |
1064 | 1064 | | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
1065 | 1074 | | |
1066 | 1075 | | |
1067 | 1076 | | |
| |||
1072 | 1081 | | |
1073 | 1082 | | |
1074 | 1083 | | |
| 1084 | + | |
1075 | 1085 | | |
1076 | 1086 | | |
1077 | 1087 | | |
| |||
0 commit comments