Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

newly pinned tab disappears after restart + new window #11694

Closed
hugobuddel opened this issue Oct 27, 2017 · 10 comments
Closed

newly pinned tab disappears after restart + new window #11694

hugobuddel opened this issue Oct 27, 2017 · 10 comments

Comments

@hugobuddel
Copy link
Contributor

Description

I can't seem to add pinned tabs that stay persistent over sessions. There are 5 existing pinned tabs that work, but new ones disappear on restart + new window.

Steps to Reproduce

  1. Pin a page. Page is pinned.
  2. Open new windows. Page stays pinned.
  3. Close brave.
  4. Reopen brave. Page still pinned.
    5a. Open new window. Page not pinned anymore in new window.

Alternative:
5b. Close and reopen brave a second time. Page not pinned anymore.

Actual result:
Page is not pinned.

Expected result:
Page is pinned.

Reproduces how often:
100% so far. Have not tried new profile.

Brave Version

Brave 0.19.53 installed through apt-get on Ubuntu.

Also happens with 0.19.67 on windows.

about:brave info:

Brave: 0.19.53
rev: e09025b
Muon: 4.4.29
libchromiumcontent: 61.0.3163.100
V8: 6.1.534.41
Node.js: 7.9.0
Update Channel: Release
OS Platform: Linux
OS Release: 4.10.0-37-generic
OS Architecture: x64

Reproducible on current live release:
Don't know what this means.

Additional Information

@hugobuddel
Copy link
Contributor Author

This was not so much a problem for a while, but it has returned. In particular it is my gmail pin that is disappearing now. Very annoying. Currently on 0.19.139 for windows.

Last time I 'fixed' it by deleting my profile. But I don't want to do that every few months.

@hugobuddel
Copy link
Contributor Author

Could someone help me debug this myself? I now have a profile with which I can consistently reproduce the issue of disappearing pinned tabs, but I don't know where to start debugging this. It would be greatly appreciated if someone could help me answer these questions:

  • Where are the pinned tabs stored? A simple grep did not seem to find an obvious place.
  • Which function / file in the repository is responsible for handling the pinned tabs?
  • Are there general debugging guidelines? E.g. where are Brave logs to be found etc?

Currently running Brave 0.19.139 on Windows 10.

@hugobuddel
Copy link
Contributor Author

It seems that all the pinned tabs are stored in session-store-1, a 10MB json file. Adding a newly pinned tab and closing Brave adds an entry to this file. However opening and closing Brave again will remove the entry. Investigating further; I don't yet know the exact json format, found the entries simply by treating the file as a string.

@hugobuddel
Copy link
Contributor Author

So it seems that all pinned tabs and bookmarks are in the 'sites' section of the session-store-1 json file. Pinned sites have 'pinned' in the 'tags' section of the site.

A difference between 'good' and 'bad' pinned tabs is that all good pins have partitionNumber set to 0 and have a favicon, while 'bad' pins do not have either set (both have the pinned tag).

Now let's see whether it is possible to make 'bad' pins 'good' by adding the partitionNumber and/or favicon.

@hugobuddel
Copy link
Contributor Author

Unfortunately, manually adding the partitionNumber and favicon does not help.

@hugobuddel
Copy link
Contributor Author

Success!

One of the other interesting attributes of the entries in sites in the objectId. Searching around for the objectId lead to pendingRecords in sync in the session-store-1 json file.

It was possible to make a broken pinned tab persistent by:

  • Removing the site from sync/pendingRecords and,
  • removing the objectId from sites entry. (I already had another pinned tab without objectId, so it seems allowed.)

Doing only one was not sufficient. It was not necessary to set partitionNumber, which--guessing that this means the pagination of Brave tabs (whatever that's called)--makes sense, because they are on all of them.

So the broken pinned tabs seems to be a syncing issue. I don't understand that, because pinned tabs are not synchronized (at least not for me, only bookmarks). Also it is unclear to me what the objectId represents and whether this is random (like a uuid) or derived from the page some how.

Finally, I hope this is not a procedure I'll have to do for every tab that I'd like to add. I'll try clearing the sync/pendingRecords completely, there was one other item in there.

@hugobuddel
Copy link
Contributor Author

Apparently I'll have to do the above procedure for every site I'd like to pin. So I've written a short (and ugly) Python script for it:

import json
dd = json.load(open("session-store-1"))
dd['sync']['pendingRecords'] = {}
pins_bad = [site for site in dd['sites'].values() if 'pinned' in site['tags'] and not 'partitionNumber' in site]
for site in pins_bad:
    site.pop('objectId')
json.dump(dd, open("session-store-1", 'w'))

I don't know what the syncing feature has to do with this. For testing I've used a site that I had never visited before, so it seems impossible that one of the other instance that I sync with are causing problems for the specific site.

@hugobuddel
Copy link
Contributor Author

@ayumi or @diracdeltas , could one of you perhaps take a look at this issue about disappearing pins?

Most of the recent commits related to syncing and objectIds are yours, so you can probably figure out what is going on and how to solve it properly. For now the hack above seems to work well enough though, so it is not urgent. Let me know if you'd need more information.

@bsclifton
Copy link
Member

cc: @petemill

@hugobuddel
Copy link
Contributor Author

Another thing that I should note is that this time the issue appeared after a pinned tab (gmail) magically disappeared. After that, I couldn't add it back, but also not create any other pinned tab. The new ones all disappeared after a 2 restarts (the first restart clears them from the session I believe).

So the initial corruption of the session (original tab disappearance) might have a different cause, with the subsequent inability to pin new tabs being a secondary effect. The primary problem of 'stable' pinned tabs disappearing is quite hard to reproduce. It seems to always be gmail for me though, the most active of my pinned tabs.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants