Kurento / bugtracker

[ARCHIVED] Contents migrated to monorepo: https://github.com/Kurento/kurento
46 stars 10 forks source link

No response when calling certain RPC methods over non-existing objects in KMS #351

Open pabloFuente opened 5 years ago

pabloFuente commented 5 years ago

Summary: When executing some RPC methods over non-existing KMS objects, a response similar to "Media object not found" is expected but no response is received at all. This has been encountered for the following methods:

KMS Version:

Kurento Media Server version: 6.9.1~5.g3e41ba3
Found modules:
    'core' version 6.9.1~1.g8a7c4d5
    'elements' version 6.9.1~3.g338a662
    'filters' version 6.9.1~1.g92d67c6

Other libraries versions:

ii  gstreamer1.5-libav:amd64                   1.8.2.1.xenial~20181018140706.96.493eee4        amd64        libav plugin for GStreamer
ii  gstreamer1.5-nice:amd64                    0.1.15-1kurento2.16.04~20190214125843.gbpaa63a5 amd64        ICE library (GStreamer 1.5 plugin)
ii  gstreamer1.5-plugins-bad:amd64             1.8.1.1.xenial~20181018134602.100.3db37b1       amd64        GStreamer plugins from the "bad" set
ii  gstreamer1.5-plugins-base:amd64            1.8.1.1.xenial~20181018132104.55.7b19cfd        amd64        GStreamer plugins from the "base" set
ii  gstreamer1.5-plugins-good:amd64            1.8.1.1.xenial~20181018133150.112.9ee4248       amd64        GStreamer plugins from the "good" set
ii  gstreamer1.5-plugins-ugly:amd64            1.8.1.1.xenial~20181018140138.89.2685b0f        amd64        GStreamer plugins from the "ugly" set
ii  gstreamer1.5-pulseaudio:amd64              1.8.1.1.xenial~20181018133150.112.9ee4248       amd64        GStreamer plugin for PulseAudio
ii  gstreamer1.5-x:amd64                       1.8.1.1.xenial~20181018132104.55.7b19cfd        amd64        GStreamer plugins for X11 and Pango
ii  kms-core                                   6.9.1.xenial~20181217205652.1.8a7c4d5           amd64        Kurento Core module
ii  kms-elements                               6.9.1.xenial~20181221093057.3.338a662           amd64        Kurento Elements module
ii  kms-filters                                6.9.1.xenial~20181221093848.1.92d67c6           amd64        Kurento Filters module
ii  kms-jsonrpc                                6.9.1.xenial~20181217205215.1.58eaf08           amd64        Kurento JSON-RPC library
ii  kmsjsoncpp                                 1.6.3.xenial.20181017180019.d78deb7             amd64        Kurento jsoncpp library
ii  kurento-media-server                       6.9.1.xenial~20190128070000.5.3e41ba3           amd64        Kurento Media Server
ii  libgstreamer-plugins-bad1.5-0:amd64        1.8.1.1.xenial~20181018134602.100.3db37b1       amd64        GStreamer development files for libraries from the "bad" set
ii  libgstreamer-plugins-base1.5-0:amd64       1.8.1.1.xenial~20181018132104.55.7b19cfd        amd64        GStreamer libraries from the "base" set
ii  libgstreamer1.5-0:amd64                    1.8.1.1.xenial~20181018130734.170.0d6031b       amd64        Core GStreamer libraries and elements
ii  libnice10:amd64                            0.1.15-1kurento2.16.04~20190214125843.gbpaa63a5 amd64        ICE library (shared library)
ii  libreoffice-avmedia-backend-gstreamer      1:5.1.6~rc2-0ubuntu1~xenial6                    amd64        GStreamer backend for LibreOffice
ii  openh264-gst-plugins-bad-1.5:amd64         1.8.1.1.xenial~20181018134602.100.3db37b1       amd64        GStreamer plugins from openh264

Client libraries

Browsers tested Not relevant

System description: Simple localhost development setup: KMS and Java client located in the same machine and using localhost ips

What steps will reproduce the problem?

  1. Start KMS and any Java application making use of Kurento Client for Java
  2. Start a RecorderEndpoint storing any WebRtcEndpoint
  3. Restart KMS and reconnect Kurento Client of the Java app to it. At this point no media object will be available at KMS
  4. Try calling RecorderEndpoint.stop() or RecorderEndpoint.addStoppedListener() over the object previously created in point 2. None of those calls will ever return.

What is the expected result? An error response stating that certain media object has not been found. For example, performing the exact same steps but calling WebRtcEndpoint.getName() in step 4 will in fact return the desired error.

What happens instead? No response is recevied at all. In this case by using Kurento Client for Java, the 2 methods stated in the issue will never return and the thread will be blocked

j1elo commented 5 years ago

I was able to reproduce this issue, but seems that KMS does actually inform the client app about the error. When the client tries to subscribe to the "Stopped" event of a RecorderEndpoint which doesn't actually exist...

DEBUG   KurentoWebSocketTransport WebSocketTransport.cpp:427:processMessage:
Message: {"id":24,"method":"subscribe","params":{"type":"Stopped",
"object":"298bfb63-6d0c-4a01-8fcf-f06d0e8a4b9d_kurento.MediaPipeline/ffe8e125-f95c-4a15-b8c7-0411dcee667d_kurento.RecorderEndpoint",
"sessionId":"b3736a86-6f20-456e-87d3-fc9bdc16990c"},"jsonrpc":"2.0"}

KMS replies with an error event indicating that the object ffe8e125-f95c-4a15-b8c7-0411dcee667d_kurento.RecorderEndpoint doesn't exist so the operation failed:

DEBUG   KurentoWebSocketTransport WebSocketTransport.cpp:429:processMessage:
Response: {"error":{"code":40101,"data":{"type":"MEDIA_OBJECT_NOT_FOUND"},
"message":"Object '298bfb63-6d0c-4a01-8fcf-f06d0e8a4b9d_kurento.MediaPipeline/ffe8e125-f95c-4a15-b8c7-0411dcee667d_kurento.RecorderEndpoint' not found"},
"id":24,"jsonrpc":"2.0"}
j1elo commented 5 years ago

This is not a bug in Kurento Media Server, but a weakness of the Kurento Java client. The client library is blocking the caller app indefinitely while ignoring the error event that KMS sends about an non-existing object ID.

What should happen here is that the client library receives this error, understands that a currently ongoing request is about an object that doesn't exist any more, abort that request, and return control to the caller application.

This means nothing to do in KMS itself, but the mentioned ability needs to be added to the Java client. Adding similar behavior to the JS client would also be a good idea, to keep both clients on par with features.