nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
26.96k stars 4.02k forks source link

[Bug]: Failed to copy stream to external storage NC28.0.10 #48231

Open strangmann opened 3 weeks ago

strangmann commented 3 weeks ago

⚠️ This issue respects the following points: ⚠️

Bug description

Files larger then 4 GB cannot be successful copied from local to external Storage

Steps to reproduce

  1. Configure external SFTP-/Webdav-/FTP-Share
  2. Copy larger file than 4 GB from local Nextcloud-Storage to new external-Storage

Expected behavior

The file was transferred correctly to the external storage.

Nextcloud Server version

28

Operating system

RHEL/CentOS

PHP engine version

PHP 8.2

Web server

Nginx

Database engine version

MariaDB

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

Fresh Nextcloud Server install

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?

Configuration report

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "28.0.10.1",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "enable_previews": true,
        "installed": true,
        "forcessl": true,
        "filesystem_check_changes": 1,
        "memcache.local": "\\OC\\Memcache\\APCu",
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "filelocking.enabled": "true",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 6385,
            "timeout": 0,
            "password": "***REMOVED SENSITIVE VALUE***",
            "dbindex": 0
        },
        "remember_login_cookie_lifetime": 259200,
        "session_lifetime": 7200,
        "session_keepalive": true,
        "log_type": "syslog",
        "logfile": "",
        "loglevel": 2,
        "logtimezone": "Europe\/Berlin",
        "lost_password_link": "https:\/\/pw.example.com\/",
        "allow_user_to_change_display_name": false,
        "trashbin_retention_obligation": "30, 183",
        "versions_retention_obligation": "30, 366",
        "blacklisted_files": [
            ".htaccess"
        ],
        "maintenance": false,
        "singleuser": false,
        "appstoreenabled": false,
        "supportedDatabases": [
            "mysql",
            "pgsql",
            "oci"
        ],
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
          cloud.example.com
        ],
        "secret": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "smtp",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": 587,
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauthtype": "LOGIN",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpsecure": "tls",
        "mail_smtpauth": 1,
        "mail_sendmailmode": "smtp",
        "activity_expire_days": 90,
        "skeletondirectory": "",
        "ldapProviderFactory": "\\OCA\\User_LDAP\\LDAPProviderFactory",
        "updater.release.channel": "stable",
        "mysql.utf8mb4": true,
        "auth.webauthn.enabled": false,
        "defaultapp": "files",
        "default_phone_region": "DE",
        "hashingThreads": 1,
        "hashingCost": 3,
        "templatedirectory": "\/var\/www\/data\/templates",
        "overwrite.cli.url": "https:\/\/cloud.example.com",
        "upgrade.disable-web": true,
        "maintenance_window_start": 2
    }
}

List of activated Apps

Enabled:
  - activity: 2.20.0
  - admin_audit: 1.18.0
  - bookmarks: 14.2.5
  - bruteforcesettings: 2.8.0
  - calendar: 4.7.16
  - circles: 28.0.0
  - cloud_federation_api: 1.11.0
  - comments: 1.18.0
  - contacts: 5.5.3
  - contactsinteraction: 1.9.0
  - dashboard: 7.8.0
  - dav: 1.29.2
  - deck: 1.12.4
  - federatedfilesharing: 1.18.0
  - federation: 1.18.0
  - files: 2.0.0
  - files_antivirus: 5.5.7
  - files_external: 1.20.0
  - files_mindmap: 0.0.30
  - files_pdfviewer: 2.9.0
  - files_reminders: 1.1.0
  - files_sharing: 1.20.0
  - files_trashbin: 1.18.0
  - files_versions: 1.21.0
  - firstrunwizard: 2.17.0
  - forms: 4.2.4
  - integration_ews: 1.0.37
  - integration_openproject: 2.7.0
  - keeweb: 0.6.19
  - logreader: 2.13.0
  - lookup_server_connector: 1.16.0
  - nextcloud_announcements: 1.17.0
  - notifications: 2.16.0
  - notify_push: 0.7.0
  - oauth2: 1.16.4
  - onlyoffice: 9.3.0
  - password_policy: 1.18.0
  - photos: 2.4.0
  - privacy: 1.12.0
  - provisioning_api: 1.18.0
  - recommendations: 2.0.0
  - related_resources: 1.3.0
  - serverinfo: 1.18.0
  - settings: 1.10.1
  - sharebymail: 1.18.0
  - spreed: 18.0.11
  - support: 1.11.1
  - survey_client: 1.16.0
  - systemtags: 1.18.0
  - text: 3.9.2
  - theming: 2.3.0
  - theming_customcss: 1.17.0
  - twofactor_backupcodes: 1.17.0
  - updatenotification: 1.18.0
  - user_ldap: 1.19.0
  - user_status: 1.8.1
  - viewer: 2.2.0
  - weather_status: 1.8.0
  - workflow_script: 1.13.1
  - workflowengine: 2.10.0
Disabled:
  - drawio: 3.0.3 (installed 0.9.8)
  - encryption: 2.16.0
  - suspicious_login: 6.0.0
  - twofactor_totp: 10.0.0-beta.2
  - user_saml: 6.2.0 (installed 2.3.1)

Nextcloud Signing status

No response

Nextcloud Logs

Sep 20 07:07:19 ncserver Nextcloud[1285]: {"reqId":"hSO9GA7emV40hdYtMn7w","level":2,"time":"2024-09-20T07:07:19+02:00","remoteAddr":"1.2.3.4","user":"user1","app":"no app in context","method":"COPY","url":"/remote.php/dav/files/user1/private/File1.tar.zst","message":"{\"Exception\":\"Exception\",\"Message\":\"Failed to write steam to sftp storage\",\"Code\":0,\"Trace\":[{\"file\":\"/var/www/html/nextcloud/lib/private/Files/Storage/Common.php\",\"line\":636,\"function\":\"writeStream\",\"class\":\"OCA\\\\Files_External\\\\Lib\\\\Storage\\\\SFTP\",\"type\":\"->\",\"args\":[\"Archiv/File1.tar.zst\",null]},{\"file\":\"/var/www/html/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php\",\"line\":587,\"function\":\"copyFromStorage\",\"class\":\"OC\\\\Files\\\\Storage\\\\Common\",\"type\":\"->\",\"args\":[[\"OCA\\\\Files_Trashbin\\\\Storage\",null,[\"OC\\\\Files\\\\Cache\\\\Scanner\"],null,null,null],\"files/private/File1.tar.zst\",\"Archiv/File1.tar.zst\"]},{\"file\":\"/var/www/html/nextcloud/lib/private/Files/Storage/Wrapper/KnownMtime.php\",\"line\":120,\"function\":\"copyFromStorage\",\"class\":\"OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper\",\"type\":\"->\",\"args\":[[\"OCA\\\\Files_Trashbin\\\\Storage\",null,[\"OC\\\\Files\\\\Cache\\\\Scanner\"],null,null,null],\"files/private/File1.tar.zst\",\"Archiv/File1.tar.zst\"]},{\"file\":\"/var/www/html/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php\",\"line\":587,\"function\":\"copyFromStorage\",\"class\":\"OC\\\\Files\\\\Storage\\\\Wrapper\\\\KnownMtime\",\"type\":\"->\",\"args\":[[\"OCA\\\\Files_Trashbin\\\\Storage\",null,[\"OC\\\\Files\\\\Cache\\\\Scanner\"],null,null,null],\"files/private/File1.tar.zst\",\"Archiv/File1.tar.zst\"]},{\"file\":\"/var/www/html/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php\",\"line\":587,\"function\":\"copyFromStorage\",\"class\":\"OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper\",\"type\":\"->\",\"args\":[[\"OCA\\\\Files_Trashbin\\\\Storage\",null,[\"OC\\\\Files\\\\Cache\\\\Scanner\"],null,null,null],\"files/private/File1.tar.zst\",\"Archiv/File1.tar.zst\"]},{\"file\":\"/var/www/html/nextcloud/lib/private/Files/View.php\",\"line\":928,\"function\":\"copyFromStorage\",\"class\":\"OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper\",\"type\":\"->\",\"args\":[[\"OCA\\\\Files_Trashbin\\\\Storage\",null,[\"OC\\\\Files\\\\Cache\\\\Scanner\"],null,null,null],\"files/private/File1.tar.zst\",\"Archiv/File1.tar.zst\"]},{\"file\":\"/var/www/html/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php\",\"line\":486,\"function\":\"copy\",\"class\":\"OC\\\\Files\\\\View\",\"type\":\"->\",\"args\":[\"/private/File1.tar.zst\",\"/SFTP/Archiv/File1.tar.zst\"]},{\"file\":\"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php\",\"line\":150,\"function\":\"copyInto\",\"class\":\"OCA\\\\DAV\\\\Connector\\\\Sabre\\\\Directory\",\"type\":\"->\",\"args\":[\"File1.tar.zst\",\"/private/File1.tar.zst\",[\"OCA\\\\DAV\\\\Connector\\\\Sabre\\\\File\"]]},{\"file\":\"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php\",\"line\":659,\"function\":\"copy\",\"class\":\"Sabre\\\\DAV\\\\Tree\",\"type\":\"->\",\"args\":[\"files/user1/private/File1.tar.zst\",\"files/user1/SFTP/Archiv/File1.tar.zst\"]},{\"file\":\"/var/www/html/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php\",\"line\":89,\"function\":\"httpCopy\",\"class\":\"Sabre\\\\DAV\\\\CorePlugin\",\"type\":\"->\",\"args\":[[\"Sabre\\\\HTTP\\\\Request\"],[\"Sabre\\\\HTTP\\\\Response\"]]},{\"file\":\"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php\",\"line\":472,\"function\":\"emit\",\"class\":\"Sabre\\\\DAV\\\\Server\",\"type\":\"->\",\"args\":[\"method:COPY\",[[\"Sabre\\\\HTTP\\\\Request\"],[\"Sabre\\\\HTTP\\\\Response\"]]]},{\"file\":\"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php\",\"line\":253,\"function\":\"invokeMethod\",\"class\":\"Sabre\\\\DAV\\\\Server\",\"type\":\"->\",\"args\":[[\"Sabre\\\\HTTP\\\\Request\"],[\"Sabre\\\\HTTP\\\\Response\"]]},{\"file\":\"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php\",\"line\":321,\"function\":\"start\",\"class\":\"Sabre\\\\DAV\\\\Server\",\"type\":\"->\",\"args\":[]},{\"file\":\"/var/www/html/nextcloud/apps/dav/lib/Server.php\",\"line\":380,\"function\":\"exec\",\"class\":\"Sabre\\\\DAV\\\\Server\",\"type\":\"->\",\"args\":[]},{\"file\":\"/var/www/html/nextcloud/apps/dav/appinfo/v2/remote.php\",\"line\":35,\"function\":\"exec\",\"class\":\"OCA\\\\DAV\\\\Server\",\"type\":\"->\",\"args\":[]},{\"file\":\"/var/www/html/nextcloud/remote.php\",\"line\":172,\"args\":[\"/var/www/html/nextcloud/apps/dav/appinfo/v2/remote.php\"],\"function\":\"require_once\"}],\"File\":\"/var/www/html/nextcloud/apps/files_external/lib/Lib/Storage/SFTP.php\",\"Line\":520,\"message\":\"Failed to copy stream to storage\",\"exception\":{},\"CustomMessage\":\"Failed to copy stream to storage\"}","userAgent":"Mozilla/5.0 (Android) Nextcloud-android/3.29.2","version":"28.0.10.1"}

Additional info

No response

joshtrichards commented 3 weeks ago

We do support >4 GiB.

What happens if you bypass Nextcloud and use a standard SFTP or FTP client to upload to the same external storage?