immich icon indicating copy to clipboard operation
immich copied to clipboard

iOS App keeps crashing - local backup to server

Open EliasMarine opened this issue 11 months ago • 25 comments

The bug

When uploading via immich app iOS v1.99 after a few minutes of uploading, the app crashes. App needs to be restarted to resume backup. After a few more minutes, app craches again.

iOS v17.3.1

The OS that Immich Server is running on

Unraid 6.12.8

Version of Immich Server

v1.99

Version of Immich Mobile App

v1.99

Platform with the issue

  • [ ] Server
  • [ ] Web
  • [x] Mobile

Your docker-compose.yml content

n/a

Your .env content

n/a

Reproduction steps

1. opens iOS app
2. upload resumes
3. app crashes
...

Additional information

No response

EliasMarine avatar Mar 21 '24 05:03 EliasMarine

I assume you are using iCloud, and these photos/videos have been uploaded from iCloud. These seems to be a memory leaked when downloading/uploading asset from iCloud that causes the crash

alextran1502 avatar Mar 21 '24 05:03 alextran1502

Correct using iCloud. It worked fine downloading from iCloud and pushing to the server for about ~2.5k photos then it would crash after about ~300 photos or so repeatedly. I absolutely love the app btw...amazing work!

EliasMarine avatar Mar 21 '24 05:03 EliasMarine

Thank you for the report, I don't use iCloud so there might be some cases we haven't properly handled when downloading/uploading from iCloud

alextran1502 avatar Mar 21 '24 05:03 alextran1502

I'm having the same issue: The bug When uploading via immich app iOS v1.99.0 build .145 after a few minutes of uploading, the app crashes. App needs to be restarted to resume backup. After a few more minutes, app craches again.

iOS v17.4.1

The OS that Immich Server is running on Debian 12.5 Docker 20.10.24+dfsg1, build 297e128 Docker-compose 1.29.2

Version of Immich Server v1.99.0

Version of Immich Mobile App v1.99.0 build .145

Reproduction steps

  1. opens iOS app
  2. upload resumes
  3. app crashes ... Additional information No response

Also, my phone is getting seriously hot when performing this backup. At one point it went into thermal protect.

shumancw avatar Mar 24 '24 17:03 shumancw

I'm also having the same issue but with App v1.100.0 build .146 & server v1.100.0

iOSv17.3.1 Immich v1.100.p0 Mobile app v1.100.0 build 146

Immich Server running on QNAP NAS vQTS 5.1.5.2679 Docker version 20.10.27-qnap1, build 662936b Docker Compose version v2.15.1-qnap1

The compose files are the standard ones taken from https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml

Same reproduction steps as above

hjspencer avatar Apr 02 '24 19:04 hjspencer

I have the same issue - let me know if there's anything useful I can do to debug. Same release and config as the above.

This is my first full backup of 200GB so for now I've made an iOS Shortcut that opens the app automatically when it closes. That way I can leave my device with auto-lock disabled overnight and be confident it will continue until I wake up.

Bod1985 avatar Apr 03 '24 23:04 Bod1985

Just an FYI to those with this problem (like me). If you enable analytics on your iphone, it will create a crash report that you can then give to the developers here.
I have been getting this constant crash while trying to get all 9,800 images/videos transferred. Then I found this issue here and I enabled analytics to get a crash report. Strangely, now I'm not getting a single crash.

There may be a correlation here worth looking into. If you are getting crashes, check if you have analytics reporting enabled: To locate and email crash reports for iOS, iPadOS, watchOS, and tvOS apps:

  1. Open the Analytics & Improvements section of Settings on the device. See Share analytics, diagnostics, and usage information with Apple.
  2. Tap Analytics Data.
  3. Locate the log for your app. The log name starts with <AppBinaryName><DateTime> for crash reports, or JetsamEvent<DateTime> for high-memory use crashes.
  4. Select the desired log.
  5. Tap the Share icon, and select Mail to send the crash report as a mail attachment.

At that point you'd want to upload that report into here.

douginoz avatar Apr 04 '24 04:04 douginoz

I have the same issue on latest iOS (just upgraded last night). Indeed using iCloud.

nothing2obvi avatar Apr 04 '24 05:04 nothing2obvi

@alextran1502 - what makes you think this is a memory leak? Just found this project and I use icloud and i'm eager to help fix this.

Any assistance you can give would be appreciated, I should have a few cycles this weekend to download the repo and try and root cause this issue.

brendanclement avatar Apr 05 '24 01:04 brendanclement

@brendanclement My hunch for memory leaked is because this issue happens for folks that have their assets on iCloud, so the process of downloading and discarding the iCloud might be the cause here.

alextran1502 avatar Apr 05 '24 02:04 alextran1502

Worth testing if app crashes with/without crash dump logging enabled on phone. Strangely, crashes stopped when I enabled logging.

On Thu, 4 Apr 2024 at 19:08, Alex @.***> wrote:

@brendanclement https://github.com/brendanclement My hunch for memory leaked is because this issue happens for folks that have their assets on iCloud, so the process of downloading and discarding the iCloud might be the cause here.

— Reply to this email directly, view it on GitHub https://github.com/immich-app/immich/issues/8141#issuecomment-2038631380, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAO3F6NRWI44O35FUA77JCDY3YBS3AVCNFSM6AAAAABFAX5RS2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZYGYZTCMZYGA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

douginoz avatar Apr 05 '24 02:04 douginoz

@alextran1502 - got the workspace set up. I'm new to flutter but went through the docs to get up to speed.

i'm having trouble signing the application to get it to run on my device. Do i need to work with you to get a profile to enable development? I looked at the README and other issues in this repo and couldn't find a solution.

this is the error I get when trying to run and debug from vscode

Launching lib/main.dart on BRENFONE in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: 2F67MQ8R79
Xcode build done.                                            3.4s
Failed to build iOS app
Could not build the precompiled application for the device.
Error (Xcode): No profiles for 'app.alextran.immich' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'app.alextran.immich'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild.
/Users/brendan/Code/immich/mobile/ios/Runner.xcodeproj
2

It appears that there was a problem signing your application prior to installation on the device.

Verify that the Bundle Identifier in your project is your signing id in Xcode
  open ios/Runner.xcworkspace

Also try selecting 'Product > Build' to fix the problem.

Error launching application on BRENFONE.

I tried opening the Runner in xcode but i face the same issue, and I don't have an apple developer account.

Screenshot 2024-04-05 at 23 07 51

brendanclement avatar Apr 06 '24 06:04 brendanclement

figured it out. just needed to change the bundle identifier to something of mine.. kinda sucks that i need to keep renewing the cert every 7 days though :P

brendanclement avatar Apr 06 '24 07:04 brendanclement

So interesting find.. Got the app running with the debugger. i saw the logs spewing out ERROR backupAsset: failed to parse <html>.

the request to the backend was returning 413 entity too large with an HTML payload https://github.com/immich-app/immich/blob/8f981b60529140af839171dc052bc49784c73911/mobile/lib/modules/backup/services/backup.service.dart#L357

and then this line was throwing an error as it's not valid JSON https://github.com/immich-app/immich/blob/8f981b60529140af839171dc052bc49784c73911/mobile/lib/modules/backup/services/backup.service.dart#L368

this was coming from nginx, a reverse proxy i have in front of immich. I changed the configuration to allow larger files and now it's backing up without crashing

I have some videos that are around ~2GB so i added the following to my nginx.conf

http {
   ...
   client_max_body_size 2000M;
}

now the backup seems to be working great.

As i presume reverse proxies are common, I'm thinking we could add some logic here to detect this status code and emit a warning / error in the app. Is this a PR you'd welcome @alextran1502 ?

brendanclement avatar Apr 06 '24 07:04 brendanclement

iOS 17.4.1 (21E236) crash log

Runner-2024-04-17-095629.txt

EliasMarine avatar Apr 18 '24 17:04 EliasMarine