I am trying to increase the upload limit on my matrix server. I would like to push it to 500MB, but it keeps failing the upload past ~180MB. There is very little information about the failure, the client just says “Unkown error”, nginx says “error 499”, which means the client disconnected to quickly. Additionally, trying to recreate the failure with curl just results in a success, so the issue seems to be with the client. I tried with element-web, element desktop, element x and cinny and they all have this issue.

I run a continuwuity server on a Raspberry Pi 4B, behind two nginx reverse proxies and a rathole tunnel. Continuwuity, and the two reverse proxies run inside docker compose projects. Here is my architecture :

                   __
                 .(  ).
               (`Cloud )
                `-----`
                   |
                   V
          +- Outside server -+
          |   +---------+    |
          |   | rathole |    |
          |   +---------+    |
          +--------|---------+
                   |
+- Home network ---|-------------------------+
| +- RasPi --------|-----------------------+ |
| |                V                       | |
| |       +- tunnel docker -+              | |
| |       | +---------+     |              | |
| |       | | nginx 1 |     |              | |
| |       | +---------+     |              | |
| |       +-----|-|---------+              | |
| |             | |                        | |
| |             | +- other services -->... | |
| |             |                          | |
| |             V                          | |
| |       +- matrix docker --+             | |
| |       |   +---------+    |             | |
| |       |   | nginx 2 |    |             | |
| |       |   +---------+    |             | |
| |       |        |         |             | |
| |       | +------V-------+ |             | |
| |       | | Continuwuity | |             | |
| |       | +--------------+ |             | |
| |       +------------------+             | |
| +----------------------------------------+ |
+--------------------------------------------+

Of course, I made sure to increase the upload limit in Continuwuity :

max_request_size = 500000000

And in both nginx instances :

client_max_body_size 500M;

From what I can gather from other issues on the internet, it seems it could be related to timeout errors. Although they all seem to be talking about 2-8Gb files, I am probably running much weaker hardware than they do, so it checks out.

I tried setting the following values in both nginx instances :

location / {
    proxy_connect_timeout       600;
    proxy_send_timeout          600;
    proxy_read_timeout          600;
    send_timeout                600;
    proxy_next_upstream         off;
    proxy_buffering             off;

    proxy_pass ...;
}

And setting timeout values in Continuwuity :

client_receive_timeout = 75
client_request_timeout = 180
client_response_timeout = 120
client_shutdown_timeout = 10

Since that didn’t have any effect, I bumped them by 20x and 40x respectively :

location / {
    proxy_connect_timeout       18000;
    proxy_send_timeout          18000;
    proxy_read_timeout          18000;
    send_timeout                18000;
    proxy_next_upstream         off;
    proxy_buffering             off;

    proxy_pass ...;
}
client_receive_timeout = 3000
client_request_timeout = 7200
client_response_timeout = 4800
client_shutdown_timeout = 400

But that did not have any effect. I also looked at modifying element-web’s settings, but there doesn’t seem to be anything related to timeouts.

I also saw that encrypted vs. unencrypted rooms might have an effect, but I got ~190MB max in encrypted rooms and ~180MB in unencrypted rooms.

Finally, I tried using curl :

curl -X POST https://server.domain/_matrix/media/v3/upload -H "Authorization: Bearer <token>" -H "Content-Type application/octet-stream" --data @200mb.file
# success
# returns a mxc:// url
curl -X POST https://server.domain/_matrix/client/v1/media/download/server.name/file_id -H "Authorization: Bearer <token>" -o 200mb_copy.file
# See that the two files are identical

I am at a loss. What can I do to solve this issue?

  • gyoo@lemmy.caOP
    link
    fedilink
    English
    arrow-up
    1
    ·
    4 hours ago

    How would I do that? The curl command already works and the service is being handeld by the reverse proxy, which depends on the domain name to pass the requests correctly. Even if I succeeded, element-web is configured to send the file to the domain name, not the local address.