ios icon indicating copy to clipboard operation
ios copied to clipboard

"Upload the whole camera roll" crashes the app

Open e-caste opened this issue 3 years ago • 10 comments

Steps to reproduce

  1. Go to Settings > Auto upload
  2. Enable "Only use Wi-Fi connection" both for photos and for videos
  3. Enable "Upload the whole camera roll"

Expected behaviour

The app uploads the whole library to Nextcloud (18k+ files in my case).

Actual behaviour

The app creates a local database of the media files to upload, then starts uploading the files until after a few seconds, then the UI suddenly exits to the home screen. Weirdly, Nextcloud is still present in the multitask view.

This happens forever, until I manually turn off the "upload all" toggle. The app typically crashes a few times while trying to reach this setting, which makes the experience worse.

What I've tried:

  • closing and reopening the app
  • unchecking and re-checking "Upload the whole camera roll"
  • uninstalling the app completely and rebooting the phone

Screenshots

If applicable, add a screenshot showing the issue.

Logs

If applicable, you can post the iOS app or server logs (removing any sensitive information).

Reasoning or why should it be changed/implemented?

Because the app does not behave correctly.

Environment data

iOS version: iOS 15.1

Nextcloud iOS app version: Nextcloud Liquid for iOS 4.1.0.17

Server operating system: nextcloud-fpm-alpine:23 Docker image

Web server: nginx

Database: PostgreSQL 13.5 on x86_64-pc-linux-musl, compiled by gcc (Alpine 10.3.1_git20211027) 10.3.1 20211027, 64-bit

PHP version: 8.0.13

Nextcloud version: 23.0.0

e-caste avatar Dec 07 '21 15:12 e-caste

Same for me, at least I think it's the same issue, hope you don't mind me chiming in here.

Noticed a few days ago my Nextcloud app decided to log itself out (unclear why) and thus stopped backing up my photos. Re-enabled auto upload, put in my preferred filename mask (YYYYMMDD_HHmmss-), enabled year/month subfolders, and enabled upload entire camera roll (<6000 items). After less than 200 uploads, sometimes even <50 I think, the app just disappears. You can open up again, and then it resumes, but what a hassle. Tried removing Nextcloud app from iPhone and try again, same result

So I went exploring on my server, and in my nginx reverse proxy (same which worked years before) the last items uploaded before crash show something like:

192.168.3.1 - kbon [07/Dec/2021:18:31:16 +0000] "PUT /remote.php/dav/files/kbon/Photos/2012/12/20121222_191916-0180.jpg HTTP/2.0" 400 0 "-" "Mozilla/5.0 (iOS) Nextcloud-iOS/4.1.0"
192.168.3.1 - kbon [07/Dec/2021:18:31:16 +0000] "PUT /remote.php/dav/files/kbon/Photos/2012/12/20121222_204146-0181.jpg HTTP/2.0" 400 0 "-" "Mozilla/5.0 (iOS) Nextcloud-iOS/4.1.0"
192.168.3.1 - kbon [07/Dec/2021:18:31:16 +0000] "PUT /remote.php/dav/files/kbon/Photos/2012/12/20121222_204151-0182.jpg HTTP/2.0" 400 0 "-" "Mozilla/5.0 (iOS) Nextcloud-iOS/4.1.0"
192.168.3.1 - kbon [07/Dec/2021:18:31:16 +0000] "PUT /remote.php/dav/files/kbon/Photos/2012/12/20121222_204155-0183.jpg HTTP/2.0" 400 0 "-" "Mozilla/5.0 (iOS) Nextcloud-iOS/4.1.0"
192.168.3.1 - kbon [07/Dec/2021:18:31:16 +0000] "PUT /remote.php/dav/files/kbon/Photos/2012/12/20121222_204200-0184.jpg HTTP/2.0" 400 0 "-" "Mozilla/5.0 (iOS) Nextcloud-iOS/4.1.0"

(note the 400 response status)

Checking the nextcloud.log at same time: {"reqId":"8RAvNDFyUgF9R44vpPrq","level":3,"time":"2021-12-07T18:31:16+00:00","remoteAddr":"192.168.3.1","user":"kbon","app":"no app in context","method":"PUT","url":"/remote.php/dav/files/kbon/Photos/2012/12/20121222_191916-0180.jpg","message":"Expected filesize of 2541940 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 1753088 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 (iOS) Nextcloud-iOS/4.1.0","version":"22.2.3.0","exception":{"Exception":"Sabre\\DAV\\Exception\\BadRequest","Message":"Expected filesize of 2541940 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 1753088 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/3rdparty/sabre/dav/lib/DAV/Server.php","line":1137,"function":"put","class":"OCA\\DAV\\Connector\\Sabre\\File","type":"->","args":[null]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":492,"function":"updateFile","class":"Sabre\\DAV\\Server","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"httpPut","class":"Sabre\\DAV\\CorePlugin","type":"->","args":[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":472,"function":"emit","class":"Sabre\\DAV\\Server","type":"->","args":["method:PUT",[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":253,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->","args":[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":321,"function":"start","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/apps/dav/lib/Server.php","line":333,"function":"exec","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/remote.php","line":166,"args":["/var/www/html/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/var/www/html/apps/dav/lib/Connector/Sabre/File.php","Line":245,"CustomMessage":"--"}}

After this I dug in deeper, and sure enough, this example 20121222_191916-0180.jpg had been corrupted on my server. So not only is the iOS app crashing, it's also corrupting previously uploaded files when it crashes. I'm storing files on the same server, local HDD, and dmesg doesn't show drive failures. My home wlan is stable, but even if it wasn't, I won't accept that as justification for corrupting files.

My environment:

  • iOS app version 4.1.0.17 on an iPhone 6s
  • Server was running Nextcloud version 20 something, and to troubleshoot I upgraded to latest stable 22, same problem. Runs within docker, using latest nextcloud:22-apache .
  • Server is also backed by PostgreSQL (also within Docker, postgres:11-alpine)

@e-caste do you also see this file corruption on your instance?

Would appreciate any input to try and find what's causing this.

kbon avatar Dec 09 '21 12:12 kbon

@kbon at a first glance I don't see any corruption on my side.

I hope all the logs you've included will make the devs' job easier!

By the way, I'm on an iPhone 7, and you being on a 6S made me think that this may be a RAM-tied issue. I don't have the elements to be sure of this but it could be a hint to solve the issue.

e-caste avatar Dec 09 '21 23:12 e-caste

I'm running nextcloud liquid 4.2.0.5 for ios 15.1.1, iPhone 12 Pro Max, nextcloud server 23.0.0. camera roll has ~28000 files, the app crashes after uploading 20-100 files.

jxiaobin avatar Dec 27 '21 21:12 jxiaobin

If you don't mind, I would like to share my story, too. 25 000 photos and videos. Using versions 4.2 and 20 sth. It crashes after 4 to 20 files. I tried different options, deleting cash, checked out testflight version, raised ram on server (NextCloud installed on bare metal, no docker, no snap), set all max_ variables in php.ini to a high value. Tried ios client on my iPad AND on my iPhone. Tried snap installation on server. Tried to switch from wifi to lan. Delete all photos on server, restarted sync. Nothing works. Very frustrating. I could ofc. restart the app every 5 seconds, but I'd rather not.

serackhlx avatar Feb 01 '22 21:02 serackhlx

Getting this error as well using 22.1.0 server.

rhysjtevans avatar Mar 06 '22 20:03 rhysjtevans

Same issue for me using iOS 15.4.1 on my iPhone SE 2nd gen (link to discourse thread).

pauldoo avatar Apr 19 '22 18:04 pauldoo

Is this a duplicate of #1738?

bardo avatar May 17 '22 17:05 bardo

@bardo

Is this a duplicate of #1738?

Yes, it looks like it. I had looked around in the issues before opening this one, I believe I discarded that issue as the same due to its not very explicit title.

I'll let the repo mods choose what to do since this issue also appears to have gotten a bit of traction.

e-caste avatar May 18 '22 07:05 e-caste

Not really sure if its out of memory causing the crash, but on iphone 8 (ios 15.6) mine will crash during photo upload at some point, which then results in the app needing a login again. After logging in again all my settings are forgotten and I have to do the entire upload again. I've got about 1000 photos that need uploading, after getting to only 20 or so left the crash occurred, what a terrible waste of time. The entire concept of "upload whole camera roll" makes no sense. Nextcloud needs some other kind of scan in the background system that can resume, and some ability to compare hashes with the server to detect duplicates and prevent uploads (if the filename/filesize is the same and the hash is the same the file can most likely be skipped).

The immediate issue is that under no circumstance should the apps settings get so screwed up that a fresh login is needed thus erasing all settings and progress on a photo upload. Apps crash all the time, nobody expects them to never crash, but to crash in such a way that all settings are corrupted is unacceptable.

GFolchez avatar Aug 28 '22 20:08 GFolchez

Same/Similar issue here: After flipping "upload complete camera storage" this is the last thing to be seen before the app crashes.

Expand

image

firstdorsal avatar Nov 10 '23 14:11 firstdorsal