Tolerate transport send errors when relaying TURN client messages#104
Open
DohanKim wants to merge 1 commit into
Open
Tolerate transport send errors when relaying TURN client messages#104DohanKim wants to merge 1 commit into
DohanKim wants to merge 1 commit into
Conversation
handle_ex_turn_msg matches the transport send result with a bare
':ok =' in both the gathering-transaction and relay-candidate branches.
When the underlying socket has already been closed (e.g. a late ex_turn
timer/refresh message arriving for a relay candidate whose socket went
away), the send returns {:error, :closed} and the whole ICEAgent crashes
with a MatchError, taking the PeerConnection down with it:
** (MatchError) no match of right hand side value: {:error, :closed}
lib/ex_ice/priv/ice_agent.ex:950: ExICE.Priv.ICEAgent.handle_ex_turn_msg/3
Observed in production (ex_ice 0.13.0 relaying via Cloudflare TURN, in an
ex_webrtc/Membrane SFU where the agent crash cascaded into the media
pipeline).
Handle the error the way nearby send paths already do: log, then drop
the gathering transaction / close the relay candidate gracefully.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
handle_ex_turn_msg/3matches the transport send result with a bare:ok =in both the gathering-transaction and relay-candidate branches. When the underlying socket has already been closed — e.g. a late ex_turn timer/refresh message arriving for a relay candidate whose socket went away — the send returns{:error, :closed}and the whole ICEAgent crashes with aMatchError, taking the PeerConnection down with it:We hit this in production on ex_ice 0.13.0 relaying via Cloudflare TURN, inside an ex_webrtc/Membrane SFU where the agent crash cascaded into the media pipeline and ended the call for everyone.
This PR handles the error the way nearby send paths already do (e.g. the connectivity-check send path uses a
case): log at debug, then drop the gathering transaction / close the relay candidate gracefully.🤖 Generated with Claude Code