Closed fabfreitas closed 3 years ago
Hello @fslayer! :wave: we're sorry you found a bug... so first of all, thank you very much for reporting it.
To know about progress, check in Triage. All issues are considered Backlog Candidates until work priorities align and the issue is selected for development. It will then become part of our official Backlog.
6. Stop the KMS, Start the KMS and see the log. Soon many messages of Session shoulb be removed is going to be showed.
Just to confirm: in step 6, you actually mean to completely stop the media server, i.e. finish the kurento-media-server
process, so KMS is not running at all, and then re-launch it?
If that is the case, then I believe the "TODO" comment was left there because what needs to be done is more complicated: it's all the clients the ones that need to do cleanup on their sides, as in this scenario, KMS has been relaunched so it doesn't have in memory any data of any past session.
If I understood the step 6 correctly, your scenario is this:
In this scenario, which I believe is the one you describe, the meaning of the message is: "TODO: at this point, clients should be notified that their session ID is no longer valid and they should dispose it".
Your proposed solution, on the other hand, would forcefully close the connection with the client. So, the client would either fail with a "connection rejected from server", or more possibly, think that a connectivity interruption has happened, and simply try to reconnect again.
This is all my understanding, in theory. To verify if it matches in practice, you could carefully observe the behavior of clients to verify if things are happening like that. It also would be interesting if you test the code changes that you proposed; it's just a matter of editing the code in kurento-media-server and then building your own .deb package, which is almost trivial by using the kurento-buildpackage Docker image as explained in Create Deb packages.
@j1elo, one more issue that I observe in 6.15.0 is the fact if I restart the service, via systemclt restart, the IPV4 and IPV6 fails to bound the ports. When I run $systemctl stop kurento... the service take a while to stop and, only after this, I start the service again.
So, in step 6 I stop the server, see the running processes, make sure that KMS isn't active, start again and see the log to make sure that the port 8433 is listening.
About the reconnections:
I am testing multiple connections on 1 session ( 1 Presenter, 1700 viewers). With about 1650 connections, the server start to response timeout error, as the example below:
2020-11-18 13:13:39,958 ERROR [pool-4-thread-1685] UserSession: [Error on creating client 1685] [KurentoClient] Timeout of 10000 milliseconds waiting from response to request {"id":52859,"method":"invoke","params":{"object":"75898415-c531-4c9a-b9e6-0d40af30d2ff_kurento.MediaPipeline/a61ff26c-1856-44ee-9789-fb674b5c0a1a_kurento.WebRtcEndpoint","operation":"getMediaPipeline","sessionId":"e29845a8-a1c2-497d-85c8-5844e0559d13"},"jsonrpc":"2.0"}
I guess this timeout is setted in some source-code, because I tried pass new values throught the kurento-client, but doesn't work. I tried pass via properties too.
-Dkurento.client.connectionTimeout=60000
-DjsonRpcServerWebSocket.timeout=25000
When this timeout occours, I stop the Viewers and the Presenter on the app, but the service on KMS server stays "stucked" and I have to stop and start it again the release resources. When it goes back on air, the messages about sessions that should be removed starts to fill of my log.
Why was this issue closed? The referenced PR only adds info / documentation, but doesn't solve the underlying problem.
The question is: should Kurento kill idle sessions, or should clients do it, isn't it?
Prerequisites
Issue description
I am getting - indefinitely - the message:
fixme KurentoWebSocketTransport WebSocketTransport.cpp:352 keepAliveSessions() Session should be removed
I already set the Garbage Collector do 60 seconds, but the old sessions still keep.
Context
After many concourrent connections and the client is gone, the sessions still kept on server.
How to reproduce?
Using this tool webrtc-benchmark:
Run the app with this java arguments:
-Dkms.ws.uri=wss://[IP SERVER]:8433/kurento
-Dfake.kms.ws.uri=wss://[IP SERVER]:8433/kurento
Note: You can use the ws protocol too.
In a brower go to localhost:8443 and start a connection as Presenter.
Open a new tab, go to the same url at step 2, configure the parametres to 1700 fake clients and 500 miliseconds between each connection and start the connections as Viewer.
In your server, open the Log and observe.
At the end of connections or even at the middle of process, stop (pushing the stop button on web app). First to viewers and next to Presenter.
Stop the KMS, Start the KMS and see the log. Soon many messages of Session shoulb be removed is going to be showed.
Expected & current behavior
The fix message about sessions that should be removed are showing forever.
Possible solution
In the WebSocketTransport.cpp at the line 348 we have this:
Could this code resolve this TODO?
INFO about Kurento Media Server
INFO about your Application Server
INFO about end-user clients
INFO about your environment
Kurento Server
Cliente Application
Run these commands