lynckia / licode

Open Source Communication Provider based on WebRTC and Cloud technologies
http://lynckia.com/licode
MIT License
3.09k stars 1.02k forks source link

PeerConnection is not removed after unpublish #1753

Open vpoddubchak opened 3 years ago

vpoddubchak commented 3 years ago

Description

PeerConnection remains active after Unpublish of media in BasicExample.

Steps to reproduce the issue:

  1. Deploy the latest licode in docker by this command: MIN_PORT=30000; MAX_PORT=30150; sudo docker run --name licode -p 3000:3000 -p $MIN_PORT-$MAX_PORT:$MIN_PORT-$MAX_PORT/udp -p 3001:3001 -p 3004:3004 -p 8080:8080 -e "MIN_PORT=$MIN_PORT" -e "MAX_PORT=$MAX_PORT" -e "PUBLIC_IP=<your_domain>" lynckia/licode:develop
  2. Configure nginx and licode to use ssl based on this instruction: http://lynckia.com/licode/nginx-dep.html
  3. Open page and see your local preview on BasicExample page (and no errors in console)
  4. Open chrome://webrtc-internals page to check that PeerConection object is active
  5. Press Unpublish btn on BasicExample page
  6. Check webrtc-internals page: PeerConnection is still active. It will disapper only when tab with BasicExample will be closed.

Note:

vpoddubchak commented 2 years ago

Our tests shows that it start to happen after this commit: https://github.com/lynckia/licode/commit/da4c767948c02b13fd7dd8f52f060c00691b6108

vpoddubchak commented 2 years ago

I did mistake. Commit which caused this bug is: https://github.com/lynckia/licode/commit/279d4d8ad451ffe6a5e11aea81894ce2858d950b

david-morales commented 2 years ago

Hello, we have reproduced this issue and it is a blocker issue for our use case (lots of subscriptions).

This problem can cause this error : "Failed to construct 'RTCPeerConnection': Cannot create so many PeerConnections"

while handling lots of subscriptions or stream recoveries.

Since the connections are being piled up just by starting/ending the subscriptions, it could be easy to reproduce in certain use cases.

lodoyun commented 2 years ago

This is a byproduct of how we handle unified plan. I would suggest enabling single PeerConnection (singlePC) if you are going to have many subscriptions in a session.