Skip to content

DataStore sync errors and sync delay on iOS on version 2.4.0 #5360

@filipesbragio

Description

@filipesbragio

Description

Likely related to #5217.

Using Amplify version 2.4.0 on iOS. Turning off connectivity(wifi/mobile) will cause a SocketException and cause data sync to stop. It seems like the retries use exponential backoff, every time it fails it takes around twice as much until it tries again. DataStore will only re-establish data synchronization when this retry is attempted and mobile has connectivity again, it does not try to connect when connectivity is re-established.

This causes scenarios such as the following: If the user is offline and several retries occur then the next retry can be dozens of minutes in the future. If the user becomes online the data will not be synced until that retry is executed. If the next retry is in 20 minutes and the mobile connects to the server, he can use the app for up to 19 minutes and no data will be synced. The server will only receive that users data when he re-opens the app with connectivity or when a retry runs while he is online.

Minimizing the app does not change this, only closing and reopening the app.

This bug only happens on iOS. We didn't have any errors on Android and the sync was done as soon as connectivity was re-established.

Here is the error message, stack trace and the periods in which the app retried.

SocketException : Failed host lookup: 'xxxxxxxxxxxxxxxxxxxxxx.appsync-realtime-api.us-east-2.amazonaws.com'

OS Error: nodename nor servname provided, or not known, errno = 8

0 _NativeSocket.startConnect (dart:io-patch/socket_patch.dart:721:35)
1 _RawSocket.startConnect (dart:io-patch/socket_patch.dart:1914:26)
2 RawSocket.startConnect (dart:io-patch/socket_patch.dart:27:23)
3 RawSecureSocket.startConnect (dart:io/secure_socket.dart:299:22)
4 SecureSocket.startConnect (dart:io/secure_socket.dart:77:28)
5 _ConnectionTarget.connect (dart:_http/http_impl.dart:2480:26)
6 _HttpClient._getConnection.connect (dart:_http/http_impl.dart:2923:12)
7 _HttpClient._getConnection (dart:_http/http_impl.dart:2928:12)
8 _HttpClient._openUrl (dart:_http/http_impl.dart:2783:12)
9 _HttpClient.openUrl (dart:_http/http_impl.dart:2620:7)
10 _WebSocketImpl.connect (dart:_http/websocket_impl.dart:1021:42)
11 WebSocket.connect (dart:_http/websocket.dart:320:22)
12 new IOWebSocketChannel.connect (package:web_socket_channel/io.dart:81:28)
13 connect (package:web_socket_channel/src/_connect_io.dart:15:24)
14 new WebSocketChannel.connect (package:web_socket_channel/src/channel.dart:144:16)
15 AmplifyWebSocketService._init (package:amplify_api_dart/src/graphql/web_socket/services/web_socket_service.dart:81:40)

These are the times when each retry was executed, I stopped registering them after the 27 minute delay.
13:42:41
13:42:42
13:42:46
13:42:52
13:43:05
13:43:31
13:44:22
13:46:05
13:49:30
13:56:19
14:10:00
14:37:19

Categories

  • Analytics
  • API (REST)
  • API (GraphQL)
  • Auth
  • Authenticator
  • DataStore
  • Notifications (Push)
  • Storage

Steps to Reproduce

See description

Screenshots

No response

Platforms

  • iOS
  • Android
  • Web
  • macOS
  • Windows
  • Linux

Flutter Version

3.22.3

Amplify Flutter Version

2.4.0

Deployment Method

Amplify CLI

Schema

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is not working; the issue has reproducible steps and has been reproduceddatastoreIssues related to the DataStore CategoryiOSIssues specific to the iOS Platform

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions