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]: NC 28 Cannot upload file larger than 2GB (javascript error) #42704

Closed
6 of 8 tasks
Trevelian opened this issue Jan 11, 2024 · 20 comments · Fixed by nextcloud-libraries/nextcloud-upload#1057
Closed
6 of 8 tasks
Labels
1. to develop Accepted and waiting to be taken care of 28-feedback bug feature: files

Comments

@Trevelian
Copy link

Trevelian commented Jan 11, 2024

⚠️ This issue respects the following points: ⚠️

Bug description

When trying to upload a file larger than 2GB the transfer never start (no bandwidth used) and we go this error on the web browser console :

Uncaught TypeError: Blob constructor: ArrayBuffer branch of ((ArrayBufferView or ArrayBuffer) or Blob or USVString) can't be an ArrayBuffer or an ArrayBufferView larger than 2 GB
index-f812dc31.mjs:1485:19

image

Steps to reproduce

  1. Upload a > 2GB file
  2. Upload never start
  3. Check the browser console logs

Expected behavior

Successfully uploading big files

Installation method

Community Manual installation with Archive

Nextcloud Server version

28

Operating system

RHEL/CentOS

PHP engine version

PHP 8.2

Web server

Apache (supported)

Database engine version

MariaDB

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

Upgraded to a MAJOR version (ex. 22 to 23)

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?

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

Configuration report

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "nexcloud.server.be"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "allow_user_to_change_display_name": false,
        "forcessl": true,
        "version": "28.0.1.1",
        "default_language": "fr",
        "force_language": "fr",
        "default_locale": "fr_BE",
        "force_locale": "fr_BE",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "upgrade.disable-web": true,
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "proxy": "proxy.server.be:9999",
        "overwritewebroot": "\/",
        "overwriteprotocol": "https",
        "overwritehost": "nexcloud.server.be",
        "overwrite.cli.url": "https:\/\/nexcloud.server.be\/",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "profile.enabled": false,
        "trashbin_retention_obligation": "auto, 30",
        "updatechecker": false,
        "appstoreenabled": true,
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "logtimezone": "Europe\/Brussels",
        "logfile": "\/var\/log\/nextcloud\/nextcloud.log",
        "default_phone_region": "BE",
        "installed": true,
        "skeletondirectory": "",
        "log_authfailip": true,
        "forceSSLforSubdomains": true,
        "filesystem_check_changes": 0,
        "ldapIgnoreNamingRules": false,
        "ldapUserCleanupInterval": 51,
        "theme": "",
        "loglevel": 2,
        "maintenance": false,
        "htaccess.RewriteBase": "\/",
        "ldapProviderFactory": "\\OCA\\User_LDAP\\LDAPProviderFactory",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0,
            "dbindex": 0,
            "timeout": 1.5
        },
        "data-fingerprint": "33d0bd49f33c240b0dbc223f0c283dfb",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "smtp",
        "objectstore": {
            "class": "\\OC\\Files\\ObjectStore\\S3",
            "arguments": {
                "bucket": "nextcloud",
                "key": "***REMOVED SENSITIVE VALUE***",
                "secret": "***REMOVED SENSITIVE VALUE***",
                "hostname": "s3.server.be",
                "port": 443,
                "use_ssl": true,
                "region": "us-east-1",
                "legacy_auth": false,
                "autocreate": false,
                "use_path_style": false
            }
        },
        "app_install_overwrite": [
            "passman",
            "files_versions_s3",
            "user_saml"
        ],
        "mysql.utf8mb4": true,
        "simpleSignUpLink.shown": false
    }
}

List of activated Apps

Enabled:
  - activity: 2.20.0
  - bruteforcesettings: 2.8.0
  - cloud_federation_api: 1.11.0
  - comments: 1.18.0
  - contactsinteraction: 1.9.0
  - dav: 1.29.1
  - federatedfilesharing: 1.18.0
  - files: 2.0.0
  - files_external: 1.20.0
  - 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
  - files_versions_s3: 0.2.1
  - firstrunwizard: 2.17.0
  - groupfolders: 16.0.1
  - logreader: 2.13.0
  - lookup_server_connector: 1.16.0
  - notifications: 2.16.0
  - oauth2: 1.16.3
  - passman: 2.4.7
  - provisioning_api: 1.18.0
  - related_resources: 1.3.0
  - settings: 1.10.1
  - systemtags: 1.18.0
  - text: 3.9.1
  - theming: 2.3.0
  - twofactor_backupcodes: 1.17.0
  - user_ldap: 1.19.0
  - user_saml: 6.0.1
  - user_usage_report: 1.12.0
  - viewer: 2.2.0
  - workflowengine: 2.10.0
Disabled:
  - admin_audit: 1.18.0 (installed 1.1.0)
  - circles: 28.0.0-dev (installed 22.1.0)
  - dashboard: 7.8.0 (installed 7.0.0)
  - encryption: 2.16.0
  - federation: 1.18.0 (installed 0.0.4)
  - nextcloud_announcements: 1.17.0 (installed 1.3.0)
  - password_policy: 1.18.0 (installed 1.1.0)
  - photos: 2.4.0 (installed 2.2.0)
  - privacy: 1.12.0 (installed 1.4.0)
  - recommendations: 2.0.0 (installed 0.4.0)
  - serverinfo: 1.18.0 (installed 1.16.0)
  - sharebymail: 1.18.0 (installed 1.0.1)
  - support: 1.11.0 (installed 1.0.0)
  - survey_client: 1.16.0 (installed 0.1.5)
  - suspicious_login: 6.0.0
  - twofactor_totp: 10.0.0-beta.2 (installed 1.4.1)
  - updatenotification: 1.18.0 (installed 0.1.0)
  - user_status: 1.8.1 (installed 1.0.1)
  - weather_status: 1.8.0 (installed 1.0.0)

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

No response

Additional info

No response

@Trevelian Trevelian added 0. Needs triage Pending check for reproducibility or if it fits our roadmap bug labels Jan 11, 2024
@szaimen
Copy link
Contributor

szaimen commented Jan 11, 2024

Cc @nextcloud/server-frontend

@susnux
Copy link
Contributor

susnux commented Jan 11, 2024

We need to upload using streams / file objects rather than loading the file into a buffer. Especially for low memory devices.

@skjnldsv
Copy link
Member

Hmmm, I did some tests a while back to ensure this doesn't happen.
We only load by BLOB when we upload the chunk, with async promises, meaning we actually do not load the entire file in the RAM.

https://github.com/nextcloud-libraries/nextcloud-upload/blob/ec7c2bd1df51fee8c40f9f413088b69be55a4592/lib/uploader.ts#L207
https://github.com/nextcloud-libraries/nextcloud-upload/blob/ec7c2bd1df51fee8c40f9f413088b69be55a4592/lib/utils/upload.ts#L64-L77

@Trevelian can you tell us if you disabled chunk uploading?
What is the result of occ config:app:get files max_chunk_size ?

@AdamVenn
Copy link

AdamVenn commented Jan 11, 2024

I am having the same problem - when chunk uploading is disabled, the whole file is loaded into RAM until the browser cuts it off at the Javascript memory limit. Seeing huge RAM usage when uploading large files with chunking back on (200MB chunks).
I posted on the forum here:
https://help.nextcloud.com/t/high-memory-usage-client-side-when-uploading-large-files-in-browser/178599
Cyberduck uploads working well.

@skjnldsv
Copy link
Member

Well well well, yeah that make sense!
When disabled, we need to go around this 🤔

@AdamVenn
Copy link

I'm setting up an NC 27 to test this, but I think it was working before. We've had chunking off in order to upload large (>30GB) files without risking timeouts on the reassembling for years.

@AdamVenn
Copy link

NC 27, chunks off, 4GiB uploaded. No extraordinary memory usage.

@Trevelian
Copy link
Author

@skjnldsv Yes my NC server before 28 was working far more better with max_chunk_size at "0"
I change it to 200MiB so I can upload big file again

@skjnldsv
Copy link
Member

ALright, thanks everyone for the help, setting this as to fix

@skjnldsv skjnldsv added 1. to develop Accepted and waiting to be taken care of feature: files and removed 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Jan 12, 2024
@AdamVenn
Copy link

Great! Thanks. I'm back on 27 for now, but happy to test out any updates you might have.

@skjnldsv
Copy link
Member

Just tested 27 and RAM is increased by a lot (looks like twice the uploaded file size)

Peek.23-01-2024.17-43.mp4

I do wonder if we shouldn't have a cleaner limit and communicate it to the front end if chunk upload is disabled.

@skjnldsv
Copy link
Member

We've had chunking off in order to upload large (>30GB) files without risking timeouts on the reassembling for years.

@AdamVenn and you never had RAM issues? Tested on older NC version (see above), it would still load the file in the browser memory, so 30GB is crazy to me 🙈

@skjnldsv
Copy link
Member

When trying to upload a file larger than 2GB the transfer never start (no bandwidth used) and we go this error on the web browser console

The fix for the main post is here: #42704

Regarding the RAM usage, it seems it was there all along anyway, so I'd say we'll have to investigate a bit further and see what we can do

@Trevelian
Copy link
Author

@skjnldsv Its strange, when I test uploading a big file on NC27 with max_chunk_size to 0 in my case I dont have any ram usage like NC28 and the upload succed.

Screenshot from 2024-01-23 19-27-30

@skjnldsv
Copy link
Member

@Trevelian Firefox?

@LM-vb
Copy link

LM-vb commented Jan 26, 2024

NC 28.0.1, bug is still present.

Our biggest upload in a single file is 23 GB. So the 30 GB mentioned above are not so unusual. I did some more testing and were able to successfully upload a 20 GB file with a chunk size of 25 GB (several smaller values work too; a reload of php-fpm might be necessary while doing these test). So I guess as long as the chunk size does not equal zero, the uploads work. However, the file still has to be moved from the temporary directory to the data directory, which delays the operation in comaprison to a chunk size of zero.

@skjnldsv skjnldsv added this to the Nextcloud 28.0.2 milestone Jan 26, 2024
@skjnldsv
Copy link
Member

skjnldsv commented Jan 26, 2024

@LM-vb a chunk size of 25GB makes zero sense.
Please see our guide to proper server configuration. Default (10MB) is good enough, I would agree that you might be willing to increase to 20MB or 50MB. But anything above is not fitting

Anyway, this is fixed on 28.0.2

@Trevelian
Copy link
Author

Trevelian commented Feb 5, 2024

I tested with version 28.0.2 and its not fixed. (firefox)
The javascript error is gone, but when I try to upload a 4GB file, I see memory increase, and then drop, and the file are not uploaded.

Switched back chunck to default value of 10MB. (which is probably better)

@ioradu-ro
Copy link

28.0.2.5 still has the bug. Is this still being worked on? Where can we see the progress?

@susnux
Copy link
Contributor

susnux commented Feb 13, 2024

will be fixed in 28.0.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. to develop Accepted and waiting to be taken care of 28-feedback bug feature: files
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants