Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Reading 2 GB file from a public link share ends over and over after 1 GB #32731

Closed
5 of 8 tasks
vpecinka opened this issue Jun 6, 2022 · 2 comments
Closed
5 of 8 tasks
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap bug feature: object storage needs info

Comments

@vpecinka
Copy link
Contributor

vpecinka commented Jun 6, 2022

⚠️ This issue respects the following points: ⚠️

  • This is a bug, not a question or a configuration/webserver/proxy issue.
  • This issue is not already reported on Github (I've searched it).
  • Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
  • I agree to follow Nextcloud's Code of Conduct.

Bug description

While trying to read a 2GB file in shared directory (via public link) the transfer breaks after 1 GB (over and over). The source file is located in object storage (Swift). The source file is not corrupted, can be downloaded from the Swift storage.

When I impersonate the user sharing the directory and navigate to the source folder and download the 2GB file from it - the same happens.

image

Steps to reproduce

  1. Open shared folder, click download
  2. Wait until cca 1 GB is download, it breaks
  3. Tested using Safari and wget
  4. Navigate to the source folder (not shared)
  5. Click "..." and Download file => the same error around 1,08 GB

Expected behavior

File should be downloaded correctly.

Installation method

Manual installation

Operating system

Debian/Ubuntu

PHP engine version

PHP 7.3

Web server

Nginx

Database engine version

MySQL

Is this bug present after an update or on a fresh install?

No response

Are you using the Nextcloud Server Encryption module?

No response

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

{
    "system": {
        "version": "22.2.5.1",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "lookup_server": "",
        "enable_avatars": false,
        "default_phone_region": "CZ",
        "tempdirectory": "\/www\/log",
        "trusted_domains": [
            "***REMOVED SENSITIVE VALUE***",
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "objectstore_multibucket": {
            "class": "OC\\Files\\ObjectStore\\Swift",
            "arguments": {
                "user": {
                    "name": "***REMOVED SENSITIVE VALUE***",
                    "password": "***REMOVED SENSITIVE VALUE***",
                    "domain": {
                        "name": "***REMOVED SENSITIVE VALUE***"
                    }
                },
                "scope": {
                    "project": {
                        "name": "***REMOVED SENSITIVE VALUE***",
                        "domain": {
                            "name": "***REMOVED SENSITIVE VALUE***"
                        }
                    }
                },
                "region": "Kokura",
                "url": "***REMOVED SENSITIVE VALUE***",
                "objectPrefix": "id:",
                "num_buckets": 64,
                "bucket": "nc_",
                "autocreate": true,
                "tenantName": "s_64",
                "serviceName": "***REMOVED SENSITIVE VALUE***",
                "segmentSize": 209715200
            }
        },
        "overwrite.cli.url": "***REMOVED SENSITIVE VALUE***",
        "overwriteprotocol": "https",
        "dbtype": "mysql",
        "dbtableprefix": "oc_",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "ldapIgnoreNamingRules": false,
        "mail_smtpmode": "smtp",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "25",
        "mail_smtpdebug": true,
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "filelocking.enabled": "true",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": "6379",
            "timeout": 0.5,
            "password": "***REMOVED SENSITIVE VALUE***"
        },
        "appstore.experimental.enabled": false,
        "proxy": "***REMOVED SENSITIVE VALUE***",
        "proxyexclude": [
            "***REMOVED SENSITIVE VALUE***"
        ],
        "logtimezone": "UTC",
        "loglevel": "3",
        "logfile": "\/www\/log\/nextcloud.log",
        "maintenance": false,
        "updatechecker": false,
        "activity_expire_days": 30,
        "ldapProviderFactory": "\\OCA\\User_LDAP\\LDAPProviderFactory",
        "auth.bruteforce.protection.enabled": false,
        "versions_retention_obligation": "21, 60",
        "trashbin_retention_obligation": "100, 200",
        "integrity.check.disabled": true,
        "twofactor_enforced": "true",
        "twofactor_enforced_groups": [],
        "twofactor_enforced_excluded_groups": []
    }
}

List of activated Apps

Enabled:
  - accessibility: 1.8.0
  - activity: 2.15.0
  - admin_audit: 1.12.0
  - circles: 22.2.0
  - cloud_federation_api: 1.5.0
  - comments: 1.12.0
  - dav: 1.20.0
  - deck: 1.5.5
  - federatedfilesharing: 1.12.0
  - federation: 1.12.0
  - files: 1.17.0
  - files_external: 1.13.1
  - files_markdown: 2.3.5
  - files_pdfviewer: 2.3.1
  - files_sharing: 1.14.0
  - files_texteditor: 2.14.0
  - files_trashbin: 1.12.0
  - files_versions: 1.15.0
  - files_videoplayer: 1.11.0
  - forms: 2.4.0
  - groupfolders: 10.0.2
  - impersonate: 1.9.0
  - lookup_server_connector: 1.10.0
  - notes: 4.3.0
  - notifications: 2.10.1
  - oauth2: 1.10.0
  - onlyoffice: 7.3.0
  - photos: 1.4.0
  - polls: 3.5.4
  - privacy: 1.6.0
  - provisioning_api: 1.12.0
  - quicknotes: 0.7.3
  - recommendations: 1.1.0
  - serverinfo: 1.12.0
  - settings: 1.4.0
  - sharebymail: 1.12.0
  - spreed: 12.2.3
  - systemtags: 1.12.0
  - tasks: 0.14.2
  - theming: 1.13.0
  - twofactor_admin: 3.2.0
  - twofactor_backupcodes: 1.11.0
  - twofactor_totp: 6.2.0
  - twofactor_u2f: 6.3.0
  - twofactor_webauthn: 0.2.15
  - updatenotification: 1.12.0
  - user_ldap: 1.12.2
  - viewer: 1.6.0
  - workflowengine: 2.4.0
Disabled:
  - contactsinteraction: 1.0.0
  - dashboard: 7.0.0
  - encryption
  - external: 3.5.0
  - files_rightclick: 0.15.1
  - firstrunwizard: 2.2.1
  - logreader: 2.4.0
  - nextcloud_announcements: 1.5.0
  - password_policy: 1.10.1
  - support: 1.0.0
  - survey_client: 1.1.0
  - text: 1.0.2
  - user_status: 1.0.1
  - weather_status: 1.0.0

Nextcloud Signing status

No response

Nextcloud Logs

{
  "reqId": "oitfYjB8TiDzhhYaJeiC",
  "level": 3,
  "time": "2022-06-06T11:06:49+00:00",
  "remoteAddr": "10.90.122.153",
  "user": "--",
  "app": "PHP",
  "method": "GET",
  "url": "/s/CWQYaeQi4qE2FZm/download?path=%2F&files=00073.MTS&downloadStartSecret=2g1w9md4crg",
  "message": "fread(): Length parameter must be greater than 0 at /www/nextcloud/lib/private/Files/View.php#467",
  "userAgent": "Wget/1.21.3",
  "version": "22.2.5.1",
  "exception": {
    "Exception": "Error",
    "Message": "fread(): Length parameter must be greater than 0 at /www/nextcloud/lib/private/Files/View.php#467",
    "Code": 0,
    "Trace": [
      {
        "function": "onError",
        "class": "OC\\Log\\ErrorHandler",
        "type": "::",
        "args": [
          2,
          "fread(): Length parameter must be greater than 0",
          "/www/nextcloud/lib/private/Files/View.php",
          467,
          {
            "path": "/central/Hledani/2015/Uvod do robota_Martin_Kirschner_2015/00073.MTS",
            "from": "1079645896",
            "to": 2124546047,
            "handle": null,
            "startReading": true,
            "0": "And 3 more entries, set log level to debug to see all entries"
          }
        ]
      },
      {
        "file": "/www/nextcloud/lib/private/Files/View.php",
        "line": 467,
        "function": "fread",
        "args": [
          null,
          0
        ]
      },
      {
        "file": "/www/nextcloud/lib/private/legacy/OC_Files.php",
        "line": 328,
        "function": "readfilePart",
        "class": "OC\\Files\\View",
        "type": "->",
        "args": [
          "/central/Hledani/2015/Uvod do robota_Martin_Kirschner_2015/00073.MTS",
          "1079645896",
          2124546047
        ]
      },
      {
        "file": "/www/nextcloud/lib/private/legacy/OC_Files.php",
        "line": 123,
        "function": "getSingleFile",
        "class": "OC_Files",
        "type": "::",
        "args": [
          {
            "__class__": "OC\\Files\\View"
          },
          "/central/Hledani/2015/Uvod do robota_Martin_Kirschner_2015",
          "00073.MTS",
          {
            "head": false,
            "range": "bytes=1079645896-"
          }
        ]
      },
      {
        "file": "/www/nextcloud/apps/files_sharing/lib/Controller/ShareController.php",
        "line": 684,
        "function": "get",
        "class": "OC_Files",
        "type": "::",
        "args": [
          "/central/Hledani/2015/Uvod do robota_Martin_Kirschner_2015",
          "00073.MTS",
          {
            "head": false,
            "range": "bytes=1079645896-"
          }
        ]
      },
      {
        "file": "/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 217,
        "function": "downloadShare",
        "class": "OCA\\Files_Sharing\\Controller\\ShareController",
        "type": "->",
        "args": [
          "CWQYaeQi4qE2FZm",
          "00073.MTS",
          "/",
          "2g1w9md4crg"
        ]
      },
      {
        "file": "/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 126,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          {
            "__class__": "OCA\\Files_Sharing\\Controller\\ShareController"
          },
          "downloadShare"
        ]
      },
      {
        "file": "/www/nextcloud/lib/private/AppFramework/App.php",
        "line": 156,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          {
            "__class__": "OCA\\Files_Sharing\\Controller\\ShareController"
          },
          "downloadShare"
        ]
      },
      {
        "file": "/www/nextcloud/lib/private/Route/Router.php",
        "line": 302,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::",
        "args": [
          "OCA\\Files_Sharing\\Controller\\ShareController",
          "downloadShare",
          {
            "__class__": "OC\\AppFramework\\DependencyInjection\\DIContainer"
          },
          {
            "filename": "",
            "token": "CWQYaeQi4qE2FZm",
            "_route": "files_sharing.Share.downloadShare"
          }
        ]
      },
      {
        "file": "/www/nextcloud/lib/base.php",
        "line": 1006,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->",
        "args": [
          "/s/CWQYaeQi4qE2FZm/download"
        ]
      },
      {
        "file": "/www/nextcloud/index.php",
        "line": 36,
        "function": "handleRequest",
        "class": "OC",
        "type": "::",
        "args": []
      }
    ],
    "File": "/www/nextcloud/lib/private/Log/ErrorHandler.php",
    "Line": 92,
    "CustomMessage": "--"
  }
}

Additional info

To me it seems:

  1. The first part of the file (range 0 - 1079645895 bytes) is server correctly from the Swift storage
  2. The the remaining part (range 1079645896 - ) evokes readfilePart() in lib/private/legacy/OC_Files.php and tries to locate the file on local disk instead in the object store
  3. Which probably causes the null file descriptor and negative length

Side note - i keep NC to 22.2.5 as this is still generaly working version, any future version have broken php-opencloud (see nextcloud/3rdparty#710)

@vpecinka vpecinka added bug 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Jun 6, 2022
@szaimen
Copy link
Contributor

szaimen commented Nov 26, 2022

Hi, please update to at least 23.0.12 and report back if it fixes the issue. Thank you!

@vpecinka
Copy link
Contributor Author

vpecinka commented Nov 28, 2022

I have 23.0.10, tried it and it seems working perfectly! Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap bug feature: object storage needs info
Projects
None yet
Development

No branches or pull requests

3 participants