{"action":"created","issue":{"url":"https://api.github.com/repos/tejacques/crosstab/issues/44","labels_url":"https://api.github.com/repos/tejacques/crosstab/issues/44/labels{/name}","comments_url":"https://api.github.com/repos/tejacques/crosstab/issues/44/comments","events_url":"https://api.github.com/repos/tejacques/crosstab/issues/44/events","html_url":"https://github.com/tejacques/crosstab/issues/44","id":112828727,"number":44,"title":"No assumed master after tabs refresh","user":{"login":"nevcos","id":656065,"avatar_url":"https://avatars.githubusercontent.com/u/656065?v=3","gravatar_id":"","url":"https://api.github.com/users/nevcos","html_url":"https://github.com/nevcos","followers_url":"https://api.github.com/users/nevcos/followers","following_url":"https://api.github.com/users/nevcos/following{/other_user}","gists_url":"https://api.github.com/users/nevcos/gists{/gist_id}","starred_url":"https://api.github.com/users/nevcos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nevcos/subscriptions","organizations_url":"https://api.github.com/users/nevcos/orgs","repos_url":"https://api.github.com/users/nevcos/repos","events_url":"https://api.github.com/users/nevcos/events{/privacy}","received_events_url":"https://api.github.com/users/nevcos/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2015-10-22T15:29:12Z","updated_at":"2015-10-27T17:39:44Z","closed_at":null,"body":"I've tested reloading 4 tabs at the same time, and in the end I've got the following result:\r\n\r\n1st Tab - 14455266368170676283082\r\n![tab1](https://cloud.githubusercontent.com/assets/656065/10669414/96410ba8-78d8-11e5-9e6b-f7db8bea3e85.png)\r\n\r\n2nd Tab - 14455266379341197551397:\r\n![tab3](https://cloud.githubusercontent.com/assets/656065/10669417/9669c9a8-78d8-11e5-87ed-dd56d998072d.png)\r\n\r\n3rd Tab - 14455266379810761529770:\r\n![tab4](https://cloud.githubusercontent.com/assets/656065/10669416/96667ae6-78d8-11e5-8423-7b1965e79d0f.png)\r\n\r\n4th Tab - 14455266385181543926377:\r\n![tab2](https://cloud.githubusercontent.com/assets/656065/10669415/9657593a-78d8-11e5-8042-b57a4ce57fe2.png)\r\n\r\nSo, every tab thinks that 2nd tab is the master, except the 2nd tab itself and the localStorage.\r\nSo nobody is assuming the master work.\r\n\r\nOn localStorage (crosstab.TABS_KEY) there's only 2 tabs registered:\r\n\r\n```\r\n{\r\n  \"id\": \"14455266368170676283082\",\r\n  \"data\": {\r\n    \"14455266368170676283082\": {\r\n      \"id\": \"14455266368170676283082\",\r\n      \"lastUpdated\": 1445526636819\r\n    },\r\n    \"MASTER_TAB\": {\r\n      \"id\": \"14455266368170676283082\",\r\n      \"lastUpdated\": 1445526636819\r\n    },\r\n    \"14455266379341197551397\": {\r\n      \"id\": \"14455266379341197551397\",\r\n      \"lastUpdated\": 1445526637942\r\n    }\r\n  },\r\n  \"timestamp\": 1445526638301\r\n}\r\n```\r\n\r\nI'm thinking that the problem could be on localStorage concurrency (everyone is writing and just the last one result wins). \r\n\r\nI'm using crosstab version v0.2.11 on Chrome 46."},"comment":{"url":"https://api.github.com/repos/tejacques/crosstab/issues/comments/151582349","html_url":"https://github.com/tejacques/crosstab/issues/44#issuecomment-151582349","issue_url":"https://api.github.com/repos/tejacques/crosstab/issues/44","id":151582349,"user":{"login":"tejacques","id":1389520,"avatar_url":"https://avatars.githubusercontent.com/u/1389520?v=3","gravatar_id":"","url":"https://api.github.com/users/tejacques","html_url":"https://github.com/tejacques","followers_url":"https://api.github.com/users/tejacques/followers","following_url":"https://api.github.com/users/tejacques/following{/other_user}","gists_url":"https://api.github.com/users/tejacques/gists{/gist_id}","starred_url":"https://api.github.com/users/tejacques/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tejacques/subscriptions","organizations_url":"https://api.github.com/users/tejacques/orgs","repos_url":"https://api.github.com/users/tejacques/repos","events_url":"https://api.github.com/users/tejacques/events{/privacy}","received_events_url":"https://api.github.com/users/tejacques/received_events","type":"User","site_admin":false},"created_at":"2015-10-27T17:39:44Z","updated_at":"2015-10-27T17:39:44Z","body":"@tchakabam I mean the fact that this issue exists means there are still issues :), but the general idea of a distributed algorithm without shared state should be more reliable than trying to implement a mutex given the restrictions that `localStorage` has. That was the conclusion I came to and why I am trying to solve it that way. I also wanted to be very careful about latency, as I've mentioned, and concluded that going the locking route simply wasn't viable given those constraints.\r\n\r\nThe tabs do evict stale tabs that have not been updated for `TAB_TIMEOUT` (5s), they heartbeat every `TAB_KEEPALIVE` (3s).\r\n\r\nI do not know why you would be seeing propagation take a long time unless a tab was in a busy/blocking loop which prevented the heartbeat. I'd have to see your code and the issue to say for sure."}}