Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

addIceCandidate is blocking the event-loop #281

Open
Aviv1000 opened this issue Aug 25, 2024 · 8 comments
Open

addIceCandidate is blocking the event-loop #281

Aviv1000 opened this issue Aug 25, 2024 · 8 comments

Comments

@Aviv1000
Copy link

Aviv1000 commented Aug 25, 2024

In my case there are times when it blocks the running of the entire node program sometimes for over 10 seconds.
I discovered that the blocking of the event-loop comes from addIceCandidate and there may also be a block from setLocalDescription and setRemoteDescription
I use polyfill to be compatible with the browser API, but I don't think it has anything to do with it.

i think maybe its happen when the remote candidate contains an IPv6 address.
{
candidate: 'candidate:995260933 1 udp 1677732095 ce81:ce81:ce81:ce81:ce81:ce81:ce81:ce81 54885 typ srflx raddr :: rport 0 generation 0 ufrag 5s6n network-cost 999',
sdpMLineIndex: 0,
sdpMid: '0'
}

Is this a bug in node-datachannel or can it be handled through my code only?
What is the technical reason for the problem?

@paullouisageneau
Copy link
Contributor

I think it could be caused by the libjuice issue reported in paullouisageneau/libjuice#264: if DNS resolution for ICE servers fails, subsequent ICE calls for the same peer connection could block due to incorrect locking. It was fixed by paullouisageneau/libjuice#267 and will be shipped alongside the next libdatachannel version.

@Aviv1000
Copy link
Author

Aviv1000 commented Aug 26, 2024

But this happens specifically when adding this remote candidate. he dont need to deal with DNS resolution.
Maybe it's because of invalid port number 0?
raddr :: rport 0
(chrome browser generated this candidate like this to the nodejs)

@paullouisageneau
Copy link
Contributor

But this happens specifically when adding this remote candidate. he dont need to deal with DNS resolution.

The issue could make ICE calls block, in particular setting remote description and candidates, because the ICE agent held a lock while resolving STUN/TURN servers in parallel which can take a while, especially in case of DNS failure.

Maybe it's because of invalid port number 0?
raddr :: rport 0
(chrome browser generated this candidate like this to the nodejs)

This is fine, raddr and rport are allowed to be 0.

@Aviv1000
Copy link
Author

hi,
last update v0.12.0 of node-datachannel seem that still not fix the issue.

@Aviv1000
Copy link
Author

any news about it?

@murat-dogan
Copy link
Owner

Hello,

I'm still waiting for the next release of libdatachannel.

@murat-dogan
Copy link
Owner

New version released here
https://github.com/murat-dogan/node-datachannel/releases/tag/v0.20.0

Thank you for your patience!

@Aviv1000
Copy link
Author

New version released here https://github.com/murat-dogan/node-datachannel/releases/tag/v0.20.0

Thank you for your patience!

thank you very much and also for libdatachannel's team,
i will check the new version and let you know if everything is working well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants