Downloading big file from public share link restarts at 1 GB

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 20.0.5): 27.1.2 also 25.0.12, 26.0.4, 26.0.7,
Operating system and version (eg, Ubuntu 20.04): Ubuntu 22.04 deployed using Docker image nextcloud:27.0.12 on virtual machine with Ubuntu system
Apache or nginx version (eg, Apache 2.4.25): 2.4.X in Docker image
PHP version (eg, 7.4): 8.x in Docker image

Other:

Nginx in front
S3 storage as priamry storage.

The issue you are facing:

Downloading big file from public share link fails and restarts at 1GB if connection is too slow. The same file can be downloaded easily even on much lower connection speed when downloading as user from Nextcloud GUI.

I spend last few days on trying to figure it out, i know that this 1GB size is limited by nginx in front of used by my instance s3 storage, but the same file downloaded as user keep downloads after 1 GB and just starts another part of file. Using public share links for downloading always restarts and download process starts from the beginning.

I am wonder why downloading as user and from public share link behaves differently?

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. Have nextcloud instaleled and configured with s3 as primary storage, and nginx in front of it.
  2. Upload big file (> 1GB)
  3. Create share link and used it to download that file.

The output of your Nextcloud log in Admin > Logging:

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

I paste output of occ config:list command, because my config.php is divided into smaller pieces

   "system": {
        "htaccess.RewriteBase": "\/",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "apps_paths": [
            {
                "path": "\/var\/www\/html\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/www\/html\/custom_apps",
                "url": "\/custom_apps",
                "writable": true
            }
        ],
        "overwritehost": "***REMOVED SENSITIVE VALUE***"",
        "overwriteprotocol": "https",
        "mail_smtpmode": "smtp",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "587",
        "mail_smtpsecure": "tls",
        "mail_smtpauth": true,
        "mail_smtpauthtype": "LOGIN",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "theme": "",
        "loglevel": 0,
        "allow_local_remote_servers": true,
        "activity_use_cached_mountpoints": true,
        "overwrite.cli.url": "https:\/\/***REMOVED SENSITIVE VALUE***"",
        "default_phone_region": "PL",
        "simpleSignUpLink.shown": false,
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "password": "***REMOVED SENSITIVE VALUE***",
            "port": 6379
        },
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "localhost",
            "***REMOVED SENSITIVE VALUE***"",
            "192.168.0.5"
        ],
        "dbtype": "pgsql",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "dbtableprefix": "oc_",
        "objectstore_multibucket": {
            "class": "\\OC\\Files\\ObjectStore\\S3",
            "arguments": {
                "autocreate": true,
                "bucket": "***REMOVED SENSITIVE VALUE***"",
                "num_buckets": "4",
                "key": "***REMOVED SENSITIVE VALUE***",
                "secret": "***REMOVED SENSITIVE VALUE***",
                "region": "default",
                "hostname": "***REMOVED SENSITIVE VALUE***"",
                "port": "443",
                "use_ssl": true,
                "uploadPartSize": "33554432",
                "putSizeLimit": "33554432",
                "timeout": 91
            }
        },
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "version": "25.0.12.0",
        "dbport": "",
        "installed": true,
        "memories.exiftool": "\/var\/www\/html\/custom_apps\/memories\/exiftool-bin\/exiftool-amd64-glibc",
        "memories.vod.path": "\/var\/www\/html\/custom_apps\/memories\/exiftool-bin\/go-vod-amd64"
    },

The output of your Apache/nginx/system log in /var/log/____:

not needed

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

{
  "reqId": "6YOemYVCcbA1siN093Ep",
  "level": 0,
  "time": "2023-10-14T19:38:57+00:00",
  "remoteAddr": "X.X.X.X",
  "user": "--",
  "app": "no app in context",
  "method": "GET",
  "url": "/s/kJD6to66ML7qNmk/download/R2023b_Update_1_Windows.iso",
  "message": "Connection lost. Status: 1",
  "userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36",
  "version": "25.0.12.0",
  "exception": {
    "Exception": "OCP\\Files\\ConnectionLostException",
    "Message": "Connection lost. Status: 1",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/html/lib/private/Files/View.php",
        "line": 433,
        "function": "checkConnectionStatus",
        "class": "OC\\Files\\View",
        "type": "->",
        "args": []
      },
      {
        "file": "/var/www/html/lib/private/legacy/OC_Files.php",
        "line": 387,
        "function": "readfile",
        "class": "OC\\Files\\View",
        "type": "->",
        "args": [
          "/apl_big_folder/R2023b_Update_1_Windows.iso"
        ]
      },
      {
        "file": "/var/www/html/lib/private/legacy/OC_Files.php",
        "line": 126,
        "function": "getSingleFile",
        "class": "OC_Files",
        "type": "::",
        "args": [
          [
            "OC\\Files\\View"
          ],
          "/apl_big_folder",
          "R2023b_Update_1_Windows.iso",
          [
            false
          ]
        ]
      },
      {
        "file": "/var/www/html/apps/files_sharing/lib/Controller/ShareController.php",
        "line": 709,
        "function": "get",
        "class": "OC_Files",
        "type": "::",
        "args": [
          "/apl_big_folder",
          "R2023b_Update_1_Windows.iso",
          [
            false
          ]
        ]
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 225,
        "function": "downloadShare",
        "class": "OCA\\Files_Sharing\\Controller\\ShareController",
        "type": "->",
        "args": [
          "kJD6to66ML7qNmk",
          null,
          "",
          ""
        ]
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 133,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          [
            "OCA\\Files_Sharing\\Controller\\ShareController"
          ],
          "downloadShare"
        ]
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/App.php",
        "line": 172,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          [
            "OCA\\Files_Sharing\\Controller\\ShareController"
          ],
          "downloadShare"
        ]
      },
      {
        "file": "/var/www/html/lib/private/Route/Router.php",
        "line": 298,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::",
        "args": [
          "OCA\\Files_Sharing\\Controller\\ShareController",
          "downloadShare",
          [
            "OC\\AppFramework\\DependencyInjection\\DIContainer"
          ],
          [
            "R2023b_Update_1_Windows.iso",
            "kJD6to66ML7qNmk",
            "files_sharing.Share.downloadShare"
          ]
        ]
      },
      {
        "file": "/var/www/html/lib/base.php",
        "line": 1053,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->",
        "args": [
          "/s/kJD6to66ML7qNmk/download/R2023b_Update_1_Windows.iso"
        ]
      },
      {
        "file": "/var/www/html/index.php",
        "line": 36,
        "function": "handleRequest",
        "class": "OC",
        "type": "::",
        "args": []
      }
    ],
    "File": "/var/www/html/lib/private/Files/View.php",
    "Line": 500,
    "CustomMessage": "--"
  }
}

It turned out that this was caused by s3 only. When using s3 it’s better to make sure that there are no limits such as buffers, timeouts etc. My administrator tuned it up and now my Nextcloud is working great.