amark / gun

An open source cybersecurity protocol for syncing decentralized graph data.
https://gun.eco/docs
Other
18.12k stars 1.17k forks source link

I have to refresh one browser to trigger all browser to update #392

Open ed-ilyin opened 7 years ago

ed-ilyin commented 7 years ago

when I do many updates like gun.get('public').get('depth').get('kraken').get('DASHDKK').put({ask:7.32,bid:8.33}) some records do not call callbacks in browsers: gun.get('public').get('depth').get('kraken').map().on((data, key) => console.log(key,data)) But when I click refresh one browser, all updates become distributed. Demo video: https://youtu.be/EqcYshG3vkI

amark commented 7 years ago

Thanks for the video.

So the problem is, on first load... one of the values doesn't sync. But THEN on a reload, it does sync right?

In the video, to me it looks like the same record (same ID?) is getting UPDATED on a refresh. Is this not true?

We'll get this fixed, seems like it would make for a good PANIC test. I have a test already that verifies all records map in a table get synced, but this might be an edge case I haven't found yet, and need to make sure it gets fixed! Thanks again, any more info would be great.

ed-ilyin commented 7 years ago

It happens almost every time I run script to put new values to existing records, some random values doesn't update without browser refresh. When I refresh one of browsers (any), all including refreshed browser itself update not yet updated records. Item with ID XMLNXETH on video updates only after refresh of on of browsers. How could I help with that issue?

amark commented 7 years ago

@ed-ilyin thanks for the offer! I'm still just trying to make sure I understand the problem correctly. Occasionally when you run put the update doesn't sync right away, it only happens on reload. Right?

IF you are able to jump in and help/replicate it, creating a PANIC test would be best - there is a well documented example here: https://github.com/amark/gun/blob/master/test/panic/load.js , however the test would look probably more similar to one of the other ones (they aren't commented). Let me know if you can help out on this or not. Thanks!

ed-ilyin commented 7 years ago

PANIC is to hard for me. May be I can provide just some example code I have?

sothix commented 7 years ago

I would like to second this.

Just using the examples/vue/todo.html I start a common server and both will sync. I kill the server add a task "a" to the first browser, add a task "b" to the second browser, fire up the server and only one browser will sync. If i refresh either of the browsers all the tasks will sync.

I used Firefox and Chrome.

Video here: https://youtu.be/xIR0HToI710

also could be a repeat of issue #259

amark commented 7 years ago

@ed-ilyin yes, if you can send me some sample/example code, that would be great. Thank you! Sorry it has taken me so long to reply, I've been swamped with a lot of business stuff.

@sothix fantastic illustration of the problem. THANK YOU, this will make it be much easier for me to track down, debug/fix. And yes, looks like it is most definitely related to #259 . I find it very odd that 1 browser DOES live update after the server comes back online, but the other one does NOT (even though it is running the same code).

This is a super bad bug. I probably will not have this fixed in the next release, but I'll prioritize it after that.

@sothix I'd love to hear more about what you are working on, in the meanwhile?

sothix commented 7 years ago

If i do those operations quickly both will sync, other times it will be in reverse where firefox will sync and chrome doesn't. Negotiation bug perhaps?

Anyway I'm a dog kennel owner and have written some in house management software ages ago using jquery, php and mariadb galera cluster. I used the cluster because I had a hardware failure and had to resort to a week old backup and wanted multiple databases to be kept up to date even if one server went down. The cluster also sucks because it will go down usually when I'm away and things will get out of sync or just refuse to work. Even a simple power failure can kill the cluster. I found gun listening to javascript jabber podcast and it looks like it will solve these problems. I find it fun to tinker and am looking to keep learning so I don't rust out so I'm doing a complete rewrite using vue + gun. I would like to add external access through AWS so will have to look at authentication in the future. Firebase's authentication looks neat so it may be a good one to copy for gun. Anyway your work is awesome and I'm looking forward to future releases.