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

Crash without log when running backgroud. #15

Closed
prigal opened this issue Nov 28, 2017 · 14 comments
Closed

Crash without log when running backgroud. #15

prigal opened this issue Nov 28, 2017 · 14 comments

Comments

@prigal
Copy link

prigal commented Nov 28, 2017

Last nitght is started sync again with

gphotos-sync --db-path=var/ /media/toshiba/ >> var/gphotos.log &

This morning, program is not running, log is stopped on :

gphotos.picasa: Added 8574 /media/toshiba/picasa/2016/07/20160716_135918 (3).mp4

And when starting again, it restart from beginning, look like database has not been updated ^^

(gphotos.sqlite-journal was still present)

Maybe, a forced "database save" every 1K photos is a good idea !

@gilesknap
Copy link
Owner

gilesknap commented Nov 28, 2017 via email

@prigal
Copy link
Author

prigal commented Nov 28, 2017

Yes it's the second time it occurs. Without log.
Each time it start again from last db update (all picasa sync).
Actually I try to abort run when I think about it because it forces a db update.

@gilesknap
Copy link
Owner

gilesknap commented Nov 28, 2017 via email

@prigal
Copy link
Author

prigal commented Nov 28, 2017

No it's not failing on the same problem.

In fact last time it has continue, and it has started downloading for the first time. (it start with picasa)

Command was launched without log redirect nor background mode, so I had to kill it to go to lunch and restart it with background.

That was 1 hour ago and it's still running but no output .

....
gphotos.picasa: Downloading /media/toshiba/picasa/2017/08/20170824_131826-ANIMATION.gif ...
gphotos.picasa: Downloading /media/toshiba/picasa/2017/08/20170824_105454-ANIMATION.gif ...
gphotos.picasa: Downloading /media/toshiba/picasa/2017/08/20170824_102847.mp4 ...
gphotos.picasa: Downloading /media/toshiba/picasa/2017/08/20170824_093413-COLLAGE.jpg ...
gphotos.picasa: Downloading /media/toshiba/picasa/2017/08/20170823_163016-COLLAGE.jpg ...
gphotos.picasa: Downloading /media/toshiba/picasa/2017/08/20170823_162945-COLLAGE.jpg ...
gphotos.picasa: Downloading /media/toshiba/picasa/2017/08/20170822_141821.mp4 ...
gphotos.picasa: Downloading /media/toshiba/picasa/2017/08/20170812_134932-ANIMATION.gif ...
gphotos.picasa: Downloading /media/toshiba/picasa/2017/07/20170729_103800-ANIMATION.gif ...

gphotos.picasa: Downloading /media/toshiba/picasa/2017/07/20170712_190921.mp4 ...
gphotos.picasa: Downloading /media/toshiba/picasa/2017/07/20170711_194259-ANIMATION.gif ...
^Cgphotos: User cancelled download
gphotos: Done.
gphotos.data: Saving Database ...
gphotos.data: Database Saved.

then :

(gphotos-sync) pi@raspberrypi:~/pyenvs/gphotos-sync $ gphotos-sync --db-path=var/ /media/toshiba/ > var/gphotos.log &
[1] 7976
(gphotos-sync) pi@raspberrypi:~/pyenvs/gphotos-sync $ tail -f var/gphotos.log
gphotos.drive: Indexing Drive Folders ...
gphotos.drive: Resolving paths ...
gphotos.drive: Drive Folders scanned.
gphotos.drive: Indexing Drive Files ...
gphotos.data: Saving Database ...
gphotos.data: Database Saved.
gphotos.picasa: Indexing Albums ...
gphotos.picasa: Album count 23
gphotos.picasa: Album: Auto Backup, photos: 41434, updated: 2017-11-26 09:12:24, published: 2017-11-26 09:03:29

Stuck on this line for 1 hour.

CPU is at 100% on raspberry.

capture d ecran 2017-11-28 a 12 53 07

@gilesknap
Copy link
Owner

gilesknap commented Nov 28, 2017 via email

@prigal
Copy link
Author

prigal commented Nov 28, 2017

I will try what you ask later. Since last post, I went to lunch and back. There are 2 new lines in log file :

gphotos.picasa: Updated /media/toshiba/picasa/2017/03/00013.MTS
gphotos.utils: token refresh: ya29.GlwSBdggnJIqQz-aZEJYxTVOIz8Vsv4uXtNsI0A5rvolRNlXyU0hurXpNggqcPm3BxR3pWfrhaYe798TW1ZhIZHvhqvUxEjlRS6SHAmSOGtewt9n5OHlcG88cs4UEg

I'm still waiting, cpu at 100%.

@prigal
Copy link
Author

prigal commented Nov 28, 2017

Just did it, nothing in etc/

I restart it in background to check.

@prigal
Copy link
Author

prigal commented Nov 28, 2017

Do it again, still nothing.

Restart in foreground mode, I will let it work an hour to check if it's moving forward.

@gilesknap
Copy link
Owner

OK I'll need to fix the stack trace dump, apologies.

It seems like it is still running, just very slow. Is memory OK? I'm not sure how to interpret htop output and the Mem bar looks full.

@prigal
Copy link
Author

prigal commented Nov 28, 2017

Memory was ok. Only 132M really used over 434.

Maybe you should add more logs in each steps, and a verbose mode to display them (that will help us trace where it hangs)

@prigal prigal mentioned this issue Nov 28, 2017
@gilesknap
Copy link
Owner

I just managed to get gphotos-sync to hang.
I was testing background operation and accidentally ran two. One aborted with DB locked, I cancelled the other and then restarted. It then always locked up on indexing folders, very early.

I deleted the DB from the filesystem and all was well.

So it seems it is possible to corrupt the DB in a subtle way that causes a hang. It is possible that this is what you are seeing...

@gilesknap
Copy link
Owner

Further update. I have noticed that the picasa indexing phase is processor bound and hits 100% on one processor for most of its execution. This might be a bit rough on the Pi.
The reason is that the Drive matching is running for each item discovered, each match may make several DB queries.

It would probably make sense to split the indexing of items in picasaWeb and the matching.

Matching would be processor intensive but should not take too long since it does not need to wait for responses from Google.

@gilesknap
Copy link
Owner

The evidence now suggests that this was due to a corrupt database. It seems that this may be caused by running two instances against the same DB (although db locking should handle this). I will add a singleton check to avoid this issue.

@gilesknap
Copy link
Owner

locking so that only one instance can run against a given db location has been added in cbe040d

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

2 participants