Relay peer crash breaks all browser clients until they refresh the page
TL;DR: 2 clients connect to a relay peer. They subscribe to data using gun.on(), and everything works fine. However, if the relay peer crashes and comes back, clients do not resume receiving updates and must refresh the page to resolve the issue.
Chat from Discord:
Joncom:
ClientAandClientBare both connected toPeerServer1, the only peer server.- Both clients are listening to changes on object
foolike so:let callback = function(data) { console.log(data); }; gun.get('foo').on(callback);PeerServer1goes offline, and clients cannot communicateClientAwrites some offline data tofoolike so:gun.get('foo').put({a: 1});callbackfires onClientAbecause subscribed tofooClientBwrites some offline data tofoolike so:gun.get('foo').put({b: 1});callbackfires onClientBbecause subscribed tofooPeerServer1comes back online and both peers connect to it
Question: Should
callbackfire again onClientAas it receives the offline update put byClientB, and vice versa?
I would expect the data from ClientA to sync over to ClientB (and vice versa) and trigger the on callback to fire, when the clients reconnect to the peer server. However, in practice, despite reconnecting to the peer server, clients don't receive updates from each other, and a refresh is needed before all updates show up on both clients. :(
Mark Nadal:
Yes Your 1 ~ 8 is exactly what the PANIC holy-grail test does/checks, yes you should get called with those offline updates. If you're having to refresh, then this is a regression/bug.
Steps to reproduce:
- Clone Gun repo
cd test/panic/mocha holy-grail.js- The test will not complete (hangs on "Browsers re-initialized gun!")
Source: amark/gun