react-native-background-geolocation: Plugin does not retry/recover after network or connectivity error

Your Environment

  • Plugin version: 3.3.0 and 3.3.2
  • Platform: Both iOS and Android
  • OS version: iOS 13, android 9
  • Device manufacturer / model: various
  • React Native version: 0.61.5
  • Plugin config: Will include in debug log later

Description

One of our testers is in a rural location and often enters cellular cells where there is poor reception. A few times a day, the phone’s cellular data connection will have trouble and this plugin (ie. ‘RNBGL’) will be unable to post location data to our server.

We have variously seen these types of error messages in the debug log:

⚠️ server.example.com is not responding. Will try again after 10 records. ⚠️ Response: 0, Unable to resolve host “server.example.com”: No address associated with hostname ⚠️ Response: 0, Failed to connect to server.example.com/n.n.n.n:443

These are legitimate errors and we accept that they will occur. Up to this point, it’s all fine and good.

However, after one of these errors occurs, and the phone enters an area with good reception (or wifi), we expect the plugin to detect this and start uploading data again. However, this is not the case. We often have to restart/open/foreground our app and then the plugin will start emitting again.

So a sequence like this happens:

  1. Tester’s phone has network connectivity issues. Plugin stops uploading location.
  2. Error messages are seen in the log.
  3. Tester goes to a new area with good reception. Alternatively, tester goes home and connects to home wifi.
  4. A variable amount of time elapses.
  5. Tester opens the app. Plugin resumes uploading location again.

Expected: Soon after step 3 occurs, the plugin should resume uploading. In other words, step 4 only lasts for a short amount of time.

Observed: Step 4 lasts until the tester opens the app. Sometimes this can be 10-20 minutes or more. In one instance, it lasted for about 90 minutes.

Expected Behavior

See above

Actual Behavior

See above

Discussion

Most of the time, the plugin works as expected. So if this issue doesn’t occur, then all is good.

However, when one of the above-mentioned error messages occurs, the plugin stops uploading.

Also, when this happens, I can see in the log that the plugin is still acquiring locations and saving them in the offline database for uploading later. So the plugin is still operating and ‘doing stuff’, just that, for some reason, it doesn’t upload to the server.

When connectivity resumes, the plugin successfully uploads all the ‘offline’ data points (we have maxRecordsToPersist of 20).

Debug logs

Will email separately if needed later.

I’m going to test out a debug version of our app with some extra connectivity-related debugging. Hopefully that will produce a more useful debug log.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (5 by maintainers)

Most upvoted comments

Preliminary results of testing: The fix is good. I can see in the log that the plugin continues to retry once every 10-30 seconds.

We’ll continue to test for another day or two. If you don’t hear anything from me, then presume no news is good news.