sortphotos
sortphotos copied to clipboard
sortphotos caught in a busy-loop upon encountering a 0-byte file
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 {} \;
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!
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
I got it resolved. I installed exiftool on the system as described in here and now it works!
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...