meetecho / janus-gateway

Janus WebRTC Server
https://janus.conf.meetecho.com
GNU General Public License v3.0
8.22k stars 2.48k forks source link

Janus not detaching stream properly when browser tab is closed or browser is killed #759

Closed anildigital closed 7 years ago

anildigital commented 7 years ago

When someone closes tab or kills browser, I see

On my local Mac

[WARN] [8906287884136737] Didn't receive audio for more than a second...
[WARN] [8906287884136737] Didn't receive video for more than a second...
Detaching handle from JANUS VideoRoom plugin
No WebRTC media anymore
Cleaning up handle 8906287884136737...
[8906287884136737] WebRTC resources freed
[8906287884136737] Handle and related resources freed

But on Ubuntu 16.04.1 LTS, with janus 0.2.2..

I see following. I don’t see .. ‘Detaching handle from JANUS VideoRoom plugin’

[WARN] [5531620520750732] Didn't receive audio for more than a second...
[WARN] [5531620520750732] Didn't receive video for more than a second...

I was expecting to see that Cleaning up Handle etc.. but I don’t see that on my Ubuntu server.

Is this known Janus bug? Can someone confirm?

lminiero commented 7 years ago

janus.js tries to detect the window/tab being closed via window.onbeforeunload. If it can, it tries to detach the handles and destroy the session, which may or may not succeed. Janus has a built-in timeout for sessions so they go away anyway within a minute. Not a bug.

anildigital commented 7 years ago

@lminiero I understand that " If it can, it tries to detach the handles and destroy the session, which may or may not succeed.", but behaviour is very different on Ubuntu server, as stream is not even detached after a minute.

I will add window.onbeforeunload JS event in my application. But wondering what's wrong with Janus I deployed on Ubuntu server and not the one I a running on my Mac. Thank you.