xemle / home-gallery

Self-hosted open-source web gallery to view your photos and videos featuring mobile-friendly, tagging and AI powered image discovery
https://home-gallery.org
MIT License
836 stars 64 forks source link

Preview extractor producing lots of errors into log #148

Closed fire-eggs closed 2 months ago

fire-eggs commented 3 months ago

Trying out the Linux binary with the default config. I'm getting a lot of error messages from the preview extractor in the log of the form:

{"level":50,"time":"2024-08-21T17:11:52.609Z","pid":284344,"hostname":"BRIX2","module":"extractor.image.preview","levelName":"error","err":{"type":"TypeError","message":"Cannot read properties of undefined (reading 'length')","stack":"TypeError: Cannot read properties of undefined (reading 'length')\n    at file:///tmp/caxa/home-gallery/1.16.1/home-gallery/node_modules/@home-gallery/extractor/dist/extract/image/image-preview.js:128:26\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"},"msg":"Could not calculate image previews of b64fc73:000to-sort4:05KZGbt.jpeg: TypeError: Cannot read properties of undefined (reading 'length')"}

And here is that specific image:

05KZGbt.jpeg.zip

The messages don't seem to be fatal, in that the images do show in the gallery.

xemle commented 3 months ago

Hi @fire-eggs

Thank you for reporting this issue. This should be fixed by 4569ccd in the master and is caused when all preview images are already created. You can review is by the newest master at https://dl.home-gallery.org/dist/unstable/master/

fire-eggs commented 3 months ago

Thank you very much for the response! I need to re-read the docs then, because I thought I was destroying all existing preview images before restarting the server. I had deleted database.db and all idx files ... Ah, I see, I failed to clean up the storage folder! Sorry for the noise!

xemle commented 3 months ago

No worries. You spot a bug! Thank you for that.

If you try to reset the gallery again, please read the docs about a reset

bkralik commented 2 months ago

Hi, it seems to me that this bug is not yet fixed - I have downloaded the latest build (home-gallery-master-20240821-b549a562-linux-x64) and it still produces the same error for each file during the gallery run import

[2024-09-11 10:49:55.912]: extractor.image.preview error Could not calculate image previews of 9a6c205:iphotos:2016/2016-12-31_23-44-36_IMG_0178.JPG: TypeError: Cannot read properties of undefined (reading 'length')

How can I give you more debug data or help you otherwise to fix that?

Thanks!

xemle commented 2 months ago

Hi @bkralik

Thank you for reporting the issue and providing feedback.

IMHO the build home-gallery-master-20240821-b549a562-linux-x64 should fix one bug. I've checked the code and currently I do not know yet what could cause the the error message, which you are reporting.

When do these error message appear? When you reimporting your images via ./gallery run import?

Would you mind to send the ndjson log line of gallery.log from this error. It contains more information where the error occurs and can give me further hints to fix it

xemle commented 2 months ago

@bkralik

Can you delete the directory /tmp/caxa/home-gallery once before calling the gallery with the binary home-gallery-master-20240821-b549a562-linux-x64 and recheck?

The binary extracts the embedded tar ball to /tmp/caxa/home-gallery if it does not exist. If you use different master bins, the tar ball is not extracted, since they share the same target /tmp/caxa/home-gallery/master/ directory.

Maybe this solves your issue?

xemle commented 2 months ago

The binary extracts the embedded tar ball to /tmp/caxa/home-gallery if it does not exist. If you use different master bins, the tar ball is not extracted, since they share the same target /tmp/caxa/home-gallery/master/ directory.

BTW This is fixed in the newest master 875652e...

fire-eggs commented 2 months ago

I observe the same issue as @bkralik.

Can you delete the directory /tmp/caxa/home-gallery once before calling the gallery with the binary home-gallery-master-20240821-b549a562-linux-x64 and recheck?

The binary extracts the embedded tar ball to /tmp/caxa/home-gallery if it does not exist. If you use different master bins, the tar ball is not extracted, since they share the same target /tmp/caxa/home-gallery/master/ directory.

Maybe this solves your issue?

Doing this solved the issue for me.

bkralik commented 2 months ago

@xemle Yes, that was it 👍 deleting that specified directory fixed the issue. Thanks! Just as a suggestion, would it be possible for the master builds to include the commit ID in the --version output? I was unable to verify which binary I was running.

xemle commented 2 months ago

Just as a suggestion, would it be possible for the master builds to include the commit ID in the --version output?

@bkralik it is a good idea, currently I do not know how to implement it quickly...

xemle commented 2 months ago

Just as a suggestion, would it be possible for the master builds to include the commit ID in the --version output?

Starting from 8cb284f the version information with commit ID is printed. E.g.

$ ./gallery.js --version
master-8cb284f4
$ ./gallery.js --full-version
Build version: master-8cb284f4 (commit 8cb284f4977d582649fee5ee6a24880947f2fa73) created by me at 2024-09-14T03:01:15+02:00

@bkralik Thank you for this wonderful suggestion.

bkralik commented 2 months ago

Nice! Thank you very much for the quick implementation!

xemle commented 2 months ago

@fire-eggs @bkralik can we close this issue?

fire-eggs commented 2 months ago

I'm good. Thanks!

bkralik commented 2 months ago

Yes, it also works for me