connectionDestroyed

Clients are not notified on Connection Destroyed event

Could you give more details please?

Thanks

Publisher doesnā€™t notify when connection is destroyed (closing the browser tab)
this.session.on(ā€˜connectionDestroyedā€™, (event: ConnectionEvent) => {
console.warn(ā€˜OTHER USERā€™S CONNECTION DESTROYED!ā€™);
console.warn(event.connection);
});

Server log when connection is destroyed
openvidu-server_1 | [INFO] 2020-09-02 06:07:15,141 [jsonrpcTaskScheduler-1] io.openvidu.server.kurento.core.KurentoSession - PARTICIPANT con_EwebJw2Dlu: Leaving session 1
openvidu-server_1 | [ERROR] 2020-09-02 06:07:15,143 [jsonrpcTaskScheduler-1] io.openvidu.server.rpc.RpcHandler - Uncaught exception for WebSocket session: vg0qpmq9mrcggisgndoju8n7pj - Exception: {}
openvidu-server_1 | java.lang.NullPointerException: null
openvidu-server_1 | at io.openvidu.server.kurento.core.KurentoSessionManager.leaveRoom(KurentoSessionManager.java:220)
openvidu-server_1 | at io.openvidu.server.kurento.core.KurentoSessionManager.evictParticipant(KurentoSessionManager.java:661)
openvidu-server_1 | at io.openvidu.server.rpc.RpcHandler.leaveRoomAfterConnClosed(RpcHandler.java:636)
openvidu-server_1 | at io.openvidu.server.rpc.RpcHandler.afterConnectionClosed(RpcHandler.java:689)
openvidu-server_1 | at org.kurento.jsonrpc.internal.JsonRpcHandlerManager.afterConnectionClosed(JsonRpcHandlerManager.java:65)
openvidu-server_1 | at org.kurento.jsonrpc.internal.server.ProtocolManager.closeSession(ProtocolManager.java:446)
openvidu-server_1 | at org.kurento.jsonrpc.internal.server.ProtocolManager$4.run(ProtocolManager.java:421)
openvidu-server_1 | at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
openvidu-server_1 | at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
openvidu-server_1 | at java.util.concurrent.FutureTask.run(FutureTask.java:266)
openvidu-server_1 | at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
openvidu-server_1 | at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
openvidu-server_1 | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
openvidu-server_1 | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
openvidu-server_1 | at java.lang.Thread.run(Thread.java:748)

In https://demos.openvidu.io/classroom on disconnect it is showing OTHER USERā€™S CONNECTION DESTROYED! but on premises it is not working

Thereā€™s something wrong with your deployment. You COTURN service is not available. If you have deployed OpenVidu as official instructions state, all of the necessary services will be up and running. Execute command docker ps -a in your server and paste here the output. It will list all of the services of your deployment.

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
43b6a3472911 openvidu/openvidu-redis:1.0.0 ā€œdocker-entrypoint.sā€¦ā€ 44 hours ago Up 44 hours openvidu_redis_1
e6202d152e54 openvidu/openvidu-server:2.15.0 ā€œ/bin/bash -c 'exporā€¦ā€ 44 hours ago Up 44 hours openvidu_openvidu-server_1
bba662bea385 kurento/kurento-media-server:6.14.0 ā€œ/entrypoint.shā€ 44 hours ago Up 44 hours (healthy) openvidu_kms_1
f98d958c0a8c openvidu/openvidu-coturn:1.0.0 ā€œ/bin/sh -c /usr/locā€¦ā€ 44 hours ago Up 44 hours openvidu_coturn_1
3bc6bcc76095 openvidu/openvidu-call:2.15.0 ā€œdocker-entrypoint.sā€¦ā€ 44 hours ago Up 44 hours openvidu_app_1
03eb5400933a openvidu/openvidu-proxy:3.0.0 ā€œ/bin/sh -c /usr/locā€¦ā€ 44 hours ago Up 44 hours openvidu_nginx_1
fc96375d01c1 hello-world ā€œ/helloā€ 11 days ago Exited (0) 11 days ago naughty_brown
bb23cfd0d6bd hello-world ā€œ/helloā€ 11 days ago Exited (0) 11 days ago upbeat_bardeen

The line triggering the error that is preventing the proper disconnection of users is this one: https://github.com/OpenVidu/openvidu/blob/master/openvidu-server/src/main/java/io/openvidu/server/kurento/core/KurentoSessionManager.java#L220

As you see, the CoturnCredentialsService is having problems cleaning up the TURN credentials for the leaving user. The NullPointer must be being triggered at some point by the method parameter: p.getToken().getTurnCredentials().getUsername(), which implies that openvidu-server wasnā€™t able to generate the required credentials when the token for this participant was created. Which brings me to the idea I was commenting on at the beginning: openvidu-server contanier couldnā€™t properly communicate with the coturn container.

Letā€™s narrow down the problem:

  • When did you start getting this error? Did the deployment work fine and at some point this error started being triggered?
  • How did you deployed OpenVidu? Did you follow exactly these instructions?
  • Can you paste here your .env configuration file? (be aware of hiding your secret and domain!!!)

Iā€™ve deleted your previous message because the formatting of your .env file was crazy. Please, paste it inside a code block (three back quotes):

image

See the preview text besides your message before posting to make sure it is well formatted. If not it is a complete nightmare to review. Thanks.

1. Getting this error after deployment when running OpenVidu Call application demo. Deployment worked fine.

2. Yes exactly these instructions

3. OpenVidu configuration

#----------------------

#NOTE: This file doesn't need to quote assignment values, like most shells do.

#All values are stored as-is, even if they contain spaces, so don't quote them.

#Domain name. If you do not have one, the public IP of the machine.

#For example: 198.51.100.1, or openvidu.example.com

DOMAIN_OR_PUBLIC_IP=

#OpenVidu SECRET used for apps to connect to OpenVidu server and users to access to OpenVidu Dashboard

OPENVIDU_SECRET=

#Certificate type:

#- selfsigned: Self signed certificate. Not recommended for production use.

#Users will see an ERROR when connected to web page.

#- owncert: Valid certificate purchased in a Internet services company.

#Please put the certificates files inside folder ./owncert

#with names certificate.key and certificate.cert

#- letsencrypt: Generate a new certificate using letsencrypt. Please set the

#required contact email for Let's Encrypt in LETSENCRYPT_EMAIL

#variable.

CERTIFICATE_TYPE=letsencrypt

#If CERTIFICATE_TYPE=letsencrypt, you need to configure a valid email for notifications

LETSENCRYPT_EMAIL=

#Proxy configuration

#If you want to change the ports on which openvidu listens, uncomment the following lines

#Allows any request to http://DOMAIN_OR_PUBLIC_IP:HTTP_PORT/ to be automatically

#redirected to https://DOMAIN_OR_PUBLIC_IP:HTTPS_PORT/.

#WARNING: the default port 80 cannot be changed during the first boot

#if you have chosen to deploy with the option CERTIFICATE_TYPE=letsencrypt

#HTTP_PORT=80

#Changes the port of all services exposed by OpenVidu.

#SDKs, REST clients and browsers will have to connect to this port

#HTTPS_PORT=443

#Access restrictions

#In this section you will be able to restrict the IPs from which you can access to

#Openvidu API and the Administration Panel

#WARNING! If you touch this configuration you can lose access to the platform from some IPs.

#Use it carefully.

#This section limits access to the /dashboard (OpenVidu CE) and /inspector (OpenVidu Pro) pages.

#The form for a single IP or an IP range is:

#ALLOWED_ACCESS_TO_DASHBOARD=198.51.100.1 and ALLOWED_ACCESS_TO_DASHBOARD=198.51.100.0/24

#To limit multiple IPs or or IP ranges, separate by commas like this:

#ALLOWED_ACCESS_TO_RESTAPI=198.51.100.1, 198.51.100.0/24

#ALLOWED_ACCESS_TO_RESTAPI=

#Whether to enable recording module or not

OPENVIDU_RECORDING=false

#Use recording module with debug mode.

OPENVIDU_RECORDING_DEBUG=false

#Openvidu Folder Record used for save the openvidu recording videos. Change it

#with the folder you want to use from your host.

OPENVIDU_RECORDING_PATH=/opt/openvidu/recordings

#System path where OpenVidu Server should look for custom recording layouts

OPENVIDU_RECORDING_CUSTOM_LAYOUT=/opt/openvidu/custom-layout

#if true any client can connect to

#https://OPENVIDU_SERVER_IP:OPENVIDU_PORT/recordings/any_session_file.mp4

#and access any recorded video file. If false this path will be secured with

#OPENVIDU_SECRET param just as OpenVidu Server dashboard at

#https://OPENVIDU_SERVER_IP:OPENVIDU_PORT

#Values: true | false

OPENVIDU_RECORDING_PUBLIC_ACCESS=false

#Which users should receive the recording events in the client side

#(recordingStarted, recordingStopped). Can be all (every user connected to

#the session), publisher_moderator (users with role 'PUBLISHER' or

#'MODERATOR'), moderator (only users with role 'MODERATOR') or none

#(no user will receive these events)

OPENVIDU_RECORDING_NOTIFICATION=publisher_moderator

#Timeout in seconds for recordings to automatically stop (and the session involved to be closed)

#when conditions are met: a session recording is started but no user is publishing to it or a session

#is being recorded and last user disconnects. If a user publishes within the timeout in either case,

#the automatic stop of the recording is cancelled

#0 means no timeout

OPENVIDU_RECORDING_AUTOSTOP_TIMEOUT=120

#Maximum video bandwidth sent from clients to OpenVidu Server, in kbps.

#0 means unconstrained

OPENVIDU_STREAMS_VIDEO_MAX_RECV_BANDWIDTH=1000

#Maximum video bandwidth sent from OpenVidu Server to clients, in kbps.

#0 means unconstrained

OPENVIDU_STREAMS_VIDEO_MAX_SEND_BANDWIDTH=1000

#Minimum video bandwidth sent from OpenVidu Server to clients, in kbps.

#0 means unconstrained

OPENVIDU_STREAMS_VIDEO_MIN_SEND_BANDWIDTH=300

#true to enable OpenVidu Webhook service. false' otherwise

#Values: true | false

OPENVIDU_WEBHOOK=false

#HTTP endpoint where OpenVidu Server will send Webhook HTTP POST messages

#Must be a valid URL: http(s)://ENDPOINT

#OPENVIDU_WEBHOOK_ENDPOINT=

#List of headers that OpenVidu Webhook service will attach to HTTP POST messages

#OPENVIDU_WEBHOOK_HEADERS=

#List of events that will be sent by OpenVidu Webhook service

#Leave blank if all events.

OPENVIDU_WEBHOOK_EVENTS=[sessionCreated,sessionDestroyed,participantJoined,participantLeft,webrtcConnectionCreated,webrtcConnectionDestroyed,recordingStatusChanged,filterEventDispatched,mediaNodeStatusCh$

#How often the garbage collector of non active sessions runs.

#This helps cleaning up sessions that have been initialized through

#REST API (and maybe tokens have been created for them) but have had no users connected.

#Default to 900s (15 mins). 0 to disable non active sessions garbage collector

OPENVIDU_SESSIONS_GARBAGE_INTERVAL=900

#Minimum time in seconds that a non active session must have been in existence

#for the garbage collector of non active sessions to remove it. Default to 3600s (1 hour).

#If non active sessions garbage collector is disabled

#(property 'OPENVIDU_SESSIONS_GARBAGE_INTERVAL' to 0) this property is ignored

OPENVIDU_SESSIONS_GARBAGE_THRESHOLD=3600

#Call Detail Record enabled

#Whether to enable Call Detail Record or not

#Values: true | false

OPENVIDU_CDR=false

#Path where the cdr log files are hosted

OPENVIDU_CDR_PATH=/opt/openvidu/cdr

#Kurento Media Server image

#--------------------------

#Docker hub kurento media server: 

#Uncomment the next line and define this variable with KMS image that you want use

#KMS_IMAGE=kurento/kurento-media-server-dev:6.14.0

#Kurento Media Server Level logs

#-------------------------------

#Uncomment the next line and define this variable to change

#the verbosity level of the logs of KMS

#Documentation: 

#KMS_DEBUG_LEVEL=3,Kurento*:4,kms*:4,sdp*:4,webrtc*:4,*rtpendpoint:4,rtp*handler:4,rtpsynchronizer:4,agnosticbin:4

#Openvidu Server Level logs

#--------------------------

#Uncomment the next line and define this variable to change

#the verbosity level of the logs of Openvidu Service

#RECOMENDED VALUES: INFO for normal logs DEBUG for more verbose logs

#OV_CE_DEBUG_LEVEL=INFO

#Java Options

#--------------------------

#Uncomment the next line and define this to add

#options to java command

#Documentation: 

#JAVA_OPTIONS=-Xms2048m -Xmx4096m -Duser.timezone=UTC

Ok, Iā€™m not sure Iā€™m following you with your answer to question 1. What I was asking is this:

I see that your deployment has been active for 44 hours at least (as shown by your docker containers). I want to know if the error has been there from the very beginning of the deployment, or if everything was working just fine until like 2 hours ago, when it started failing.

yes error has been there from the very beginning of the deployment.

Hi,

Any solution to above problem.

thanks

Hi,

Please, post in here the file generated by command:

./openvidu report

in your OpenVidu installation path.

If the file is too long to be posted here, simply paste a link to an external download so we can review it.

Thanks.

givegita.com/openvidu-report.zip

Hello @kapil_chauhan

Iā€™m thinking that youā€™re using OpenVidu in the wrong way. Let me ask these questions:

  • Are you using a real domain name? You canā€™t use example.com as a domain if youā€™re using it. You need to register one
  • Are you deploying this in your development machine? Or in a VPS or any cloud provider.
  • How are you accessing OpenVidu in the browser? If you have a domain registered, are you accessing via the domain name?

Regards,
Carlos

  1. Yes using the real domain name, example.com is just to hide the secret and domain.
  2. Deployed on Microsoft Azure VM.
  3. Yes. https://sancharserver.givegita.com/

you can try Videoconference default app, connect two users and then close one browser tab you will see remote video freezes on other users.

do you want me to provide report with real domain and secret?

Yes please,

You can email me: carlos.ruiz@openvidu.io

Sent, please check.

Thanks.

Received, Iā€™m checking

I think the problem is related with the configured OPENVIDU_SECRET being too complex with a lot of weird characters. I think bash is not interpreting correctly the password or thereā€™s some kind of parse error somewhere. Iā€™ll try to replicate your problem using your secret in my own environment.

Can you test to use a simpler OPENVIDU_SECRET?. With only characters and numbers for example.

Regards,
Carlos

It worked, :slightly_smiling_face:

Thanks

1 Like