Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Holochain work offline again #2119

Merged
merged 6 commits into from Feb 29, 2020
Merged

Make Holochain work offline again #2119

merged 6 commits into from Feb 29, 2020

Conversation

@lucksus
Copy link
Member

lucksus commented Feb 18, 2020

PR summary

Treat disconnected state the same as full-sync DHT

testing/benchmarking notes

( if any manual testing or benchmarking was/should be done, add notes and/or screenshots here )

followups

( any new tickets/concerns that were discovered or created during this work but aren't in scope for review here )

changelog

  • if this is a code change that effects some consumer (e.g. zome developers) of holochain core, then it has been added to our between-release changelog with the format
- summary of change [PR#1234](https://github.com/holochain/holochain-rust/pull/1234)

documentation

Treat disconnected state the same as full-sync DHT
@zippy zippy requested a review from thedavidmeister Feb 18, 2020
fn is_autonomous_node(&mut self) -> bool {
self.is_full_sync_DHT || !self.connection_ready()
}
Comment on lines +537 to +539

This comment has been minimized.

Copy link
@maackle

maackle Feb 21, 2020

Member

I wonder about race conditions.

  • connection_ready() could flip in between when it is checked and when the message is actually handled
  • there is a delay between send_wire_message putting a message on the queue and when it actually gets sent

if these are valid concerns, i wonder if there is a unified way to deal with the online and the offline case that doesn't require a condition?

This comment has been minimized.

Copy link
@thedavidmeister

thedavidmeister Feb 23, 2020

Contributor

@maackle if valid concerns, would they also apply to the existing code in the boundary between full sync and sharded?

This comment has been minimized.

Copy link
@lucksus

lucksus Feb 24, 2020

Author Member

Well, currently, if you were connected and then you loose connection, it will just stop working.

With these changes, a query that is send just when loosing connection might not work, but if the user continues to use a hApp UI which then makes the DNA issue more queries, those would then get routed back to the local instance which can then respond.

If the node then reconnects to sim2h again, the server will request authoring and gossip lists and make sure that new data gets shared in the DHT. So, it should be all fine.. But we also should add tests for all of this. That would have prevented the regression for this is a fix.

Copy link
Contributor

thedavidmeister left a comment

i approve this provisionally (if we can get some tests that would be great)

i agree that what @maackle was pointing to re: actions being safe under various network states and even transitions between network states happening concurrently to some action, is really important, seems like a followup though

the current state of things is:

0 peers (offline) = shard
1-sharding peers = full sync
sharding+ peers = shard

this doesn't make sense to me at a really high level, it completely breaks hApps when they lose connection to the network :(

it is compounded by the lack of wss support on sim2h currently, if anyone wants to test code that is supposed to run on a private network they can't use ws and they can't run the happ offline, so users doing testing need to spin up their own sim2h locally which is clunky :(

i think the intent of the "full sync below this number of peers" logic must include zero peers also, given that full sync already works offline (even if technically it doesn't work during the moment we transition to/from offline) :)

lucksus and others added 3 commits Feb 28, 2020
@thedavidmeister thedavidmeister merged commit 47610af into develop Feb 29, 2020
6 checks passed
6 checks passed
ci/circleci: app-spec-tests-sim2h Your tests passed on CircleCI!
Details
ci/circleci: build Your tests passed on CircleCI!
Details
ci/circleci: cli-tests Your tests passed on CircleCI!
Details
ci/circleci: fmt Your tests passed on CircleCI!
Details
ci/circleci: stress-tests-sim2h Your tests passed on CircleCI!
Details
ci/circleci: wasm-conductor-tests Your tests passed on CircleCI!
Details
@neonphog neonphog deleted the fix-offline-usage branch Mar 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.