Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exif: Add cycle detection to prevent infinite loops #1326

Closed
iwinstar opened this issue May 24, 2021 · 25 comments
Closed

Exif: Add cycle detection to prevent infinite loops #1326

iwinstar opened this issue May 24, 2021 · 25 comments
Assignees
Labels
bug Something isn't working released Available in the stable release

Comments

@iwinstar
Copy link

I've installed PhotoPrism by docker-compose in my Synology server. While index one of those Pictures.zip cause photoprism docker very busy and be killed after several minutes. After ignore them photoprism work back to normal.

I'm using version 210505-d3e53a89-Linux-x86_64. Could I try latest release or wait for you check this problem? Thanks

Here is my options.yml config.

Debug: false
DisableBackups: false
DisableDarktable: true
DisableFFmpeg: true
DisableRawtherapee: true
JpegQuality: 95
ThumbFilter: blackman
ThumbSize: 720
ThumbSizeUncached: 720
ThumbUncached: true
@lastzero
Copy link
Member

lastzero commented May 24, 2021

Please try our latest release and make sure your Synology station meets the hardware requirements. You need at least 4 GB of RAM plus Swap. Try reducing the number of workers to 1.

@iwinstar
Copy link
Author

I give photoprism docker 12 GB RAM to use, so hardware requirements shouldn't be a problem. I also tried reducing PHOTOPRISM_WORKERS to 1 but still useless.

@iwinstar
Copy link
Author

It has successfully indexed over 40000 pictures before those two.

@lastzero
Copy link
Member

Are these files somehow special, like very large or RAW?

@iwinstar
Copy link
Author

I have uploaded them. https://github.com/photoprism/photoprism/files/6529695/Pictures.zip
just common jpeg, not very large.

@lastzero
Copy link
Member

I also see you have tweaked the thumb settings. Are you sure this isn't because of high CPU load when viewing search results while indexing?

@iwinstar
Copy link
Author

No. I'm sure no one is viewing.

@lastzero
Copy link
Member

Try again using our latest release from yesterday. We've updated a lot of dependencies. If it still happens, I'll take a look at your files later today.

@iwinstar
Copy link
Author

Thanks, I will try latest docker image soon.

@iwinstar
Copy link
Author

Still get killed using latest version 210523-b1856b9d-Linux-x86_64. It even can't indexed any new picture...
I'll roll back to 210505-d3e53a89-Linux-x86_64.

@lastzero
Copy link
Member

What database are you using? Any other special settings?

@lastzero
Copy link
Member

Maybe the disk is full?

@iwinstar
Copy link
Author

Database: MariaDB 10.4.19
Disk still has 9.3TiB free space
I have executed "photoprism purge" and "photoprism cleanup" command before start indexing.
I checked webpage keep saying "Indexing photo-1512923874408-340b0f3cb7e6.jpg…" but no any update msg or docker log.

@iwinstar
Copy link
Author

I changed all table default charset to utf8mb4, and serval column collation utf8mb4_unicode_ci to fix database "1366 Incorrect String Value" error. such as
photoprism.details.subject
photoprism.photos.photo_title
photoprism.photos.photo_description

@iwinstar
Copy link
Author

Photoprism docker has used more than 7.61 GB RAM.
docker log keep print like "INFO[2021-05-24T06:04:23Z] photo: won't update title, xxxxxxx was modified" before get killed.

@iwinstar
Copy link
Author

After rollback to version 210505-d3e53a89 and ignore those two picture I uploaded, index work fine.

@iwinstar
Copy link
Author

I directly stopped the photoprism container and create new one with latest image, never click "cancel index" button through webpage. Is this why I couldn't use the latest release to continue indexing pictures?

@lastzero
Copy link
Member

Excellent catch! Seems to be an issue with our JPEG Exif parser. Hope Dustin can help with this.

@lastzero lastzero self-assigned this May 24, 2021
@lastzero lastzero added bug Something isn't working waiting Impediment / blocked / waiting labels May 24, 2021
@lastzero lastzero changed the title Some picture cause server very busy and killed while indexing Metadata: Exif parsing causes very high server load while indexing May 24, 2021
@lastzero
Copy link
Member

@iwinstar May we add your samples to our test file archive at https://dl.photoprism.org/samples/?

@iwinstar
Copy link
Author

Of course. Excellent work, Thanks.

@lastzero
Copy link
Member

Reading Exiftool's warning message, it becomes clear why go-exif may get stuck in a loop extracting all data:

$ exiftool -g yourfile.jpg 
---- ExifTool ----
ExifTool Version Number    : 12.16
Warning                    : IFD1 pointer references previous IFD0 directory

See https://exiftool.org/forum/index.php?topic=3524.0

Money quote:

Question 1: What does this mean? (Sorry I could not find it anywhere.)

It means that the EXIF information is corrupted, and some may have been lost.

Looks very much like the same issue as in #1463, same warning there.

@rickysarraf
Copy link
Contributor

With the current devel tip, I am getting a crash on PhotoPrism when doing a full index. The crash has been consistently reproduced for the last 1 week or so.

photoprism_1  | time="2021-08-17T10:17:21Z" level=debug msg="moments: updated “Water, Ships & Boats” (public:true label:lakeside|water)"
photoprism_1  | time="2021-08-17T10:17:26Z" level=debug msg="moments: 934 albums saved as yaml files"
photoprism_1  | time="2021-08-17T10:17:26Z" level=info msg="faces: found 137 new markers"
photoprism_1  | panic: sync: negative WaitGroup counter
photoprism_1  | 
photoprism_1  | goroutine 7357 [running]:
photoprism_1  | sync.(*WaitGroup).Add(0xc00484d280, 0xffffffffffffffff)
photoprism_1  |         /usr/local/go/src/sync/waitgroup.go:74 +0x147
photoprism_1  | sync.(*WaitGroup).Done(...)
photoprism_1  |         /usr/local/go/src/sync/waitgroup.go:99
photoprism_1  | github.com/mpraski/clusters.(*dbscanClusterer).nearestWorker(0xc001f72ff0)
photoprism_1  |         /go/pkg/mod/github.com/mpraski/clusters@v0.0.0-20171016094157-18104487c312/dbscan.go:251 +0x230
photoprism_1  | created by github.com/mpraski/clusters.(*dbscanClusterer).startNearestWorkers
photoprism_1  |         /go/pkg/mod/github.com/mpraski/clusters@v0.0.0-20171016094157-18104487c312/dbscan.go:228 +0xdb
mariadb_1     | 2021-08-17 10:17:32 33 [Warning] Aborted connection 33 to db: 'photoprism' user: 'photoprism' host: '172.17.0.3' (Got an error reading communication packets)
mariadb_1     | 2021-08-17 10:17:33 30 [Warning] Aborted connection 30 to db: 'photoprism' user: 'photoprism' host: '172.17.0.3' (Got an error reading communication packets)
mariadb_1     | 2021-08-17 10:17:34 32 [Warning] Aborted connection 32 to db: 'photoprism' user: 'photoprism' host: '172.17.0.3' (Got an error reading communication packets)
mariadb_1     | 2021-08-17 10:17:34 31 [Warning] Aborted connection 31 to db: 'photoprism' user: 'photoprism' host: '172.17.0.3' (Got an error reading communication packets)
photoprism_photoprism_1 exited with code 0

@lastzero
Copy link
Member

Not related. Has to do with facial recognition. Do you have it enabled? How many workers do you have configured? The cluster library doesn't seem to like it...

@rickysarraf
Copy link
Contributor

Not related. Has to do with facial recognition. Do you have it enabled? How many workers do you have configured? The cluster library doesn't seem to like it...

Thanks Michael. I have now created a new issue for it.
#1478

I don't recollect seeing any explicit switch for Facial Recognition. But yes, my past 2 weeks rebuilds are more about tracking the recent developments around

@lastzero
Copy link
Member

Our go-mod-outdated command didn't show new major versions of related image structure libraries, so we didn't upgrade those. The new versions use go-exif v3 instead of v2 which solves the issue. We'll build a new development preview for testing as soon as possible.

@lastzero lastzero added please-test Ready for acceptance test and removed waiting Impediment / blocked / waiting labels Aug 19, 2021
@lastzero lastzero changed the title Metadata: Exif parsing causes very high server load while indexing Exif: Add cycle detection to prevent infinite loops Aug 19, 2021
@graciousgrey graciousgrey added released Available in the stable release and removed please-test Ready for acceptance test labels Sep 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released Available in the stable release
Projects
Status: Release 🌈
Development

No branches or pull requests

4 participants