aioice icon indicating copy to clipboard operation
aioice copied to clipboard

Issue with STUN for consent refresh (RFC7675)

Open mglettig opened this issue 2 years ago • 4 comments

In my setup I have a WebRTC data channel that I use to transfer relatively big data packages of ~30 MB. I observed connection closings when running the code on my embedded system (Jetson Nano). I investigated the errors and noticed that this line here is hit:

https://github.com/aiortc/aioice/blob/c71c3afe064a028a8f39bde45c95897dbbaba35f/src/aioice/ice.py#L951

Root cause of that were 6 TransactionTimeouts: https://github.com/aiortc/aioice/blob/main/src/aioice/stun.py#L306 that were accumulated during the entire transfer.

I actually don't know why those timeouts happen (it is reproducible). But upon further digging into the code I notice that no retransmissions are done upon a failure: https://github.com/aiortc/aioice/blob/main/src/aioice/ice.py#L965

I would suggest to increase the retransmissions to at least 1. Or is there a particular reason for setting it to 0?

If anybody would have ideas for the root cause of my TransactionTimeouts it would be very welcome. Could a high system load (sending the data over the datachannel) lead to timeouts because the system misses to answer the Consent checks in time?

If it is of any help: I have wireshark traces of the STUN packages.

mglettig avatar Jun 14 '22 15:06 mglettig

I'm not sure we should be doing retransmissions here, wouldn't this throw off the frequency of these requests? It seems odd to me that you're getting 6 consecutive fails?

jlaine avatar Jun 16 '22 15:06 jlaine

I faced the same issue ( consent to send refresh) when I tried having multiple threads running together into the same process. I assume that GIL was busy with other stuff and aioice could not get the control and send the consent message. After spawning some processes, the issue resolved.

I can provide more info regarding that but it's not an aioice issue. It mainly relies on the software architecture of your project.

mariokrous avatar Mar 30 '23 11:03 mariokrous

In the light of @mariokrous's feedback I'm tmpted to close this issue.

jlaine avatar Apr 01 '23 09:04 jlaine

I faced the same issue ( consent to send refresh) when I tried having multiple threads running together into the same process. I assume that GIL was busy with other stuff and aioice could not get the control and send the consent message. After spawning some processes, the issue resolved.

I can provide more info regarding that but it's not an aioice issue. It mainly relies on the software architecture of your project.

@mariokrous can you clarify what did you mean by "spawning some processes"? I'm encountering an error and it is only happening on Windows for some reason, but works well on Linux and Mac.

maksimu avatar Dec 21 '23 21:12 maksimu