Commit 8c880c5
authored
fix(rtc): drop late SFU subscriber offers when peer connection is closed (#240)
`_on_subscriber_offer` unconditionally called `setRemoteDescription` on
`subscriber_pc`, so an offer that arrived after the connection was torn
down raised
`InvalidStateError: Cannot handle offer in signaling state "closed"`.
The exception propagated through the pyee error path and killed the
session.
Reproduces reliably under load: when the asyncio loop falls behind
(e.g. several concurrent agent sessions on one pod), session cleanup
and a late SFU renegotiation race, the offer arrives at a closed
peer connection, and the resulting exception drops the agent's
remaining sessions.
Guard the handler: if `subscriber_pc` is missing or `signalingState`
is `"closed"`, drop the offer and log at debug level — there is
nothing to negotiate with a closed connection.1 parent 2b1e111 commit 8c880c5
1 file changed
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
201 | 212 | | |
202 | 213 | | |
203 | 214 | | |
| |||
0 commit comments