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

TURN server startup race condition #163

Open
gfodor opened this issue Mar 2, 2024 · 3 comments
Open

TURN server startup race condition #163

gfodor opened this issue Mar 2, 2024 · 3 comments

Comments

@gfodor
Copy link
Contributor

gfodor commented Mar 2, 2024

I have a Jellyfish server with a client that auto reconnects and lazily creates a room. I noticed that if many clients are concurrently creating rooms there is a race condition trying to start the TURN server (so multiple attempts are made, and all but one fail on :eaddrinuse) - this can be mitigated by starting the TURN server first before any rooms are created.

@gfodor
Copy link
Contributor Author

gfodor commented Mar 2, 2024

Ah, I think part of this might also be that when SIGTERMing jellyfish in a docker container, it looks like maybe the TURN server is not shutting down gracefully and the port is staying in TIME_WAIT

@mickel8
Copy link
Contributor

mickel8 commented Mar 4, 2024

Hi @gfodor, I have already merged and released your PR in fake_turn as 0.4.2. I assume that this doesn't solve the problem entirely?

@mickel8
Copy link
Contributor

mickel8 commented Mar 4, 2024

Also, do you have any logs? As far as I remember our flow is as follows:

  • if JF_WEBRTC_USED is enabled, start one global TCP TURN
  • when a new webrtc peer connects, start a new UDP TURN server, dedicated to this peer

When starting a dedicated UDP TURN server, we iterate over a range of ports and try to open until we find a free one so this should work pretty fine unless it doesn't 🤔

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

2 participants