Open peterjdolan opened 1 month ago
Hmmm this is an interesting one that I have not seen.
May be a little challenging for me to debug without being able to reproduce it myself, so if you can investigate that would be great.
Thanks for the report.
FYI I've narrowed this down to how an exception in the file download flow is handled, which I think will be a terribly rare situation.
Specifically, the call to os.utime at https://github.com/gilesknap/gphotos-sync/blob/2c70af93aaadc815bee4ab1cf5dc848ebf4f4dd3/src/gphotos_sync/GooglePhotosDownload.py#L286 fails on my system because I'm running with a mounted SMB share, and the server doesn't allow the file attributes to be modified.
When an exception is thrown at that line, the download task times out (TimeoutException at https://github.com/gilesknap/gphotos-sync/blob/2c70af93aaadc815bee4ab1cf5dc848ebf4f4dd3/src/gphotos_sync/GooglePhotosDownload.py#L332), at which point the database connection is already closed, and the program reaches a deadlock state and fails to exit.
I haven't been able to write a unit test to expose this because my local development environment is a bit messy, but I'll keep working on it. In the meantime, I'll just change the mounted filesystem to make it work.
Thanks @peterjdolan I figure I just need to trap that exception - can't do much but ignore it I guess.
Agreed. I'm honestly not sure why it isn't already being caught, but it's not.
When I added a second general "except Exception" clause, it worked as expected.
I'm also not sure why the existing unit tests don't cover this. On my reading, they should.
When I run
gphotos-sync
, it reaches the "Done" state, but then hangs until I interrupt the process. At that point, the stack trace seems to indicate a threading deadlock, probably related to a future's exception not being handled appropriately. I may have time to take a look at the code to try to debug it, but not for some time.Example console output:
Another example console output: