nextcloudpi icon indicating copy to clipboard operation
nextcloudpi copied to clipboard

fixing the 2GB upload size limit

Open ObfuscateTheWeb opened this issue 9 years ago • 32 comments

duckduckgoing around, the first result that comes up is nextcloudpi, doesn't show anything else I'm sure there's something out on the internet that is similar to nextcloudpi but is 64-bit?

If there exist such thing, it means I could use that and get unlimited upload sizes to nextcloud without the 32-bit php and 32-bit raspbian limiting me

@nachoparker I'm pretty sure you know of such thing?

ObfuscateTheWeb avatar Aug 25 '17 09:08 ObfuscateTheWeb

Well, don't panic!

Even for 32bit systems, there's a workaround to the PHP limitation.

It is scheduled to land in NC13, but if you can patch it yourself today

https://github.com/nextcloud/server/issues/1707#issuecomment-291835214

Also, you can use NFS, SSH or SAMBA to upload the big files. See the related posts in own your bits.

https://ownyourbits.com/2017/04/18/different-ways-to-access-your-nextcloud-files/ https://ownyourbits.com/2017/04/16/share-your-files-in-your-lan-with-samba/ https://ownyourbits.com/2017/04/13/share-your-files-in-your-lan-with-nfs/

In any case, NCP will probably end up being ported to 64bit, but it's a bit lower priority

nachoparker avatar Aug 25 '17 19:08 nachoparker

Do I just edit according to that thread? I followed the edit and rebooted but it still doesn't work?

Am I suppose to recompile it or something? Is it as simple as edit,save, and reboot? Cause it isn't working for me :(

EDIT: Some basic sanity checks: Am I editing the correct sapi.php file? I edited this one >> /var/www/nextcloud/3rdparty/sabre/http/lib/Sapi.php is this the correct file?

ObfuscateTheWeb avatar Aug 26 '17 08:08 ObfuscateTheWeb

No, no need to recompile, it should be instantaneous

That's the file. I don't remember if you have to make other server config changes.

nachoparker avatar Aug 28 '17 18:08 nachoparker

Is the edit suppose to fix the upload/download sizes ?

EDIT: I keep getting request error when uploading a file > 2 GB Some logs:

webdav

The edit made according to that thread (comment out stream_copy_to_stream and add the while clause) code

ObfuscateTheWeb avatar Aug 29 '17 02:08 ObfuscateTheWeb

Hi,

Thanks for the help on this.

The problem is only with uploads I think.

that looks about right

Maybe there's some server configuration that you want to review, but I think everything is correct so it surprises me that still doesn't work for you. I assume you have rebooted, just in case?

I was waiting for NC13, because applying the patch as part of the build process is possible but messy, and there's more guarantee that it's going to work after upstream has released it, but if there's people interested in making it work it would be nice, to be ready for when it lands, or maybe implement it as a nextcloudpi-config extra.

I'll paste here some resources. Maybe somebody else can help review this. I need to address some bugs that came with Stretch first

https://devsidestory.com/build-a-64-bit-kernel-for-your-raspberry-pi-3/ https://github.com/fruux/sabre-http/pull/74 https://github.com/nextcloud/server/issues/1707#issuecomment-291835214 https://forum.owncloud.org/viewtopic.php?f=17&t=32517 https://github.com/owncloud/core/issues/9832#issuecomment-148380791 https://docs.nextcloud.com/server/11/admin_manual/configuration_files/big_file_upload_configuration.html

nachoparker avatar Aug 29 '17 07:08 nachoparker

Yes I rebooted, and I guess I'll just have to wait for NC 13 to patch this

ObfuscateTheWeb avatar Aug 29 '17 07:08 ObfuscateTheWeb

Ok, I'll leave the help wanted tag if anybody want to try this. In that case we can reopen

nachoparker avatar Aug 30 '17 07:08 nachoparker

In case anyone else finds this looking for a workaround, installing the Nextcloud 13 beta (beta 3 was published a few days ago) resolves the upload issues. I was able to upload 8-9GB files using the web UI with that beta installed.

gboudreau avatar Dec 25 '17 04:12 gboudreau

@gboudreau awesome, thanks for letting us know

nachoparker avatar Dec 25 '17 10:12 nachoparker

Sorry to reopen this: I have RPI3 running NC13.0.1 with a variation of the problem:

When I upload a 5.0GB MOV file through the web interface while normally logged in everything seems to go smooth(ish).* I used microsoft FC /B (binary file compare) command to check the original and uploaded-and-synced-back-to-client versions were identical bit-to-bit.

However: when I create a share link for a folder for someone to upload their files to, say for a friend with GoPro footage of my snowboard crashes, then the file gets uploaded "successfully", but truncated at 2.0GB. Example: Movies/Crashes/Myfriend Create share link for Myfriend folder (no password, expire date >2 weeks away, both upload&edit capabilities) If I upload from logged in account to that folder (so not using the share link), no problem; me, the browser, the server: all happy. If either me or my friend uploads a >2GB file through the shared link: 2.0 GB truncated file. No error, nothing. Just a 2.0 GB files synced back to my desktop through the client.

My guess: the share-link page uses different code than the normal web UI and does not have the updated code in it that handles >2GB files correctly?

*Sometimes it keeps saying "a few seconds" for a looooong time when uploading is done (no data upload according to Windows Task Manager). Then after a while desktop client starts syncing the file while the web environment still says "a few seconds". When pressing F5, file appears in the list without errors, but otherwise "a few seconds" won't disappear. This problem does not occur when the files are truncated, then the upload bar disappears when both are uploaded and truncated.

woutergrimme avatar Apr 02 '18 16:04 woutergrimme

My guess: the share-link page uses different code than the normal web UI and does not have the updated code in it that handles >2GB files correctly?

Your guess sounds correct to me. Better report this in the main NC repo, or in the forums

Thanks for the feedback

nachoparker avatar Apr 02 '18 18:04 nachoparker

No problem, I have created the thread also in the main Nextcloud repo, #9053.

At first I thought my friend was completely retarded; I could upload big files and he couldn't. Guess I owe him a beer now ;)

woutergrimme avatar Apr 03 '18 09:04 woutergrimme

lol I guess you are right xD

keep us posted

nachoparker avatar Apr 03 '18 09:04 nachoparker

shouldn't this be reopened?

Serkan-devel avatar Apr 03 '18 14:04 Serkan-devel

mmm, if anything I would create a new issue, and close it as a external bug, so let's just leave the issue you created linked here for people investigating this in the wrong place

I am also now tracking the issue

nachoparker avatar Apr 03 '18 14:04 nachoparker

This was fixed with the update to NC13

See https://ownyourbits.com/2018/02/06/nextcloudpi-updated-to-nc13-brings-ufw-security-improvements-auto-snapshots-and-more/

nachoparker avatar Aug 17 '18 01:08 nachoparker

I found that this fix - with 32bits OS like raspbian - unfortunatly breaks video streaming playback on Apple iOS Safari or Nextcloud iOS App (>v2.22) , as the 32bit workaround ignores the Content-Length header, which is not supported in iOS. So I prefer to stick with the 2GB limit and be able to playback videos on my iOS device.

rmufr avatar Sep 25 '18 19:09 rmufr

The problem is tmpfs size for PHP-FPM. Since user is anonymus over shared link, temporary upload file isn't written to Nextcloud user directory (over PHP session), but is written to system tmpfs (/tmp) instead, which is 2Gb by default, thus upload file over shared link is being truncated:

[root@nextcloud ~]# df -h|grep tmp tmpfs 2.0G 0 2.0G 0% /dev/shm

Our soution is to change PHP-FPM tmpdir settings:

[root@nextcloud ~]# cat /etc/php-fpm.d/custom.conf [www] env[TMP] = /Nextcloud_Data/upload_tmp_dir env[TMPDIR] = /Nextcloud_Data/upload_tmp_dir env[TEMP] = /Nextcloud_Data/upload_tmp_dir

[root@nextcloud ~]# systemctl restart php-fpm

Another possible solution would be tmpfs resize, but actually this is not a good idea, since tmpfs is really RAM allocation/consumption.

https://wiki.archlinux.org/index.php/Tmpfs

stfast avatar Jun 17 '19 22:06 stfast

Fixed by docker-library/php#901 Tested in Docker image nextcloud:17-apache (nextcloud@sha256:58836d449406b396c1c119c2661577fd7d8284ff41a7d181a0e2be232d2757fc, 2019-10-24T05:04:49.946856094Z)

delfer avatar Oct 24 '19 15:10 delfer

I tried to upload a video file >5GB via Desktop client to my cloud, but it seems not to work. It says it has uploaded the file, but only 1,3GB got uploaded. I have the Pi4 model on NextCloudPi 19.0.2 and I have set the maximum file size to 1000GBs. Do I need additional apps like Flow Upload to upload files bigger then 2GBs? Or am I doing something wrong? Thanks for your help!

CajonCP4 avatar Nov 28 '20 15:11 CajonCP4