ios icon indicating copy to clipboard operation
ios copied to clipboard

Suspected OOMK when enabling auto-upload on large Camera Rolls

Open koolfy opened this issue 3 weeks ago • 0 comments

How to use GitHub

  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Steps to reproduce

  1. Enable auto-upload
  2. Wait for it to "create archive"
  3. Leave it be for a while, then check up on it
  4. It is stuck and nothing has happenned (aven days later)

Expected behaviour

App should complete the scan and start feeding items into the upload queue

Actual behaviour

App seems to endlessly retry forming the list of items to upload, or get stuck trying, and never actually uploads a single file. Not even new pictures created since the activation of auto-upload (might make sense if it priorises the initial scan)

Logs

Note: I redacted:

  • Username as: "USER1"
  • Instance URL as: "INSTANCE_URL"
  • Location coordinates as: "XXXXX, YYYYY"
2025-12-05 00:46:14 [DEBUG] Application will enter in foreground
2025-12-05 00:46:14 [DEBUG] Application did become active
2025-12-05 00:46:21 [DEBUG] Scene will resign active
2025-12-05 00:46:22 [DEBUG] Application did enter in background
2025-12-05 00:46:22 [INFO] Auto upload in background: true
2025-12-05 00:46:22 [INFO] Update in background: true
2025-12-05 01:36:47 [BGT] Start processing task
2025-12-05 01:36:47 [BGSYNC] Start cleaning week
2025-12-05 01:36:48 [BGSYNC] Stop cleaning week
2025-12-05 02:06:55 [BGT] Start processing task
2025-12-05 02:37:09 [BGT] Start processing task
2025-12-05 03:07:49 [BGT] Start processing task
2025-12-05 11:06:07 [START] Start session with level normal Nextcloud Matheria for iOS 7.2.2.4 © 2025
2025-12-05 11:06:07 [DEBUG] Account active USER1 https://INSTANCE_URL
2025-12-05 11:06:08 [DEBUG] Application will enter in foreground
2025-12-05 11:06:08 [DEBUG] Application did become active
2025-12-05 11:06:08 [INFO] Inside metadata folder __NC_ROOT__ with permissions: GDNVCK
2025-12-05 11:06:08 [INFO] Request started: PROPFIND https://INSTANCE_URL/remote.php/dav/files/USER1
2025-12-05 11:06:08 [INFO] Request started: No request created yet.
2025-12-05 11:06:08 [DEBUG] Scene will resign active
2025-12-05 11:06:09 [INFO] Network response request: https://INSTANCE_URL/ocs/v2.php/apps/recommendations/api/v1/recommendations, result: success(2371 bytes)
2025-12-05 11:06:09 [INFO] Request started: PROPFIND https://INSTANCE_URL/remote.php/dav/files/USER1/Documents/Nextcloud%20flyer.pdf
2025-12-05 11:06:09 [INFO] Network response request: https://INSTANCE_URL/remote.php/dav/files/USER1, result: success(2193 bytes)
2025-12-05 11:06:09 [INFO] Request started: No request created yet.
2025-12-05 11:06:09 [SYNC METADATA] Start Sync Metadata for https://INSTANCE_URL/remote.php/dav/files/USER1
2025-12-05 11:06:09 [INFO] Request started: PROPFIND https://INSTANCE_URL/remote.php/dav/files/USER1
2025-12-05 11:06:09 [INFO] Network response request: https://INSTANCE_URL/ocs/v2.php/apps/notifications/api/v2/push, result: success(1034 bytes)
2025-12-05 11:06:09 [INFO] Network response request: https://INSTANCE_URL/remote.php/dav/files/USER1/Documents/Nextcloud%20flyer.pdf, result: success(2026 bytes)
2025-12-05 11:06:09 [INFO] Request started: No request created yet.
2025-12-05 11:06:09 [INFO] Network response request: https://INSTANCE_URL/remote.php/dav/files/USER1, result: success(2174 bytes)
2025-12-05 11:06:09 [DEBUG] Application did enter in background
2025-12-05 11:06:09 [INFO] Request started: PROPFIND https://INSTANCE_URL/remote.php/dav/files/USER1/Documents/Example.md
2025-12-05 11:06:09 [INFO] Update in background: true
2025-12-05 11:06:09 [INFO] Auto upload in background: true
2025-12-05 11:06:09 [INFO] Network response request: https://push-notifications.nextcloud.com/devices?format=json, result: success(1 bytes)
2025-12-05 11:06:09 [INFO] Network response request: https://INSTANCE_URL/remote.php/dav/files/USER1/Documents/Example.md, result: success(1998 bytes)
2025-12-05 11:06:09 [INFO] Request started: PROPFIND https://INSTANCE_URL/remote.php/dav/files/USER1/Documents/Readme.md
2025-12-05 11:06:09 [INFO] Network response request: https://INSTANCE_URL/remote.php/dav/files/USER1/Documents/Readme.md, result: success(1994 bytes)
2025-12-05 11:06:09 [INFO] Request started: PROPFIND https://INSTANCE_URL/remote.php/dav/files/USER1/Documents/Welcome%20to%20Nextcloud%20Hub.docx
2025-12-05 11:06:10 [INFO] Network response request: https://INSTANCE_URL/remote.php/dav/files/USER1/Documents/Welcome%20to%20Nextcloud%20Hub.docx, result: success(2102 bytes)
2025-12-05 11:06:10 [INFO] Request started: PROPFIND https://INSTANCE_URL/remote.php/dav/files/USER1/Readme.md
2025-12-05 11:06:10 [INFO] Network response request: https://INSTANCE_URL/remote.php/dav/files/USER1/Readme.md, result: success(1984 bytes)
2025-12-05 11:06:10 [INFO] Request started: PROPFIND https://INSTANCE_URL/remote.php/dav/files/USER1/Templates/Yellow%20idea.odp
2025-12-05 11:06:10 [INFO] Network response request: https://INSTANCE_URL/remote.php/dav/files/USER1/Templates/Yellow%20idea.odp, result: success(2046 bytes)
2025-12-05 11:06:10 [INFO] Request started: PROPFIND https://INSTANCE_URL/remote.php/dav/files/USER1/Templates/Certificate.odt
2025-12-05 11:06:10 [INFO] Network response request: https://INSTANCE_URL/remote.php/dav/files/USER1/Templates/Certificate.odt, result: success(2036 bytes)
2025-12-05 11:06:39 [DEBUG] Application will enter in foreground
2025-12-05 11:06:39 [DEBUG] Application did become active
2025-12-05 11:07:02 [DEBUG] Scene will resign active
2025-12-05 11:07:03 [DEBUG] Application did enter in background
2025-12-05 11:07:04 [INFO] Auto upload in background: true
2025-12-05 11:07:04 [INFO] Update in background: true
2025-12-05 16:30:05 [START] Start session with level normal Nextcloud Matheria for iOS 7.2.2.4 © 2025
2025-12-05 16:30:08 [DEBUG] Account active USER1 https://INSTANCE_URL
2025-12-05 16:30:09 [BGT] Start refresh task
2025-12-05 16:39:26 [BGT] Start refresh task
2025-12-05 16:39:28 [INFO] Request started: No request created yet.
2025-12-05 16:39:29 [INFO] Network response request: https://INSTANCE_URL/ocs/v2.php/apps/notifications/api/v2/push, result: success(1034 bytes)
2025-12-05 16:39:29 [INFO] Request started: POST https://push-notifications.nextcloud.com/devices?format=json
2025-12-05 16:39:29 [INFO] Network response request: https://push-notifications.nextcloud.com/devices?format=json, result: success(1 bytes)
2025-12-05 16:48:22 [BGT] Start refresh task
2025-12-05 16:56:21 [BGT] Start refresh task
2025-12-05 17:04:38 [BGT] Start refresh task
2025-12-05 17:12:20 [BGT] Start refresh task
2025-12-05 17:49:36 [START] Start session with level normal Nextcloud Matheria for iOS 7.2.2.4 © 2025
2025-12-05 17:49:38 [DEBUG] Account active USER1 https://INSTANCE_URL
2025-12-05 17:49:39 [BGT] Start refresh task
2025-12-05 17:49:40 [INFO] Request started: No request created yet.
2025-12-05 17:49:41 [INFO] Network response request: https://INSTANCE_URL/ocs/v2.php/apps/notifications/api/v2/push, result: success(1034 bytes)
2025-12-05 17:49:41 [INFO] Request started: No request created yet.
2025-12-05 17:49:41 [INFO] Network response request: https://push-notifications.nextcloud.com/devices?format=json, result: success(1 bytes)
2025-12-05 17:58:33 [START] Start session with level normal Nextcloud Matheria for iOS 7.2.2.4 © 2025
2025-12-05 17:58:38 [DEBUG] Account active USER1 https://INSTANCE_URL
2025-12-05 17:58:39 [BGT] Start refresh task
2025-12-05 17:58:41 [INFO] Request started: No request created yet.
2025-12-05 17:58:55 [INFO] Network response request: https://INSTANCE_URL/ocs/v2.php/apps/notifications/api/v2/push, result: success(1034 bytes)
2025-12-05 17:58:55 [INFO] Request started: No request created yet.
2025-12-05 17:58:56 [INFO] Network response request: https://push-notifications.nextcloud.com/devices?format=json, result: success(1 bytes)
2025-12-05 18:06:25 [START] Start session with level normal Nextcloud Matheria for iOS 7.2.2.4 © 2025
2025-12-05 18:06:27 [DEBUG] Account active USER1 https://INSTANCE_URL
2025-12-05 18:06:28 [BGT] Start refresh task
2025-12-05 18:06:30 [INFO] Request started: No request created yet.
2025-12-05 18:06:31 [INFO] Request started: No request created yet.
2025-12-05 18:06:31 [INFO] Network response request: https://INSTANCE_URL/ocs/v2.php/apps/notifications/api/v2/push, result: success(1034 bytes)
2025-12-05 18:06:31 [INFO] Network response request: https://push-notifications.nextcloud.com/devices?format=json, result: success(1 bytes)
2025-12-05 18:14:33 [BGT] Start refresh task
2025-12-05 18:36:23 [START] Start session with level normal Nextcloud Matheria for iOS 7.2.2.4 © 2025
2025-12-05 18:36:24 [DEBUG] Account active USER1 https://INSTANCE_URL
2025-12-05 18:36:25 [INFO] Request started: No request created yet.
2025-12-05 18:36:26 [INFO] Network response request: https://INSTANCE_URL/ocs/v2.php/apps/notifications/api/v2/push, result: success(1034 bytes)
2025-12-05 18:36:26 [INFO] Request started: No request created yet.
2025-12-05 18:36:26 [INFO] Network response request: https://push-notifications.nextcloud.com/devices?format=json, result: success(1 bytes)
2025-12-05 22:31:22 [START] Start session with level normal Nextcloud Matheria for iOS 7.2.2.4 © 2025
2025-12-05 22:31:23 [DEBUG] Account active USER1 https://INSTANCE_URL
2025-12-05 22:31:23 [DEBUG] Application will enter in foreground
2025-12-05 22:31:23 [DEBUG] Application did become active
2025-12-05 22:31:23 [INFO] Inside metadata folder __NC_ROOT__ with permissions: GDNVCK
2025-12-05 22:31:23 [INFO] Request started: PROPFIND https://INSTANCE_URL/remote.php/dav/files/USER1
2025-12-05 22:31:23 [INFO] Request started: No request created yet.
2025-12-05 22:31:24 [INFO] Network response request: https://INSTANCE_URL/ocs/v2.php/apps/recommendations/api/v1/recommendations, result: success(2374 bytes)
2025-12-05 22:31:24 [INFO] Request started: PROPFIND https://INSTANCE_URL/remote.php/dav/files/USER1/Documents/Example.md
2025-12-05 22:31:24 [INFO] Request started: No request created yet.
2025-12-05 22:31:24 [INFO] Network response request: https://INSTANCE_URL/remote.php/dav/files/USER1, result: success(2193 bytes)
2025-12-05 22:31:24 [SYNC METADATA] Start Sync Metadata for https://INSTANCE_URL/remote.php/dav/files/USER1
2025-12-05 22:31:24 [INFO] Request started: PROPFIND https://INSTANCE_URL/remote.php/dav/files/USER1
2025-12-05 22:31:24 [INFO] Network response request: https://INSTANCE_URL/ocs/v2.php/apps/notifications/api/v2/push, result: success(1034 bytes)
2025-12-05 22:31:24 [INFO] Network response request: https://INSTANCE_URL/remote.php/dav/files/USER1/Documents/Example.md, result: success(1998 bytes)
2025-12-05 22:31:24 [INFO] Network response request: https://INSTANCE_URL/remote.php/dav/files/USER1, result: success(2174 bytes)
2025-12-05 22:31:24 [INFO] Request started: No request created yet.
2025-12-05 22:31:24 [INFO] Request started: PROPFIND https://INSTANCE_URL/remote.php/dav/files/USER1/Documents
2025-12-05 22:31:24 [INFO] Request started: PROPFIND https://INSTANCE_URL/remote.php/dav/files/USER1/Readme.md
2025-12-05 22:31:25 [INFO] Network response request: https://push-notifications.nextcloud.com/devices?format=json, result: success(1 bytes)
2025-12-05 22:31:25 [INFO] Network response request: https://INSTANCE_URL/remote.php/dav/files/USER1/Documents, result: success(9571 bytes)
2025-12-05 22:31:25 [INFO] Network response request: https://INSTANCE_URL/remote.php/dav/files/USER1/Readme.md, result: success(1984 bytes)
2025-12-05 22:31:25 [INFO] Request started: PROPFIND https://INSTANCE_URL/remote.php/dav/files/USER1/Documents/Welcome%20to%20Nextcloud%20Hub.docx
2025-12-05 22:31:25 [INFO] Network response request: https://INSTANCE_URL/remote.php/dav/files/USER1/Documents/Welcome%20to%20Nextcloud%20Hub.docx, result: success(2102 bytes)
2025-12-05 22:31:25 [INFO] Request started: PROPFIND https://INSTANCE_URL/remote.php/dav/files/USER1/Documents/Nextcloud%20flyer.pdf
2025-12-05 22:31:25 [INFO] Network response request: https://INSTANCE_URL/remote.php/dav/files/USER1/Documents/Nextcloud%20flyer.pdf, result: success(2026 bytes)
2025-12-05 22:31:25 [INFO] Request started: No request created yet.
2025-12-05 22:31:25 [INFO] Network response request: https://INSTANCE_URL/remote.php/dav/files/USER1/Documents/Readme.md, result: success(1994 bytes)
2025-12-05 22:31:25 [INFO] Request started: PROPFIND https://INSTANCE_URL/remote.php/dav/files/USER1/Templates/Certificate.odt
2025-12-05 22:31:25 [INFO] Network response request: https://INSTANCE_URL/remote.php/dav/files/USER1/Templates/Certificate.odt, result: success(2036 bytes)
2025-12-05 22:31:25 [INFO] Request started: PROPFIND https://INSTANCE_URL/remote.php/dav/files/USER1/Templates/Modern%20company.odp
2025-12-05 22:31:25 [INFO] Network response request: https://INSTANCE_URL/remote.php/dav/files/USER1/Templates/Modern%20company.odp, result: success(2054 bytes)
2025-12-05 22:31:26 [INFO] Request started: No request created yet.
2025-12-05 22:31:26 [INFO] Network response request: https://INSTANCE_URL/ocs/v2.php/apps/activity/api/v2/activity/all?format=json&limit=1&previews=true&since=0, result: success(718 bytes)
2025-12-05 22:31:38 [DEBUG] Scene will resign active
2025-12-05 22:31:39 [DEBUG] Application did enter in background
2025-12-05 22:31:40 [INFO] Update in background: true
true
2025-12-05 22:31:40 [LOCATION] Triggered by location change: XXXXX, YYYYY
2025-12-05 22:32:30 [DEBUG] Application will enter in foreground
2025-12-05 22:32:30 [DEBUG] Application did become active

Reasoning or why should it be changed/implemented?

This is affecting (blocking their main feature) two users of my private instance, and entirely blocking them from using the app at all for their usecase. Both user have been living in the apple ecosystem for long enough to accumulate a Camera Roll of around 50-60k pictures or 250GB of pictures.

I consider this common enough that it should be a usecase handled by the app. It may be slow, even take hours, even a day or two would be fine for users as long as they see it's still trying to do the initial "archive".

But crashing 100% of the time obviously means a lot of users are simply left unable to use the Nextcloud iOS client at all.

When asking for help and whether people with large libraries had better luck, I only get negative (unhelpful) feedback claiming this feature almost shouldn't ever be expected to work at all. I however am quite determined to help improve the situation and prove the naysayers wrong :)

I do not own an iOS device, but a couple users are motivated to help me with experiments and logs!

Here is my short analysis:

From other logs found in similar (but not identical) issues, I understand that:

[START] Start session with level normal Nextcloud Matheria for iOS 7.2.2.4 © 2025

Seems to be the startup message of the app https://github.com/nextcloud/ios/blob/caf9c59b92effd25ddd8a1c7d4d82cf07b108561/iOSClient/AppDelegate.swift#L83

and

[BGT] Start refresh task

Seems to be the start of the local scan https://github.com/nextcloud/ios/blob/caf9c59b92effd25ddd8a1c7d4d82cf07b108561/iOSClient/AppDelegate.swift#L187

If that understanding holds, I can see a bunch of sequences where the scan starts, nothing happens, and after around 30 minutes, we see an app startup message:

2025-12-05 17:12:20 [BGT] Start refresh task
2025-12-05 17:49:36 [START] Start session with level normal Nextcloud Matheria for iOS 7.2.2.4 © 2025

I mention this because to my understanding this is different from an app "wake-up" from background, and is indicative of the entire app having excited (or crashed)

Looking at the background sync code I found this: https://github.com/nextcloud/ios/blob/0a15335da34628d6dbbb519f65301b84db82db97/iOSClient/Networking/NCAutoUpload.swift#L231

Where all assets to upload seem to be collected, seemingly at once. My first thought was that holding all these items in memory might be challenging depending on the ratio of Camera Roll size / available physical memory

I actually expected some kind of "streaming" or "paging" approach where items would be "discovered" 500 by 500 or something on the smaller side. I know nothing of the iOS APIs so this might be hard or very hard, but without any kind of iterating approach we are bound to it the memory budget eventually...

Another thing that I note from the code is this: https://github.com/nextcloud/ios/blob/0a15335da34628d6dbbb519f65301b84db82db97/iOSClient/Networking/NCAutoUpload.swift#L235

Surely, when holding a potentially huge list of entries that migh have a significant memory footprint, duplicating it and sorting them in memory all at once might be a botleneck I was going to argue that maybe they do'nt need to be sorted at all, and might simply be enqueued for upload as-is (or entered in a local DB format that might be queried by date efficiently?), but then I noticed this a bit earlier:

https://github.com/nextcloud/ios/blob/0a15335da34628d6dbbb519f65301b84db82db97/iOSClient/Networking/NCAutoUpload.swift#L216

Doesn't this suggest that we expect discovered items to already be sorted by creationDate? Maybe this is superfluous as well, but in any case ordering in memory an object that was already requested to be ordered is only going to make the memory situation worse, as I understand?

And finally the object is duplicated in memory (if I understand correctly) again right after: https://github.com/nextcloud/ios/blob/0a15335da34628d6dbbb519f65301b84db82db97/iOSClient/Networking/NCAutoUpload.swift#L236

Before being finally returned.

With my limited understanding of this language, iOS APIs, memory management and how the iOS Nectcloud client manages its data structures, this is as far as I can go, and many of my assumptions might be wrong. I was just looking at potential risk factors for risky memory budget manipulations and found these. With the logs I have it's hard to know exactly where the (suspected) memory crash might be happening but this felt like the obvious starting point.

Please also note that the "out of memory crash" is just a theory of mine as well, there is no definite proof of it in the logs.

Environment data

iOS version: Unkown at the time of writing but I can ask

Nextcloud iOS app version: 7.2.2.4

Server operating system: Linux Docker on TrueNAS

Web server: nginx

Database: PostgreSQL

PHP version: 8.3.28

Nextcloud version: v32.0.2 (latest available)

koolfy avatar Dec 07 '25 00:12 koolfy