Commit fc7be36
net.http: serialize H2MuxConn GOAWAY with the HEADERS write critical 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
landing between that recheck and the HEADERS write let the client open one more
stream after observing GOAWAY -- a violation of RFC 7540 §6.8 ("Receivers of a
GOAWAY frame MUST NOT open additional streams").
Take 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 fc7be36
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