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

sortphotos caught in a busy-loop upon encountering a 0-byte file #137

Open
stellingsimon opened this issue Feb 7, 2021 · 4 comments
Open

Comments

@stellingsimon
Copy link

Thanks for this nifty piece of software, I sure appreciate it!

I found a minor bug that's easy to work around once you realize what the cause is:

Observed Behavior

When running sortphotos on a large file tree, I observe that it stops always at the same spot, not producing output for minutes while consuming 100% CPU.
I tracked the issue down to it trying to process a 0-byte file.

Expected Behavior

It should probably just ignore that 0-byte file, or at least abort with a meaningful error.

Workaround

Since you most likely don't care for 0-byte files, just delete them before running sortphotos:

find <photo-dir> -size 0 -exec rm {} \;
@MitosisByProxy
Copy link

I've also found the issue, but stronger than described above. On my freenas system (I5, 64gbram, etc.); running sortphotos on any folder with even a single 0 byte file hard crashes the entire system (even just a single folder with only a single 0 byte file). The script just permanently hangs on a file and just fills up all ram / swap space until the entire system just stops responding to anything.

The workaround described above works like a charm.

This is my shell script moves them instead of removing them.

#!/bin/sh

echo "Moving 0 byte files due to bug in sortphotos..."
find ~/sync/ -size 0 -exec mv '{}' ~/photos/emptyfiles/ \;

echo "Executing photo backup..."
python ~/photos/sortphotos/src/sortphotos.py --recursive --sort %Y/%m ~/sync/ ~/photos/sorted/

echo "Done!"

P.s. Thanks so much for this project, it's a great piece of kit!

@philsynek
Copy link

Hi,

I have the same problem, but it is not related to 0 byte files. When I run the script on a lot of directories and files it gets stuck in the exif analysis phase with 100% CPU usage and fills up the RAM until being killed.

If I run the script on the subdirectory, where it got stuck, it runs fine without problems.

I have no idea how to work around this. Right now I run the script on every subdirectory, which is annoying.

Cheers,
Phil

@philsynek
Copy link

I got it resolved. I installed exiftool on the system as described in here and now it works!

@HattMarris1
Copy link

I got it resolved. I installed exiftool on the system as described in here and now it works!

This worked for me as another solution. Not entirely sure why this works though, surely exiftool should work the same installed as it does not installed? Weird...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants