I
Immich•2y ago
64B1T

New Image uploads are all corrupted.

Not sure what's going on here. When I upload from my mobile app, instead of seeing images in any other client, every single one appears as a broken link. If I try to download the image, the resultant file is corrupted and won't open. Deleting them and reuploading them results in the same thing. This appears to apply to ALL my new uploads to the system. My current server version is v1.81.1
No description
127 Replies
64B1T
64B1TOP•2y ago
Uploading from my desktop seems to work okay. So it may be limited to the android upload.
Alex Tran
Alex Tran•2y ago
Can you check the microservices to see if it has any error?
64B1T
64B1TOP•2y ago
[Nest] 8 - 10/10/2023, 1:51:51 AM ERROR [JobService] Unable to run job handler (thumbnailGeneration/generate-jpeg-thumbnail): Error: Input file contains unsupported image format [Nest] 8 - 10/10/2023, 1:51:51 AM ERROR [JobService] Error: Input file contains unsupported image format [Nest] 8 - 10/10/2023, 1:51:51 AM ERROR [JobService] Object: Looks like whatever my phone is spitting up is suddenly unsupported>
Alex Tran
Alex Tran•2y ago
Are you taking photos in any special raw format?
64B1T
64B1TOP•2y ago
No, the photos are in jpg format. (they're also showing as jpg inside the immich client app, where they display properly)
64B1T
64B1TOP•2y ago
This is an example image which I uploaded from the phone
No description
64B1T
64B1TOP•2y ago
And the downloaded "upload" from immich
No description
64B1T
64B1TOP•2y ago
Looks like it got cut off at 64Kb? Doesn't appear to be a problem with my proxy. Results are the same when connecting directly to the server.
Alex Tran
Alex Tran•2y ago
hmm uploading the file from the web works I susepct? Can you help pulling the log from the mobile device?
64B1T
64B1TOP•2y ago
...actually no, it does not appear to work if I upload images sourced from that phone From desktop. Very weird. That above dog photo will not work from desktop upload on my end.
Alex Tran
Alex Tran•2y ago
Can you help zip the image and send it here?
Alex Tran
Alex Tran•2y ago
So this works if I upload from the web
No description
64B1T
64B1TOP•2y ago
Okay, interesting. Still not working on my end.
Alex Tran
Alex Tran•2y ago
Hmm
64B1T
64B1TOP•2y ago
I uploaded your image and that also failed.
Alex Tran
Alex Tran•2y ago
Can you check microservices log?
64B1T
64B1TOP•2y ago
Maybe my attempt at uploading an image earlier was a fluke [Nest] 8 - 10/10/2023, 5:53:22 PM ERROR [JobService] Unable to run job handler (thumbnailGeneration/generate-jpeg-thumbnail): Error: Input file contains unsupported image format [Nest] 8 - 10/10/2023, 5:53:22 PM ERROR [JobService] Error: Input file contains unsupported image format [Nest] 8 - 10/10/2023, 5:53:22 PM ERROR [JobService] Object: { "id": "a246efe6-8def-4ecb-a4e6-f7cb754a1dfa", "source": "upload" }
Alex Tran
Alex Tran•2y ago
Hmm try bring down the stack, and bring it back up then removes all the error images and reupload
64B1T
64B1TOP•2y ago
No description
64B1T
64B1TOP•2y ago
Same error
Alex Tran
Alex Tran•2y ago
ok, try this, bring down the stack, repull the images and restart it
64B1T
64B1TOP•2y ago
Yep Did that earlier, same results. Just trying again now, with this command:
docker-compose pull && docker-compose up --force-recreate --build -d
docker-compose pull && docker-compose up --force-recreate --build -d
Same result
Alex Tran
Alex Tran•2y ago
does upload other things work or just this image?
64B1T
64B1TOP•2y ago
This image works. Everything else I've tried right now doesn't
Alex Tran
Alex Tran•2y ago
Can you try this?
64B1T
64B1TOP•2y ago
Does not work
Alex Tran
Alex Tran•2y ago
Hmm weird Can you help check if the UPLOAD_LOCATION mount can be seen in microservices container?
64B1T
64B1TOP•2y ago
I can see files created in the NAS that the instance is connected to, but they're all corrupted
Alex Tran
Alex Tran•2y ago
Which file system are you using? NFS?
64B1T
64B1TOP•2y ago
Yep
Alex Tran
Alex Tran•2y ago
Ok now try this, delete all photos/videos from the instance bring the stack down, then change the upload location to be relative to the VM that run Immich, instead of using the NAS mount then try upload again
64B1T
64B1TOP•2y ago
From in the microservices container it has the correct path Just checked. I'll do this a little later. But there is no VM. All of this is bare metal. Bare metal Ubuntu server running docker, hardwire connected to a TRUNAS CORE system, mounted under CIFS to the user directory on the Ubuntu System I have been using Immich for a few months now with the configuration with no issues, but it seems this issue cropped up recently, must've been with a watchtower update. No luck. I changed UPLOAD_LOCATION to a spot on the local drive, still can't upload properly.
Alex Tran
Alex Tran•2y ago
still unsupported image format msg?
64B1T
64B1TOP•2y ago
Hmmm. I did the build force command again, same from earlier, and now it's uploading to the local From phone and computer. I'm going to try repeating the proceedure and swapping it back to the network drive. Back to broken images.
Alex Tran
Alex Tran•2y ago
then probably network drive mount issue how do you mount the drive?
64B1T
64B1TOP•2y ago
sudo mount //{$IP}/Storage/ /home/$LOCALUSER/$REMOTEDIR -t cifs -o iocharset=utf8,credentials=$CREDPATH, file_mode=0777,dir_mode=0777,uid=1000,gid=1000,cache=strict
Alex Tran
Alex Tran•2y ago
and it has been working before, correct? cant you mount as ext4?
64B1T
64B1TOP•2y ago
That's the command that's been in place for the last few years. Works on all my other services. For some reason, Immich is the stickler.
Alex Tran
Alex Tran•2y ago
hmm very strange here
64B1T
64B1TOP•2y ago
Immich is definitely creating files and directories over there, but for some reason, everything gets corrupted.
Alex Tran
Alex Tran•2y ago
@Contributor any idea about this issue?
64B1T
64B1TOP•2y ago
All of the corrupted files, regardless of their original size, are 24Kb or less
thomas
thomas•2y ago
Could you upload one of the corrupt files?
thomas
thomas•2y ago
I wonder if it's something weird with https://github.com/andrewrk/node-mv/blob/645d8f4c783abf84204be704098fdd41f36ab195/index.js#L58 You said you also tried it on a local filesystem? That would imply this isn't involved Could it be a docker thing?
64B1T
64B1TOP•2y ago
Ooooh... That's interesting. I can see the files in immich, but I can't download them.
thomas
thomas•2y ago
Immich doesn't ever really touch the original file, other than to move it around. So it would have to be somewhere else
64B1T
64B1TOP•2y ago
Images that were uploaded prior to this issue display fine in immich, but are corrupted when I try to download them from the web ui
thomas
thomas•2y ago
😬
64B1T
64B1TOP•2y ago
That's real neat
Alex Tran
Alex Tran•2y ago
how about the actual file are they ok in the library directory?
64B1T
64B1TOP•2y ago
Yeah Everything prior to and including October 3rd is fine. As in, the files in the library directory are good and uncorrupted, and they display at full resolution in immich (and play, if they're videos) but attempting to download them results in a corrupted file.
Alex Tran
Alex Tran•2y ago
would it be possible to mount a sub directory in your nas as ext4 and try?
64B1T
64B1TOP•2y ago
How would I go about that? are you meaning a different protocol? Ext4 is just the filesystem...
thomas
thomas•2y ago
@64B1T You could exec into an immich container and inspect the filesystem from there. I think that would give a clearer picture
64B1T
64B1TOP•2y ago
Microservices a good place to look?
thomas
thomas•2y ago
I think immich-server is best
64B1T
64B1TOP•2y ago
It can see the drive just fine
thomas
thomas•2y ago
Do the files look okay?
Alex Tran
Alex Tran•2y ago
can you create a file and write something to it?
thomas
thomas•2y ago
That too
64B1T
64B1TOP•2y ago
Yes and yes Wrote an 80Kb text file through the container to the drive and verified on another host.
thomas
thomas•2y ago
You said that exisiting files would download corrupt?
64B1T
64B1TOP•2y ago
Yep
thomas
thomas•2y ago
Could you try to read one of those existing files from within the container? identify -v /path/to/file should be enough
64B1T
64B1TOP•2y ago
Yeah that works fine
thomas
thomas•2y ago
How do you access Immich? Do you have a reverse proxy somewhere?
64B1T
64B1TOP•2y ago
Yes I do, however, this issue is also occuring without the proxy enabled - over a direct IP connection. Though I haven't tried downloading images without the proxy, I'll do that now.
thomas
thomas•2y ago
Thanks
64B1T
64B1TOP•2y ago
Still corrupt
thomas
thomas•2y ago
What is the direct IP to?
64B1T
64B1TOP•2y ago
The server immich is hosted on, which has the immich proxy on it mirroring port 2283
thomas
thomas•2y ago
What if you try the docker local IP to immich-server? so if the URL is https://demo.immich.app/api/asset/download/299f3662-4823-4565-9e0b-8ab1549f8d05 you would want to use http://immich-server/asset/download/299f3662-4823-4565-9e0b-8ab1549f8d05 note /api is dropped
64B1T
64B1TOP•2y ago
Not able to get to the immich server IP with any computer that has a GUI 😦 hmm.
thomas
thomas•2y ago
You can use curl -LOfs <url>
64B1T
64B1TOP•2y ago
Perhaps I'm doing something wrong. 1) Identify IP address of immich_server with
docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' immich_server
docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' immich_server
2) Identify the asset of a known good image by openng the image in a new tab. 3)
curl -Lfs http://$IP:3001/asset/download/c2487e5f-1c5f-46fd-a90c-50ecc3c5cf10
curl -Lfs http://$IP:3001/asset/download/c2487e5f-1c5f-46fd-a90c-50ecc3c5cf10
Not able to connect to it, though I can ping it properly
thomas
thomas•2y ago
Are your port forwarding the containers? If so, you can just localhost:3001 It may be worth using curl -Lfv for more info
64B1T
64B1TOP•2y ago
Only the proxy port is exposed. 2283
thomas
thomas•2y ago
Ah, I think you would have to expose the immich-server container I guess you could also just run the command inside the immich-server container should produce the same result
64B1T
64B1TOP•2y ago
Service is rebooting Ugh. Opened up 3001 which seems to be the port that immich-server uses. No dice though. Going to try something else.
thomas
thomas•2y ago
You can try running curl in the immich-server container instead, which would not need port changes
64B1T
64B1TOP•2y ago
Still no dice. Is my command wrong?
curl -L http://localhost:3001/asset/download/c2487e5f-1c5f-46fd-a90c-50ecc3c5cf10
curl -L http://localhost:3001/asset/download/c2487e5f-1c5f-46fd-a90c-50ecc3c5cf10
Results in a 404 Running inside immich-server
thomas
thomas•2y ago
hah why on earth try curl -X POST <url>
64B1T
64B1TOP•2y ago
Ah, it wants auth
64B1T
64B1TOP•2y ago
In GUI land, that has auth:
No description
thomas
thomas•2y ago
Makes sense
64B1T
64B1TOP•2y ago
{"message":"Authentication required","error":"Unauthorized","statusCode":401}
{"message":"Authentication required","error":"Unauthorized","statusCode":401}
Not sure how to feed it auth over cmd. Set an API key?
thomas
thomas•2y ago
-H 'Authorization: abc123' or, I guess for immich (sorry) it's probably a cookie so
64B1T
64B1TOP•2y ago
🙃 I appreciate all the help Sorry this is such a weird issue.
thomas
thomas•2y ago
--cookie 'immich_auth_type=password; immich_access_token=TaDGJplsMtKoF8V3Hem1Mj3vSVn0mTPFHbjUcqldoo' You're welcome, sorry I don't have an easy solution
64B1T
64B1TOP•2y ago
Lmao, using a fresh API token, I'm getting an Invalid user token unauthorized.
thomas
thomas•2y ago
ah for api tokens I think you need -H 'x-api-key: <token>'
jrasm91
jrasm91•2y ago
Or you can just add a query param ?apiKey=key
64B1T
64B1TOP•2y ago
This works... But I'm now getting an asset not found
jrasm91
jrasm91•2y ago
So the symptoms are the following? - no thumbnails - microservice error like invalid/unsupported file during thumbnail generation
thomas
thomas•2y ago
files on the filesystem are also corrupt, and file downloads for previously okay files are corrupt too
jrasm91
jrasm91•2y ago
And you cannot download the original either? You get a partial file that is much smaller than the original upload? Oh, the actual upload, moved to library/ is corrupt? Did you update/change anything in the system recently?
64B1T
64B1TOP•2y ago
- No thumbnails - Can't upload images from phone. Computer sometimes works, but I'm not sure why. Results in partial file on drive and no thumbnail - Can't download existing images from immich, even if they display and interact properly in the web ui. Results in a partial file.
thomas
thomas•2y ago
imo it sounds like not an immich thing, and probably something somewhere else (like a proxy) wanted to verify though
jrasm91
jrasm91•2y ago
Sounds like a problem with the drive to me
64B1T
64B1TOP•2y ago
- With or without proxy enabled
thomas
thomas•2y ago
well, I wanted to bypass even the immich nginx proxy
64B1T
64B1TOP•2y ago
Everything was working up until october 3rd, which is when 1.81 came out May try regressing to 1.80 later See if that works
jrasm91
jrasm91•2y ago
We did move to node 20 in 1.81
thomas
thomas•2y ago
GitHub
createWriteStream has problems in a CIFS mount path with node 20.x....
Version 18.18.0 and 20.x.x Platform Linux iob-node20 6.2.16-5-pve #1 SMP PREEMPT_DYNAMIC PVE 6.2.16-6 (2023-07-25T15:33Z) x86_64 GNU/Linux Subsystem iobroker What steps will reproduce the bug? writ...
jrasm91
jrasm91•2y ago
Looks very similar
64B1T
64B1TOP•2y ago
Ah, look at that.
jrasm91
jrasm91•2y ago
I'm guessing that rolling back to 1.80 would fix it then
sogan
sogan•2y ago
@64B1T weird suggestion but try setting UV_USE_IO_URING=0 in your .env, restarting the stack and uploading an image With the latest version of immich
64B1T
64B1TOP•2y ago
Ding ding ding
Alex Tran
Alex Tran•2y ago
damnnnnnn
64B1T
64B1TOP•2y ago
Deleted all the corrupted images. Nature is healing. Thank you!
jrasm91
jrasm91•2y ago
What is this black magic
sogan
sogan•2y ago
apparently the bug is specific to io_uring, so disabling it forces libuv to fallback to a normal (in this case non-buggy) thread pool
etnoy
etnoy•2y ago
Likely this will be fixed in the next minor node version. Do we add this to the faq in the meantime?
bo0tzz
bo0tzz•2y ago
Faq and release notes imo
etnoy
etnoy•2y ago
Agreed
Ortimore
Ortimore•2y ago
Hello everyone I'm sorry to re open something that appared to be close if needed I can open my own question for my own case. I'm in the same case of @64B1T and since 1.81 all my new image are conrrupt (passing by the application or the web). I see a env config have done the trick. The sad part for me if I'm on a TrueNas ix application and I don't see a way to configure a special setting after 😦 So here are my questions : Do you plan to fixe this issues in the futur release and in the meatime I have to look how to rollback to 1.80 ? Or maybe does one of you know how to configure that part in TrueNas cause I may miss a way to do it ? Thank you all in advance for all your answer and support given.
Alex Tran
Alex Tran•2y ago
Hello, I am monitoring the nodejs version to see if we can update to the new one to resolve this issue
Ortimore
Ortimore•2y ago
OK thank you I hop it will happen soon.... sadly I think I'm stuck on 1.82 version and I don't see a way to configure my env on TruNas... :/ By the way when I read again all the discussion the solution seem to appear from nowhere. Can I have a way to check if I'm really in the same case and it's not something else that is breaking all my download ?
sogan
sogan•2y ago
I havent used TrueNAS, but you should be able to set env variables based on their docs https://www.truenas.com/docs/scale/scaleuireference/apps/installcustomappscreens/#container-environment-variables-settings
Install Custom App Screen
Provides information on the Install Custom App screen and configuration settings.
Ortimore
Ortimore•2y ago
Thank you for the help unfortunately I'm not on a custom app but I'm on the official TrueNas Immich app.
Ortimore
Ortimore•2y ago
Here a glance of what it's look like
No description
Ortimore
Ortimore•2y ago
Normaly it should be there where I got a way to put my env setting but from the official app I don't get a way to add it and if I m correct it's not something I can add after the creation of the 8 dockers. :/
Ortimore
Ortimore•2y ago
It is also there when I can show I have mount my uploads library and thumbs storage to a mnt path
No description
Ortimore
Ortimore•2y ago
Those mount point are done on my TrueNas Scale server using CIFTS to my other NAS where I store my photo. This is where based on the discussion I read here I have my problem I think 😦 To only part that remmains for me would be to have a log to check if indeed I got the same problem are not cause I can't roll back to an older version and when creating a new Immich app using local docker storage the image upload work.

Did you find this page helpful?