meetecho / janus-gateway

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

[1.x] user session hangs on browser tab closed #3396

Closed B-R-Bender closed 3 weeks ago

B-R-Bender commented 3 months ago

janus-gateway@1.1.3

Have you tested a more recent version of Janus too? Yes. I've tried to updated my dependency from "janus-gateway": "git://github.com/meetecho/janus-gateway.git", to "janus-gateway": "^1.2.3", but it behaves the same

Was this working before? It's working with janus 0.x server and janus-gateway@0.7.5 for sure

Additional context Hello guys! I've noticed that after I've moved from janus legacy version to a new one my users sessions is not destroyed on tab/browser closed. It keeps hanging on the server till it will be killed by timeout. I've tried to update my janus version on a client but no use. Is there any suggestion on how to fix this or anything I can try to look into? Also I've tried to google this issues but haven't found anything pretty much related, I'm wondering an I the only one experiencing such issue?

Thanks in advance.

lminiero commented 3 months ago

You need to provide more details. What plugin? What's the scenario?

B-R-Bender commented 3 months ago

Hello Lorenzo.

Actually that's any janus plugin I'm using, video and audio room - for sure

The scenario is quite simple: let's say that when the page loads, I connect to the Janus server and join several audio rooms. If I close the tab, my handlers/session will not be destroyed, so if I open the same page again within a minute interval (default timeout) I will get a "User busy" response.

atoppi commented 2 months ago

This has nothing to do with janus, intended as the server. The concept is that the client should do its best to notify the server a teardown and if that does not happen (e.g. abrupt disconnection) then server timeout kicks in.

The session should be destroyed when closing a tab/client but that totally depends on:

For example janus.js will try to destroy the session on the browser beforeUnload event and that will in turn close the WebSocket or send a beacon if using long-poll.

You might want to check if those mechanisms are working in your environment and if some elements in the middle (proxies/LB) can interfere with those.

B-R-Bender commented 1 month ago

Hello @atoppi, thank you for your answer.

As I said I'm using janus.js on a client side. The thing is - if I'm using "legacy" janus server and corresponding janus.js it works just fine (beforeUnload works and session get destroyed on tab closed). But now I'm trying to move to the latest multistream janus version (server and janus.js) for some reason it's not working.

So my question was - am I the only one experiencing such issue, and how do you think I can try to debug that. I can see the code which is sending the beacon is there in janus.js, but for some reason looks like it's not working.

atoppi commented 1 month ago

@B-R-Bender we are not aware of other users having similar issues. As I have already said, you need to double-check if the beacon/ws close frame is being sent when closing the tab. Try performing a packet capture on both client and server (maybe disabling HTTPS).

lminiero commented 3 weeks ago

Closing this as apparently not an issue. If you have more data as requested by @atoppi please do share.