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] Fix server relay UDP port not release problem. #330

Merged
merged 9 commits into from
Nov 22, 2022

Conversation

clia
Copy link
Contributor

@clia clia commented Oct 25, 2022

On our servers, we found that after the TURN service runs for a long time, there will be a large number of UDP ports that are not released.

We found that the reason is that after the packet_handler task is started, if the client no longer uses the UDP connection, relay_socket.recv_from will never return. So we add a 10-second timeout here to check whether the allocation has been dropped every 10 seconds.

Fixes #232
Refs webrtc-rs/turn#13

Copy link
Contributor

@melekes melekes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems reasonable to me

turn/src/allocation/mod.rs Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Oct 28, 2022

Codecov Report

Base: 59.53% // Head: 59.52% // Decreases project coverage by -0.00% ⚠️

Coverage data is based on head (2a8cb3a) compared to base (5ee261c).
Patch has no changes to coverable lines.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #330      +/-   ##
==========================================
- Coverage   59.53%   59.52%   -0.01%     
==========================================
  Files         503      503              
  Lines       47646    47646              
  Branches    12583    12583              
==========================================
- Hits        28364    28361       -3     
- Misses       9898     9902       +4     
+ Partials     9384     9383       -1     
Impacted Files Coverage Δ
interceptor/src/nack/generator/generator_stream.rs 89.13% <0.00%> (-2.18%) ⬇️
turn/src/client/transaction.rs 62.74% <0.00%> (-1.31%) ⬇️
util/src/conn/conn_udp_listener.rs 64.10% <0.00%> (-1.29%) ⬇️
util/src/vnet/conn/conn_test.rs 54.62% <0.00%> (-0.85%) ⬇️
ice/src/agent/agent_gather_test.rs 59.43% <0.00%> (-0.32%) ⬇️
ice/src/agent/agent_vnet_test.rs 68.16% <0.00%> (-0.17%) ⬇️
ice/src/agent/agent_internal.rs 69.04% <0.00%> (ø)
sctp/src/association/association_test.rs 57.90% <0.00%> (ø)
ice/src/udp_mux/udp_mux_test.rs 63.12% <0.00%> (+0.62%) ⬆️
sdp/src/description/session.rs 65.18% <0.00%> (+0.76%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@melekes melekes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your work @clia 👍 One comment I have is about DropNotifier.

turn/src/allocation/mod.rs Outdated Show resolved Hide resolved
turn/src/allocation/mod.rs Outdated Show resolved Hide resolved
turn/src/allocation/mod.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@melekes melekes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@melekes
Copy link
Contributor

melekes commented Nov 15, 2022

@clia could you please add a changelog entry (CHANGELOG.md)?

@clia
Copy link
Contributor Author

clia commented Nov 16, 2022

Changelog entry added.

@k0nserv
Copy link
Member

k0nserv commented Nov 18, 2022

We can merge this I think, I do think using the oneshot this way is a bit weird but it'll work so 🤷🏼

Tokio's CancellationToken seems more suitable

@clia
Copy link
Contributor Author

clia commented Nov 18, 2022

I just don't want to introduce another dependency library.

@k0nserv
Copy link
Member

k0nserv commented Nov 18, 2022

Hmm, good point. I thought it would already be somewhere in the dependency graph, but I guess it isn't

@melekes melekes merged commit cbfd303 into webrtc-rs:master Nov 22, 2022
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

Successfully merging this pull request may close these issues.

Udp connection not close when using TURN (reopen #195)
3 participants