Licode-ErizoClientIOS icon indicating copy to clipboard operation
Licode-ErizoClientIOS copied to clipboard

fix: do ECClient disconnect in RTCIceConnectionStateClosed only to prevent crash.

Open allenlinli opened this issue 6 years ago • 2 comments

I found a bug that it crashes when I disconnect a room. The bug is described in the issue I sent earlier: https://github.com/zevarito/Licode-ErizoClientIOS/issues/74

I found the reason it crashes is that a block inside ECClient is being released when the ECClient is released(while ECRoom's publishingStatsTimer released, and so that ECRoom and ECClient are released).

So I move the disconnect to RTCIceConnectionStateClosed to prevent this crash.

And after I read the references addressed in this issue (https://github.com/zevarito/Licode-ErizoClientIOS/issues/73), I still didn't find the answer that should both RTCIceConnectionStateDisconnected and RTCIceConnectionStateClosed do disconnect. Since disconnect deallocates ECRoom, and it "probably" always calls RTCIceConnectionStateClosed, we could safely call disconnect at RTCIceConnectionStateClosed.

allenlinli avatar May 30 '18 16:05 allenlinli

And so far I couldn't reproduce the crash on your sample code yet. And also I didn't build WebRTC to get the debug symbol see the backtrace (although I guess it's irrelevant). I will try it later.

allenlinli avatar May 30 '18 16:05 allenlinli

thanks @allenlinli! I'll hope to be back on this project next week and review/test all these.

zevarito avatar Jun 01 '18 13:06 zevarito