immich-app / immich

High performance self-hosted photo and video management solution.
https://immich.app
GNU Affero General Public License v3.0
52.14k stars 2.76k forks source link

[BUG] Background upload doesn't work even with Automatic Foreground Backup and Automatic background backup service enabled. #5994

Open gumpdy opened 10 months ago

gumpdy commented 10 months ago

The bug

Background upload doesn't work even with Automatic Foreground Backup and Automatic background backup service enabled. Android app battery management is set to Unrestricted.

The OS that Immich Server is running on

Android

Version of Immich Server

1.91.4

Version of Immich Mobile App

1.91.4 build.116

Platform with the issue

Your docker-compose.yml content

I don't know how to see that using the unRAID GUI, but the problem seems exclusive to the Android app functionality anyway

Your .env content

I don't know how to see that using the unRAID GUI, but the problem seems exclusive to the Android app functionality anyway

Reproduction steps

1.Open app, click on backup icon, see it begin uploading the video file. wait for a few percent to progress
2. take app away from foreground OR close it entirely
3. open app again, click on backup icon, see it start all over again.

Additional information

I also occasionaly see the percentage counter flicker between higher and lower percentage values, almost like it's showing the percentage values for duplicate asynchronous upload streams

gdamx commented 10 months ago

Same issue for me however it forgets the albums that are selected and it disables the foreground and background backup

gumpdy commented 10 months ago

Same issue for me however it forgets the albums that are selected and it disables the foreground and background backup

Make sure your app-specific battery optimization is aet to unrestricted on stock android. If you have a manufacturer's bloatware, refer to this guide: https://dontkillmyapp.com/

I have the same issue with the selected backup directories being forgotten but I think if you refresh or wait a minute, it'll come up

gdamx commented 10 months ago

I've done already still same issue. Photos seem to backup but videos don't . And by the time I check the app it forgets the backup location

gdamx commented 10 months ago

Screenshot_20231226_224310

Literally just left screen on to backup a video , nothing backed up assets remaining is the same

aisbergde commented 10 months ago

I also have seen lost selected folders to upload. Not sure, if they have been really lost, or if they just didn't display. But I added them again. I will see, if they will be forgotten again.

gdamx commented 10 months ago

They keep forgetting for me

eagerto-learn commented 10 months ago

I have the same issue. It forgets the albums selected and disables the foreground and background backup. After I reselect the albums and leave the upload screen on, it tries to upload some videos that I already uploaded from a couple months before. After each "try" is finished the remaining video number stays the same and it tries another video from even an earlier time.

Already set the battery to unrestricted, still same issue everytime I open the app.

gumpdy commented 10 months ago

For myself, when I first open the app, no albums are shown as selected but seemingly after some initialization, appear as expected. I suggest one of you open another bug issue, as I can't detail those quirks.

nkgiovannivl commented 10 months ago

I have same issue, but if I starts the app enter to cloud icon nothing it's show, press back an again enter to cloud icon, all info appers.

But, it's seems something strange with the videos, beacuse sync deamon/service sync all videos again and again until I allow Notifications for the app on my phone

kic68 commented 8 months ago

Definitely the same issue for me, the (Android) app forgets which albums to upload when I actively close it. It does not save the albums to upload - so the foreground and background engines are correct when they stop to upload as they think nothing is supposed to get uploaded. Update: I was just looking at the app status page (albums to be done on top, then total elements, already uploaded elements, remaining elements). While I was just looking at that, the albums to be done vanished and it looked as if I never selected an album. While the app was open, in the foreground, me looking at it.

Jebula999 commented 6 months ago

Any update on this? Facing the same issue.

500+ images and video's all sitting in a never ending queue because the app has to be in the foreground and open in that specific menu in order for it to upload.

alextran1502 commented 6 months ago

@Jebula999 Are you using reverse proxy/dns/cloudflare? Do you mind try access your instance over local ip?

Jebula999 commented 6 months ago

@Jebula999 Are you using reverse proxy/dns/cloudflare? Do you mind try access your instance over local ip?

I am currently on the same local network as my server running Immich.

I am connected directly via the server local IP address

alextran1502 commented 6 months ago

So it uploads fine when you open the app, just not working well on the background? Which phone model do you have?

Jebula999 commented 6 months ago

Correct.

It's a Samsung S24 Ultra.

Note the file amount difference in the 2 images attached.

All I did was minimise Immich and open my browser to respond to this message

Unfortunately my clock it not in the image, but they were taken 8min apart. As soon as I tabbed back to Immich it started uploading again. Screenshot_20240425_230312 Screenshot_20240425_231119

alextran1502 commented 6 months ago

@Jebula999 what you are seeing is normal operations. Background and foreground upload are two different mechanism. One doesn't continue when the state changes. Background upload is meant to use for everyday backup, not initial bulk backup. For initial backup, I suggest using foreground upload. And Samsung is notorious for killing background tasks so you will have to disable all of the battery saving mechanisms on your Samsung phone

Jebula999 commented 6 months ago

@alextran1502 Ok, then that makes more sense. Thank you for the insight, have a good weekend :)

kic68 commented 6 months ago

Good morning! We should not mix up two issues here. One is the "normal" Android energy optimizing killing app issue. This can and should be fixed in the widely spread Android settings.

The other issue is Immich related - as the App does NOT SAVE ITS CONFIGUATION before it is killed or closed. This seems to happen to some people including myself.

Steps to reproduce:

In that case it will only ever start uploading again if you configure the settings again. Which doesn't help for long. It is definitely NOT related to energy settings, at least not more than these kills can trigger the deletion of Immich's configuration.

Also on a Samsung Galaxy S24 Ultra.

alextran1502 commented 6 months ago

@kic68 I saw this reported sometimes, it is quite strange that it happens for some users but not all. Do you access the instance locally? How many assets do you have on your device?

kic68 commented 6 months ago

Please don't laugh, about 60k photos and videos. Stopping uploading after a few hundred. So this would be a big pain to always reconfigure.

alextran1502 commented 6 months ago

@kic68 With that amount of assets, I think it might have taken sometimes for the album to be read/sort/filter with already uploaded assets, so it is not necessarily forgotten.

Maybe worth a try to select an album, then put the app into the background or kill it, then bring it back, enter the backup screen and let it sit there for a few minuets

szmarczak commented 2 months ago

This is a bug. I can reproduce this by trying to upload 1.6G video file on a 40Mbps upload speed. Even if I wait enough time in the background, it still fails to upload.

meminens commented 1 month ago

Same for me. Background upload doesn't work.

simone7121 commented 1 month ago

Hello everyone,

I encountered a similar issue while using Immich. After some troubleshooting, I realized that bypassing the Cloudflare proxy resolved the problem (for me), and everything started working as expected.

It seems that the proxy was causing some kind of interference, potentially blocking certain requests or adding unwanted latency. For anyone else experiencing this, temporarily bypassing Cloudflare might help isolate whether the proxy is the source of the issue.

Additionally, I have a NAT 2 Italian internet connection, and after performing a traceroute, I noticed that my Fritz!Box router was redirecting me directly to my local address. (Even if i'm behind a reerse proxy) This might also be related to the issue, as it could interfere with how traffic is routed through Cloudflare.

It might be worth investigating if there are specific configurations needed for Immich to work smoothly with Cloudflare in proxied mode, or if certain headers are being stripped or blocked, or if the TTL is limited—I'm not sure.