ubuntu one does not notice when hamster.db changes

Bug #1103193 reported by Rüdiger Kupper
18
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Project Hamster
Invalid
Undecided
auto-toms.baugis
hamster (Ubuntu)
Invalid
Undecided
Unassigned
hamster-indicator (Ubuntu)
Invalid
Undecided
Unassigned
ubuntuone-client (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

I'm not sure where to report this bug, with Ubuntu One or with the hamster package. It concerns both.

I tried to synchronize the database of the popular hamster time tracker between computers using Ubuntu One. This technique is widely recommended on the internet, and I was surprised it does *not* work.

I added ~/.local/share/hamster-applet/ to the list of synced folders. This folder contains only one file, hamster.db, the database for the hamster time tracker.

What happens:
---------------------
hamster.db is synchronized when logging into Ubuntu. However, it is not synchronized while using the time tracker (e.g., adding new activities to the list of tracked activities). Although "ls -l" indicates that the last change time of the file has changed, Ubuntu One does not synchronize it to the cloud. This is true *even after closing the hamster application or hamster-indicator*.

Probable reason
----------------------
As far as I can tell the reason is that there is a background process named "hamster-service" keeping the file hamster.db open for writing, even after the hamster application or hamster-indicator is closed. This process runs while the user is logged into the gnome session, and that's the reason why hamster.db is only synced at login. If I manually kill the "hamster-service" process, Ubuntu One immediately syncs my hamster.db to the cloud.

How to reproduce
-------------------------
1. Open "hamster" or "hamster-indicator", and add some activities.
2. Open Ubuntu One control panel and add "~/.local/share/hamster-applet/" to the list of synced folders.
3. Log out of your GNOME session.
4. Log in again.
5. Observe that Ubuntu One syncs "hamster.db".
6. Open "hamster" or "hamster-indicator", and add some activities.
7. Close "hamster" or "hamster-indicator".
8. Observe that Ubuntu One does *not* sync "hamster.db".
9. Type "killall hamster-service" in a terminal.
10. Observe that Ubuntu One immediately syncs "hamster.db".

I'm not sure who's responsible here, the hamster people, the Ubuntu One people, or the people implementing the file monitoring service, but I feel that this should work.

One step to a solution may be syncing the file whenever the last change date indicates it has changed, no matter if it is still opened by any process.

ProblemType: Bug
DistroRelease: Ubuntu 12.10
Package: ubuntuone-client 4.0.0-0ubuntu1
ProcVersionSignature: Ubuntu 3.5.0-22.34-generic 3.5.7.2
Uname: Linux 3.5.0-22-generic i686
ApportVersion: 2.6.1-0ubuntu9
Architecture: i386
Date: Tue Jan 22 22:30:16 2013
InstallationDate: Installed on 2010-11-28 (786 days ago)
InstallationMedia: Ubuntu 10.10 "Maverick Meerkat" - Release i386 (20101007)
MarkForUpload: True
PackageArchitecture: all
SourcePackage: ubuntuone-client
UpgradeStatus: Upgraded to quantal on 2012-10-20 (93 days ago)

Revision history for this message
Rüdiger Kupper (ruediger.kupper) wrote :
description: updated
Revision history for this message
Rüdiger Kupper (ruediger.kupper) wrote :

That's the output of "gvfs-monitor-dir .local/share/hamster-applet/", when adding a new activity while hamster-indicator is running. Obviously, the monitoring service reports the change:

ruediger@enzo:~$ gvfs-monitor-dir .local/share/hamster-applet/
Directory Monitor Event:
Child = /home/ruediger/.local/share/hamster-applet/hamster.db-journal
Event = CREATED
Directory Monitor Event:
Child = /home/ruediger/.local/share/hamster-applet/hamster.db-journal
Event = CHANGED
Directory Monitor Event:
Child = /home/ruediger/.local/share/hamster-applet/hamster.db
Event = CHANGED
Directory Monitor Event:
Child = /home/ruediger/.local/share/hamster-applet/hamster.db-journal
Event = CHANGED
Directory Monitor Event:
Child = /home/ruediger/.local/share/hamster-applet/hamster.db-journal
Event = CHANGES_DONE_HINT
Directory Monitor Event:
Child = /home/ruediger/.local/share/hamster-applet/hamster.db-journal
Event = DELETED
Directory Monitor Event:
Child = /home/ruediger/.local/share/hamster-applet/hamster.db
Event = CHANGES_DONE_HINT

Revision history for this message
Rüdiger Kupper (ruediger.kupper) wrote :

Maintainer of hamster (<email address hidden>) notes:
> This sounds like an ubuntu one problem. The sync is working quite nicely with dropbox.

If this is so, Ubuntu One should solve the problem, if it doesn't want to lose ground to dropbox. There're liekely to be more cases than this.

Revision history for this message
dobey (dobey) wrote :

I'd like to know how it's working well with dropbox then. AFAIK, dropbox also uses filesystem (inotify) events to determine when to sync files. We are using such events in Ubuntu One. If hamster is keeping the file open and thus preventing the appropriate events from occurring, then there isn't a good way to know the file should be synchronized.

Knowing what gvfs-monitor-dir says also doesn't help here. We need to know what the underlying inotify events are.

Revision history for this message
dobey (dobey) wrote :

I'm not sure what schema hamster is using to store data in that hamster.db, but a better solution than file sync, would be to allow using u1db as a storage backend, and having the hamster process control syncing of that data.

Revision history for this message
Rüdiger Kupper (ruediger.kupper) wrote :

ruediger@helge:~/.local/share/hamster-applet$ file hamster.db
hamster.db: SQLite 3.x database

Revision history for this message
Rüdiger Kupper (ruediger.kupper) wrote :

Rodney,
I'd like to link this bug report to hamster's own bug tracker, so that upstrem developers are notified of comments. Project hamster is tracked at github:

https://github.com/projecthamster
https://github.com/projecthamster/hamster/issues

How would I tell launchpad to link to the guthub tracker?

Revision history for this message
Rüdiger Kupper (ruediger.kupper) wrote :

Added <email address hidden> as email notification.

Revision history for this message
Rüdiger Kupper (ruediger.kupper) wrote :

I confirm that using dropbox, hamster.db is synced to the cloud immediately whenever it changes. If dropbox uses the same inotify events as u1 (as comment #4 suggests), it interprets the events differently.

However, syncing hamster.db between two computers is still not working properly:

If the user is logged into two computers at a time, and makes a change on computer A, dropbox will sync this change to computer B. However, since on B there's "hamster-service" keeping its copy of hamster.db open, it will not detect the change (unless it closes the file, which only happens at logout).
hence, if the user goes back to machine B and makes another change, this creates a file conflict with dropbox.

I wonder how people manage to sync their hamster data using u1 or dropbox? (Unless they're so very disciplined as to log out whenever they leave a computer. Suspend won't be enough.)

Revision history for this message
theghost (theghost) wrote :

Rechecked this in Raring (13.04).
This is definetely an issue with Ubuntu One and not with Hamster.
Ubuntu One does not detect the changes of the Hamster.db

Synced my hamster.db and created md5sum.
Then added a few activities to the db and checked md5sum again.
Although the file and md5sum changed, it is not synced.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in hamster (Ubuntu):
status: New → Confirmed
Changed in hamster-indicator (Ubuntu):
status: New → Confirmed
Changed in ubuntuone-client (Ubuntu):
status: New → Confirmed
theghost (theghost)
Changed in hamster-indicator (Ubuntu):
status: Confirmed → Invalid
Changed in hamster (Ubuntu):
status: Confirmed → Invalid
Changed in hamster-applet:
status: New → Invalid
Revision history for this message
Jason Moore (moorepants) wrote :

Just to chime in. I've never been able to get hamster synced with dropbox or ubuntu one. I think it must be due to the reason Rüdiger Kupper mentions. The computers are always out of sync and I've even had data loss from switching back and forth. At the moment, I'm only recording hamster tasks on one machine.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

  • auto-toms.baugis Edit

Bug watches keep track of this bug in other bug trackers.