question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DataStore would not attempt to re-establish subscriptions when subscription timeout or handshake error occured

See original GitHub issue

Describe the bug Subscriptions with PubSub in DataStore can be very fragile and would not re-attempt to re-estalish itself when an internet disconnection happen over a short period of time. Network drops are common and therefore DataStore’s subscriptions needs the resilience to recover from such scenario. After the merge of PR #6366, DataStore would only re-estalish the subscriptions in the case of Connection closed and Timeout disconnect. However, if there is a failure when conducting a handshake or when the client didnt receive start_ack from server, DataStore would not do anything. Do that note that, on React Native, NetInfo is unable to detect a transient network drop has occured. Hence, it will tell DataStore that the client is online throughout despite a network drop.

I have highlighted the failure point in red which DataStore subscriptions does not recover. image

In purple, currently the client will only know that the websocket has broken off after 5 minutes when it did not receive KA from the server. In my opinion, 5 minutes is too long for PubSub to detect Timeout disconnect has happened. We would lose all the data that happened during this period, it simply doesn’t cut for our project. Perhaps we can lower this down to a minute and half?

To Reproduce Steps to reproduce the behavior:

  1. iPad > Developer setting > Network Link Conditioner > Enable Bad network.
  2. Leave the app open for few hours and check back every 1 hour to see whether the subscription remains alive or not.

This can be tricky to reproduce therefore you need to have the patience.

Expected behavior DataStore subscriptions should recover or at least re-estalish itself when handshake error or subscription timeout has occured. **I’ve made some changes to force DataStore to re-establish the subscriptions when subscription timeout has occured. However, if we would constantly re-establish the subsciptions on the same websocket over and over within a short period, the client would easily hit Max subscriptions error. I don’t know what else I can do apart from this.

What is Configured?

Environment
  System:
    OS: macOS 10.15.5
    CPU: (4) x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
    Memory: 179.66 MB / 8.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 14.3.0 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.4 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Browsers:
    Chrome: 84.0.4147.105
    Safari: 13.1.1
  npmGlobalPackages:
    @aws-amplify/cli: 4.22.0
    ios-deploy: 1.10.0
    npm: 6.14.4
    react-native-cli: 2.0.1

Smartphone (please complete the following information):

  • Device: iPad
  • OS: iOS 13
  • React Native

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:33 (20 by maintainers)

github_iconTop GitHub Comments

4reactions
nubprocommented, Feb 10, 2022

Hey sorry everyone, I’m closing this issue as it has become cluttered and I could not provide clear reproduction steps despite listing the flaws it has in words.

I have given up on DataStore and I wholeheartledly cannot vouch to use it on production due to the number of criticial bugs it still has and its architecture that I cant reason with.

You should file a new issue if you are still facing the same problem I had in the past.

4reactions
imobycommented, Feb 25, 2021

Just wanted to reach out and see if there is any update on this. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Encountering an An error occurred during communication ...
Restart Access Server to ensure there are no users logged in. · Click Access Manager > Datastore Management. · Right-click the datastore and...
Read more >
Unable to deploy OVF using vSphere Client in vCenter Server ...
This issue occurs when the OVF deployment process is unable to connect to the proxy server with the error: Transfer failed: Invalid response ......
Read more >
Shared disk on Nimble for ESXi - HPE Community
So I've set up a vSphere HA with two hosts, but it needs shared storage. Done the VMWare integration, iSCSI connections work, port...
Read more >
Troubleshoot self-hosted integration runtime - Azure
Learn how to troubleshoot self-hosted integration runtime issues in Azure Data Factory and Azure Synapse Analytics pipelines.
Read more >
What happens in a TLS handshake? | SSL ... - Cloudflare
A TLS handshake enables clients and servers to establish a secure ... TLS handshakes occur after a TCP connection has been opened via...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found