graysky2 / profile-sync-daemon

Symlinks and syncs browser profile dirs to RAM thus reducing HDD/SDD calls and speeding-up browsers.
https://wiki.archlinux.org/index.php/Profile-sync-daemon
Other
910 stars 88 forks source link

Constant data loss with Google Chrome #228

Closed admirabilis closed 4 years ago

admirabilis commented 6 years ago

I have been using psd for the last few weeks because Google Chrome calls fsync() about every second. In my test, psd does save some battery, and I'd like to have it working reliably for when I buy a SSD.

The problem is that because of psd, when I close Chrome and logout/reboot - my settings are restored from a state of days or weeks ago (probably the state of when I last started Chrome - I leave it open for a long time). I generally lose all my open tabs, recent bookmarks and even extensions. This happens most of the time.

psd was installed and configured as the following:

$ sudo apt install profile-sync-daemon
$ sudo visudo -f /etc/sudoers.d/99personal
teresaejunior ALL=(ALL) NOPASSWD: /usr/bin/psd-overlay-helper
$ egrep -v '^#|^$' .config/psd/psd.conf 
USE_OVERLAYFS="yes"
BROWSERS="google-chrome"
$ systemctl --user enable psd.service
$ systemctl --user start psd.service

In an attempt to stop psd from restoring old configurations, I have tried setting BACKUP_LIMIT=1 and now USE_BACKUPS=no, but neither made any difference. The current status is:

$ systemctl --user status psd
● psd.service - Profile-sync-daemon
Loaded: loaded (/usr/lib/systemd/user/psd.service; enabled; vendor preset: enabled)
Active: active (exited) since Sat 2018-05-19 04:18:11 -03; 10h ago
    Docs: man:psd(1)
        man:profile-sync-daemon(1)
        https://wiki.archlinux.org/index.php/Profile-sync-daemon
Process: 2538 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
Main PID: 2538 (code=exited, status=0/SUCCESS)

mai 19 04:18:11 laptop systemd[2522]: Starting Profile-sync-daemon...
mai 19 04:18:11 laptop systemd[2522]: Started Profile-sync-daemon.

$ ll .config/ | grep chrome
drwx------ 23 teresaejunior teresaejunior 4,0K mai 19 14:27 google-chrome-back-ovfs
drwx------ 23 teresaejunior teresaejunior 4,0K mai 19 04:13 google-chrome-backup
lrwxrwxrwx  1 teresaejunior teresaejunior   42 mai 19 04:18 google-chrome -> /run/user/1000/teresaejunior-google-chrome
admirabilis commented 6 years ago

This problem seems to have stopped on Ubuntu Bionic. I'll reopen if it starts happening again!

admirabilis commented 6 years ago

No, this was not solved. Only if I logout and $XDG_RUNTIME_DIR is left intact I don't have any problems. If I reboot, I still loose data!

admirabilis commented 6 years ago

The solution is running systemctl --user stop psd.service by hand before shutdown/reboot.

graysky2 commented 6 years ago

Not sure why... on Arch, I don't need to do anything beyond reboot or shutdown from either KDE or xfce4. How does ubuntu do it differently that requires the manual step you describe and is it a failure of my code?

admirabilis commented 6 years ago

When I stop it manually, I see disk I/O activity for about 1 or 2 minutes before I can shutdown. I guess either my profile is too big or it takes long to sync back because I have a HDD, not a SSD. I haven't run many tests yet, but during shutdown, systemd probably just sends a SIGKILL to services that take longer than a few seconds to finish.

admirabilis commented 6 years ago

My profile is ~430 MB in size. I have just 7 extensions, but I guess Chrome leaves a lot of old cruft behind.

My question is: does psd depend on a proper service shutdown, or should it be irrelevant and the error is happening somewhere else?

graysky2 commented 5 years ago

Are you using an overlayfs? That is much faster. Yes, big profiles and slow disks/buses can cause delays.

admirabilis commented 5 years ago

Yes, I've always used USE_OVERLAYFS. Large profiles seem to be a given for Chrome and Chromium based browsers. My VS Code profile is even larger than that, not even counting extensions, which are in a separate directory.

graysky2 commented 4 years ago

Not sure why... on Arch, I don't need to do anything beyond reboot or shutdown from either KDE or xfce4. How does ubuntu do it differently that requires the manual step you describe and is it a failure of my code?

I'm not sure what to do with this issue. Are you still facing it?

admirabilis commented 4 years ago

I recently got a laptop with a SSD. I want to try psd again, but the machine has an overheating problem. I'll update with more details when I'm able. The ridiculous constant writes with fsync() by Chrome has always bothered me a lot (and I find it really strange that nobody else seems to care).

graysky2 commented 4 years ago

OK, please open a new ticket if you're experiencing an issue.