nextcloud / nextcloud/spreed

413 Request Entity Too Large when joining a call with many participants

Open
#7,367 4 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug feature: signaling 📶 low performance 🚀
Dominant language
PHP
Stars
2.2k
Forks
587
Avg merge
18h 27m
Merged PRs (30d)
333

Description

When a user joins a room with many users the request size might be too huge for the HPB:
https://github.com/strukturag/nextcloud-spreed-signaling/blob/cdf5cd47cb7d5bfd11f8d8d4635e5bd551cc5261/backend_server.go#L47

However upgrading the value in the HPB will not scale very long.

We should revisit all the signaling requests and try to get rid of the users and allusers lists

Client error: `POST https://…/standalone-signaling/api/v1/room/…` resulted in a `413 Request Entity Too Large` response:\nRequest entity too large

{
  "reqId": "3uzo6OT8MxmYiZyzF9lw",
  "level": 3,
  "time": "2022-05-13T12:21:36+00:00",
  "remoteAddr": "…",
  "user": "…",
  "app": "spreed",
  "method": "POST",
  "url": "/ocs/v2.php/apps/spreed/api/v4/call/…",
  "message": "Failed to send message to signaling server",
  "userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/101.0.4951.41 Safari/537.36",
  "version": "25.0.0.1",
  "exception": {
    "Exception": "GuzzleHttp\\Exception\\ClientException",
    "Message": "Client error: `POST https://…/standalone-signaling/api/v1/room/…` resulted in a `413 Request Entity Too Large` response:\nRequest entity too large\n\n",
    "Code": 413,
    "Trace": [
      {
        "file": "/var/www/html/3rdparty/guzzlehttp/guzzle/src/Middleware.php",
        "line": 69,
        "function": "create",
        "class": "GuzzleHttp\\Exception\\RequestException",
        "type": "::"
      },
      {
        "file": "/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php",
        "line": 204,
        "function": "GuzzleHttp\\{closure}",
        "class": "GuzzleHttp\\Middleware",
        "type": "::",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php",
        "line": 153,
        "function": "callHandler",
        "class": "GuzzleHttp\\Promise\\Promise",
        "type": "::"
      },
      {
        "file": "/var/www/html/3rdparty/guzzlehttp/promises/src/TaskQueue.php",
        "line": 48,
        "function": "GuzzleHttp\\Promise\\{closure}",
        "class": "GuzzleHttp\\Promise\\Promise",
        "type": "::",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php",
        "line": 248,
        "function": "run",
        "class": "GuzzleHttp\\Promise\\TaskQueue",
        "type": "->"
      },
      {
        "file": "/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php",
        "line": 224,
        "function": "invokeWaitFn",
        "class": "GuzzleHttp\\Promise\\Promise",
        "type": "->"
      },
      {
        "file": "/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php",
        "line": 269,
        "function": "waitIfPending",
        "class": "GuzzleHttp\\Promise\\Promise",
        "type": "->"
      },
      {
        "file": "/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php",
        "line": 226,
        "function": "invokeWaitList",
        "class": "GuzzleHttp\\Promise\\Promise",
        "type": "->"
      },
      {
        "file": "/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php",
        "line": 62,
        "function": "waitIfPending",
        "class": "GuzzleHttp\\Promise\\Promise",
        "type": "->"
      },
      {
        "file": "/var/www/html/3rdparty/guzzlehttp/guzzle/src/Client.php",
        "line": 187,
        "function": "wait",
        "class": "GuzzleHttp\\Promise\\Promise",
        "type": "->"
      },
      {
        "file": "/var/www/html/lib/private/Http/Client/Client.php",
        "line": 289,
        "function": "request",
        "class": "GuzzleHttp\\Client",
        "type": "->"
      },
      {
        "file": "/var/www/html/apps/spreed/lib/Signaling/BackendNotifier.php",
        "line": 80,
        "function": "post",
        "class": "OC\\Http\\Client\\Client",
        "type": "->"
      },
      {
        "file": "/var/www/html/apps/spreed/lib/Signaling/BackendNotifier.php",
        "line": 134,
        "function": "doRequest",
        "class": "OCA\\Talk\\Signaling\\BackendNotifier",
        "type": "->"
      },
      {
        "file": "/var/www/html/apps/spreed/lib/Signaling/BackendNotifier.php",
        "line": 400,
        "function": "backendRequest",
        "class": "OCA\\Talk\\Signaling\\BackendNotifier",
        "type": "->"
      },
      {
        "file": "/var/www/html/apps/spreed/lib/Signaling/Listener.php",
        "line": 304,
        "function": "roomInCallChanged",
        "class": "OCA\\Talk\\Signaling\\BackendNotifier",
        "type": "->"
      },
      {
        "file": "/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php",
        "line": 251,
        "function": "notifyAfterJoinUpdateAndLeave",
        "class": "OCA\\Talk\\Signaling\\Listener",
        "type": "::"
      },
      {
        "file": "/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php",
        "line": 73,
        "function": "callListeners",
        "class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/html/lib/private/EventDispatcher/EventDispatcher.php",
        "line": 88,
        "function": "dispatch",
        "class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/html/apps/spreed/lib/Service/ParticipantService.php",
        "line": 985,
        "function": "dispatch",
        "class": "OC\\EventDispatcher\\EventDispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/html/apps/spreed/lib/Controller/CallController.php",
        "line": 129,
        "function": "changeInCall",
        "class": "OCA\\Talk\\Service\\ParticipantService",
        "type": "->"
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 225,
        "function": "joinCall",
        "class": "OCA\\Talk\\Controller\\CallController",
        "type": "->"
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 133,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/App.php",
        "line": 172,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/html/lib/private/Route/Router.php",
        "line": 298,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/var/www/html/ocs/v1.php",
        "line": 62,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/var/www/html/ocs/v2.php",
        "line": 23,
        "args": [
          "/var/www/html/ocs/v1.php"
        ],
        "function": "require_once"
      }
    ],
    "File": "/var/www/html/3rdparty/guzzlehttp/guzzle/src/Exception/RequestException.php",
    "Line": 113,
    "CustomMessage": "Failed to send message to signaling server"
  }
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with backend_server.go around line 47 and trace the signaling requests from BackendNotifier.php, especially the paths shown in Listener.php, ParticipantService.php, and CallController.php. Identify where users and allusers are included, then verify that large-room joins no longer produce 413 responses and that the signaling requests still contain the information required by their consumers.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, php
Domain
api, audio-video-rtc, backend
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.