Can't upload large files v28

Cannot upload files larger than 2GB even though I have modified the php.ini file upload max post_max and execution time.

Rocky linux 8.8 on a vm -

Here is my error log: two lines in the logs Webdav error and no app in context

{“reqId”:“ZdlEIv1da6@dUHQTPIW-tgAAAFc”,“level”:3,“time”:“2024-02-24T01:20:31+00:00”,“remoteAddr”:“24.141.167.165”,“user”:“root”,“app”:“no app in context”,“method”:“MOVE”,“url”:“/remote.php/dav/uploads/root/web-file-upload-146cdf4f9cdc0100/.file”,“message”:“Could not open file”,“userAgent”:“Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36”,“version”:“28.0.2.5”,“exception”:{“Exception”:“Sabre\DAV\Exception\ServiceUnavailable”,“Message”:“Could not open file”,“Code”:0,“Trace”:[{“file”:“/var/www/html/nextcloud/apps/dav/lib/Upload/AssemblyStream.php”,“line”:294,“function”:“get”,“class”:“OCA\DAV\Connector\Sabre\File”,“type”:“->”},{“file”:“/var/www/html/nextcloud/apps/dav/lib/Upload/AssemblyStream.php”,“line”:164,“function”:“getStream”,“class”:“OCA\DAV\Upload\AssemblyStream”,“type”:“->”},{“function”:“stream_read”,“class”:“OCA\DAV\Upload\AssemblyStream”,“type”:“->”},{“file”:“/var/www/html/nextcloud/3rdparty/icewind/streams/src/Wrapper.php”,“line”:55,“function”:“fread”},{“file”:“/var/www/html/nextcloud/3rdparty/icewind/streams/src/CallbackWrapper.php”,“line”:96,“function”:“stream_read”,“class”:“Icewind\Streams\Wrapper”,“type”:“->”},{“function”:“stream_read”,“class”:“Icewind\Streams\CallbackWrapper”,“type”:“->”},{“file”:“/var/www/html/nextcloud/lib/private/Files/Storage/Local.php”,“line”:335,“function”:“file_put_contents”},{“file”:“/var/www/html/nextcloud/lib/private/Files/Storage/Local.php”,“line”:643,“function”:“file_put_contents”,“class”:“OC\Files\Storage\Local”,“type”:“->”},{“file”:“/var/www/html/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php”,“line”:644,“function”:“writeStream”,“class”:“OC\Files\Storage\Local”,“type”:“->”},{“file”:“/var/www/html/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php”,“line”:644,“function”:“writeStream”,“class”:“OC\Files\Storage\Wrapper\Wrapper”,“type”:“->”},{“file”:“/var/www/html/nextcloud/apps/dav/lib/Connector/Sabre/File.php”,“line”:250,“function”:“writeStream”,“class”:“OC\Files\Storage\Wrapper\Wrapper”,“type”:“->”},{“file”:“/var/www/html/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php”,“line”:148,“function”:“put”,“class”:“OCA\DAV\Connector\Sabre\File”,“type”:“->”},{“file”:“/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php”,“line”:313,“function”:“createFile”,“class”:“OCA\DAV\Connector\Sabre\Directory”,“type”:“->”,“args”:[“*** sensitive parameters replaced ***”]},{“file”:“/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php”,“line”:139,“function”:“copyNode”,“class”:“Sabre\DAV\Tree”,“type”:“->”},{“file”:“/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php”,“line”:169,“function”:“copy”,“class”:“Sabre\DAV\Tree”,“type”:“->”},{“file”:“/var/www/html/nextcloud/apps/dav/lib/Upload/ChunkingPlugin.php”,“line”:94,“function”:“move”,“class”:“Sabre\DAV\Tree”,“type”:“->”},{“file”:“/var/www/html/nextcloud/apps/dav/lib/Upload/ChunkingPlugin.php”,“line”:76,“function”:“performMove”,“class”:“OCA\DAV\Upload\ChunkingPlugin”,“type”:“->”},{“file”:“/var/www/html/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php”,“line”:89,“function”:“beforeMove”,“class”:“OCA\DAV\Upload\ChunkingPlugin”,“type”:“->”},{“file”:“/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php”,“line”:603,“function”:“emit”,“class”:“Sabre\DAV\Server”,“type”:“->”},{“file”:“/var/www/html/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php”,“line”:89,“function”:“httpMove”,“class”:“Sabre\DAV\CorePlugin”,“type”:“->”},{“file”:“/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php”,“line”:472,“function”:“emit”,“class”:“Sabre\DAV\Server”,“type”:“->”},{“file”:“/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php”,“line”:253,“function”:“invokeMethod”,“class”:“Sabre\DAV\Server”,“type”:“->”},{“file”:“/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php”,“line”:321,“function”:“start”,“class”:“Sabre\DAV\Server”,“type”:“->”},{“file”:“/var/www/html/nextcloud/apps/dav/lib/Server.php”,“line”:370,“function”:“exec”,“class”:“Sabre\DAV\Server”,“type”:“->”},{“file”:“/var/www/html/nextcloud/apps/dav/appinfo/v2/remote.php”,“line”:35,“function”:“exec”,“class”:“OCA\DAV\Server”,“type”:“->”},{“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/dav/lib/Connector/Sabre/File.php”,“Line”:505,“message”:“Could not open file”,“exception”:,“CustomMessage”:“Could not open file”},“id”:“65d953329d634”}

AND NOTE THE UNDEFINED HERE - ONLY HAPPENS IF FILE IS GREATER THAN 2GB

1. /var/www/html/nextcloud/remote.phpline 172

undefinedundefinedrequire_once
(
  "/var/www/html/nextcloud/apps/dav/appinfo/v2/remote.php"
)

File transfer is simply broken. It doesn’t work properly. Even when it “works” it’s tragically slow. (like 1.3MiB/s)

@spyro Please don’t hijack other people’s threads with off-topic statements just to express your frustration.

By the way, the slow file transfer is not a general issue, but rather a specific problem with your instance, as I have already shown you here: Photo viewing cripples server - #6 by bb77

@Dom_Jag Depending on the web server and PHP process manager you are using, further settings and tweaks may be necessary… Uploading big files > 512MB — Nextcloud latest Administration Manual latest documentation

If that doesn’t help, please post more details about your setup.

1 Like

Can you please:

  • post the raw log entry (easiest way to do this is from Admin settings->Logging and selecting “Copy raw”? Also when you post it, please wrap it in the preformatted text option in the editor. Unless you do both of the above, it’s possible to take the trace out and reformat/process it properly for analysis.
  • share a bit more about your setup (e.g. occ config:list system and installation method for starters)

@bb77 I disagree with you fundamentally.

I’ve given them an honest answer - it does not, out of the box, on two different machines of two different architectures, ACTUALLY WORK as EXPECTED.

Even after following the extra setup guides on opcache and redis.

My machines aren’t special, and if the default install cannot get >1.3MiB/s, on hardware from THIS CENTURY, then it is BROKEN and there is nothing else to say on the matter.

On the subject of uploading large files - the page you linked to might have some useful information, but is also FLAT OUT WRONG about the following, where it recommends you set:

php_value upload_max_filesize 16G
php_value post_max_size 16G

Which is completely insane and clearly un-necessary, since my boxes have this set to 1GiB currently (as a result of following guides on here that told me to), and is completely fine with a >4GiB file.

In fact, I’ve just set both those to a “mere” 128MiB, and it’s happily uploading a 5000MiB file… (yes, I restarted php-fpm)

Thats * ONE HUNDRED AND TWENTY-EIGHT MEGABYTES * so IOW, you can send ~1/64th of this machines ENTIRE RAM in a SINGLE REQUEST.

…Time passes…

…well, its over 768MB… so clearly well past the “128MB limit” that obviously had no bearing on it…

…925, approaching a gig. Slow, still, but getting there…

…over 1GiB… 35 mins remaining…

…aaaand now well over 2GiB and continuing to sync just fine.

…4GiB…

…4.9GiB - completed.

Now, I get the utility in writing "Can your OS / server OS actually handle >4GiB on its filesystem, but the advice you gave was:

  • Incompletely specified
  • Incorrect in at least one regard
  • Not terribly helpful.

And you mentioned no “next steps” to them either.

This is exactly what I meant when I said that the help here is just “throw it at the problem and see if it sticks”.

Whilst giving @Dom_Jag the link to the information on that page might help them find a solution, its also throwing a TON of bllsht red herrings their way.

Who the hell needs a 16GiB HTTP POST?! why, for the love of christ?

If it is required in some weird usecase, at least explain when it is, rather than blanket telling people to set crazy limits.

Later (today or maybe this week) I’m going to spin up a couple of NC instances on my devbox, which is a 32 CPU monster @ 4.5GHz with 64GiB RAM - I’ll save 4 for the host, and allocate 30GiB to each NC instance.

They will get a default debian install, followed ONLY by the bare minimum needed to install the base NC28 to it.

I’ll benchmark them then, and we shall see.

(I expect to see nothing interesting, since this is exactly what my two low-end boxes had done to them).

Some more details : VM is on proxmox (not a container but a VM) 4GB ram, 2CPU and a 210GB drive. Rocky Linux 8.8

The php.ini is set to 16GB which seems super high but doesnt seem to fix the issue. I’ve also made recommended adjustments to OPCache based on the Overview recommendations in Nextcloud. Tried a 1.8GB file it was good. Tried a 3.9GB zip file and it was a no go - it just finishes and does not show up - error log as stated in the original post. Anyway to downgrade to v27 from 28? I can try that if possible.

Here is the raw log for the error

{"reqId":"Zdnq9WvTKy8@De49HNH4aQAAAEc","level":3,"time":"2024-02-24T13:11:19+00:00","remoteAddr":"24.150.28.201","user":"bradm","app":"no app in context","method":"PUT","url":"/remote.php/dav/uploads/bradm/web-file-upload-b31ff0b126bd2f13/375","message":"Expected filesize of 10485760 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 5357568 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36","version":"28.0.2.5","exception":{"Exception":"Sabre\\DAV\\Exception\\BadRequest","Message":"Expected filesize of 10485760 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 5357568 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.","Code":0,"Trace":[{"file":"/var/www/html/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php","line":148,"function":"put","class":"OCA\\DAV\\Connector\\Sabre\\File","type":"->"},{"file":"/var/www/html/nextcloud/apps/dav/lib/Upload/UploadFolder.php","line":51,"function":"createFile","class":"OCA\\DAV\\Connector\\Sabre\\Directory","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":1098,"function":"createFile","class":"OCA\\DAV\\Upload\\UploadFolder","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":504,"function":"createFile","class":"Sabre\\DAV\\Server","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"httpPut","class":"Sabre\\DAV\\CorePlugin","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":472,"function":"emit","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":253,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":321,"function":"start","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/html/nextcloud/apps/dav/lib/Server.php","line":370,"function":"exec","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/html/nextcloud/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->"},{"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/dav/lib/Connector/Sabre/File.php","Line":301,"message":"Expected filesize of 10485760 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 5357568 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.","exception":[],"CustomMessage":"Expected filesize of 10485760 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 5357568 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.**"},"id":"65da4808cce71"}

@Dom_Jag

  • Can you share your Nextcloud config, as previously requested?
  • What web server? What reverse proxy?
  • To clarify, are you saying this same environment supported these uploads fine with v27 or were you just interested in testing it with v27 too?

Operating System: Linux 4.18.0-513.11.1.el8_9.x86_64 x86_64

CPU: Common KVM processor (2 cores)

Memory: 3.57 GB

Running on apache 2.4 no reverse proxy

27 vs 28 No I did not try to upload large files on 27 so I do not know - I do know that some of my apps no longer work Office and BPM files cannot be displayed in 28 so I was wondering if maybe I should go back to 27

PHP

Version: 8.2.16

Memory limit: 2 GB

Max execution time: 29000

Upload max size: 16 GB

OPcache Revalidate Frequency: 60

Extensions: Core, date, libxml, openssl, pcre, zlib, filter, hash, json, random, Reflection, SPL, session, standard, cgi-fcgi, bcmath, bz2, calendar, ctype, curl, dom, mbstring, fileinfo, ftp, gd, gettext, iconv, ldap, exif, mysqlnd, PDO, Phar, posix, shmop, SimpleXML, sockets, sodium, sqlite3, sysvmsg, sysvsem, sysvshm, tokenizer, xml, xmlwriter, xsl, mcrypt, mysqli, pdo_mysql, pdo_sqlite, xmlreader, zip, apcu, Zend OPcache

Database

Type: mysql

Version: 10.3.39

Size: 15.1 MB

In the documentation it reads:

Apache

  • LimitRequestBody (In Apache HTTP Server <=2.4.53 this defaulted to unlimited, but now defaults to 1 GiB. The new default limits uploads from non-chunking clients to 1 GiB. If this is a concern in your environment, override the new default by either manually setting it to 0 or to a value similar to that used for your local environment’s PHP upload_max_filesize / post_max_size / memory_limit parameters.)

So where do I modify LimitRequestBody in the php.ini? nextcloud.conf?

I added the LimitRequestBody=0 to the nextcloud.conf and modified the opcache to occ config:app:set files max_chunk_size --value 52428800

No affect it still errors out. Really don’t know what to do at this point

ALSO: FOund this on the Sabre site:

PHP bugs

We recently found out that PHP’s fpassthru() method is broken for large files, and does not allow files to be served over 2GB.

A fix has been made for SabreDAV 1.7.11 and 1.8.9. So make sure you are running at least one of those two versions.

https://sabre.io/dav/large-files/

in /etc/php

nextclouf.conf does not contain php.ini

At least I tried to give some advice instead of just saying: it’s broken, doesn’t work, which simply isn’t true.

Yes, NC 28 still has many issues, but both on my 27 production instance and on a 28 test instance, uploads are neither as slow as yours, nor do I have problems uploading files larger than 2GB. These two specific issues are not general Nextcloud issues, neither in 27 nor in 28.