ice icon indicating copy to clipboard operation
ice copied to clipboard

ICE Agent can not be restarted when gathering

Open jech opened this issue 5 years ago • 4 comments

In recent versions of the Unnamed SFU, the client will restart ICE whenever the connection's ICE state goes into failed. I'm occasionally getting the following error:

ICE Agent can not be restarted when gathering

It happens somewhere in the code that handles incoming offers; I'd need to add more detailed logging in order to know which exact function triggers the error. How do I avoid this problem?

jech avatar Aug 13 '20 19:08 jech

@jech This is really just a deficiency of Pion/ice! I don’t think it is terribly hard to fix either.

I think it will just take a careful design concurrency wise.

Before that improvement lands you can just not allow a restart until the nil candidate has been emitted.

Sean-Der avatar Aug 13 '20 19:08 Sean-Der

I've implemented a workaround (different than the one you suggest), so this is no longer urgent.

jech avatar Sep 03 '20 11:09 jech

How the ICE Restart Should Work:

Right now the Restart method in agent.go attempts to restart ICE gathering, but if that agent's gatheringstate == GatheringStateGathering, the Restart method returns.

Instead, the Restart method should cancel the gathering processes running in gather.go by running a.gatherCandidateCancle() like here in gather.go, and then proceed to restart the gathering process.

Let me know if that sounds good!

wawesomeNOGUI avatar Jan 23 '21 22:01 wawesomeNOGUI

@Sean-Der what happend to that pull request?

jech avatar Aug 01 '21 18:08 jech