New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 670809 link

Starred by 5 users

Issue metadata

Status: Assigned
Owner:
Last visit > 30 days ago
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug



Sign in to add a comment

PeerConnection doesn't close UDP ports it doesn't use anymore.

Project Member Reported by sergeyu@chromium.org, Dec 2 2016

Issue description

It appears that PeerConnection never closes UDP ports which it doesn't need. See b/31748068 for details

P2PTransportChannel keeps a set of PortAllocatorSession instances in allocator_sessions_, see https://codesearch.chromium.org/chromium/src/third_party/webrtc/p2p/base/p2ptransportchannel.h?rcl=1480681004&l=361 . Each session keeps one UDP socket. Problem is that these sessions are never deleted during lifetime of connections. P2PTransportChannel can add new sessions, but never removes them. As result all UDP ports are kept open until P2PTransportChannel is destroyed.

 
Cc: kmackay@chromium.org
Cc: deadbeef@chromium.org
Labels: WebRTCTriaged
Status: Available (was: Untriaged)
I was just recently reading the code and noticed this problem. We do delete "Port" objects when they're not used, but when two Ports share a socket, it's the  BasicPortAllocatorSession that owns the socket: https://codesearch.chromium.org/chromium/src/third_party/webrtc/p2p/client/basicportallocator.h?q=basicportall&sq=package:chromium&l=368

We need to either change this model, or start doing some kind of reference counting.
Owner: deadbeef@chromium.org
Any chance this long-standing issue can be addressed soon?

A seemingly not-so-hard-to-implement fix could save gazillions of kWh for computers all over the world prevented by Chromium/Chrome from suspending on inactivity.
It's not the highest priority right now, but if it's impacting you, you're welcome to take a stab at it. https://webrtc.org/contributing/
Argh, I moved off Chromium in 2015, but chances are I'll take a look at it.

Comment 7 by mef@chromium.org, Mar 13 2018

Cc: mef@chromium.org

Comment 8 by guow...@gmail.com, Jun 27 2018

Is this bug fixed? PeerConnection doesn't close UDP ports after calling peerconnection close, And this maybe cause too many open files for Android?
The bug is not fixed, but calling PeerConnection::Close *will* close all ports.

Comment 10 by guow...@gmail.com, Jun 28 2018

We call PeerConnection::Close, but stun binding request send periodically, and do not know when udp port are going to be closed

Comment 11 by guow...@gmail.com, Jun 28 2018

I find the bug is fixed, after calling PeerConnection::Close, then PeerConnection::~PeerConnection is called, and udp port are going to be closed.

Previous code has bug, because stl container hold PeerConnection for a long time.
Status: Assigned (was: Available)

Sign in to add a comment