meetecho / janus-gateway

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

JanusJS keep-alives seems broken (WebSockets) #1724

Closed mtltechtemp closed 4 years ago

mtltechtemp commented 5 years ago

Hello,

The session dies by itself even if we use it:

janus-gateway | [Mon Aug 5 13:53:45 2019] [WARN] [4127272717325404] Didn't receive audio for more than 1 seconds...
janus-gateway | [Mon Aug 5 13:54:00 2019] [WARN] [6474101148792786] Didn't receive audio for more than 1 seconds...
janus-gateway | [Mon Aug 5 13:54:00 2019] [WARN] [7187768266982945] Didn't receive audio for more than 1 seconds...
janus-gateway | [Mon Aug 5 13:57:43 2019] Destroying session 8415412121166452; 0x7f858805f1e0

(Ignore Didn't receive audio for more than 1 seconds... because even in the case where I send audio the session dies after about 10 minutes.)

It happens with audio bridge and textroom. https://github.com/meetecho/janus-gateway/blob/f60b0ae9edf9dad3b5cff22a4db02ff5c980538a/conf/janus.jcfg.sample.in#L53 Setting to 0 does not help.

https://github.com/meetecho/janus-gateway/blob/f60b0ae9edf9dad3b5cff22a4db02ff5c980538a/html/janus.js#L808 is not called in the code...

1199 (maybe related)

lminiero commented 5 years ago

keepAlive() in janus.js is only used for WebSockets, not HTTP. When using REST, the long poll acts as the keep-alive.

mtltechtemp commented 5 years ago

@lminiero I forgot to mention that I use WebSockets... Do you have any leads to help me?

lminiero commented 5 years ago

keepAlive() is automatically triggered by a timer, that we start when the WebSocket connection goes in the 'open' state: https://github.com/meetecho/janus-gateway/blob/master/html/janus.js#L886

You may want to add some log lines around that area, and maybe check that the value of keepAlivePeriod is for you. It has a default of 25000 (25 seconds), but can be overridden when initializing janus.js.

mtltechtemp commented 5 years ago

@lminiero Thanks, I'll investigate it. By using HTTPS instead of WebSockets the issue seems to disappears.

There' s really must be something wrong with WebSockets...

Edit: HTTPS works longer than WebSockets but also fails. What version of Janus do you use on the demo site? and janus.jcfg if you can, I may have misconfigured Janus.

lminiero commented 5 years ago

You can check the version we have online with a simple /info request: https://janus.conf.meetecho.com/janus/info

Any update on this? It's definitely not happening to us.

lminiero commented 4 years ago

@mtltechtemp why do you think #1199 is connected? Is this happening to you after a reconnect?

lminiero commented 4 years ago

Keep-alives after a reconnection seem to be working just fine for me. Closing as I tried several times and couldn't replicate this issue. Please feel free to reopen if you can provide steps to replicate this with master.