-
Notifications
You must be signed in to change notification settings - Fork 251
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
Freeze on offline WiFi with Selective Sync: Query and Save calls get stuck in await #5662
Comments
Hi @giulitu95, thanks for taking the time to open this issue. We will investigate this issue and provide an update when we can. |
Hello @giulitu95, I've been unable to reproduce this issue. Are you using a physical device to get this issue? Also, are the cyclical calls to save being made programmatically or by repeated user input? |
Hi @ekjotmultani, I'm using a physical device (Samsung Galaxy S22). I have been able to reproduce the problem on a simple app calling the Amplify.DataStore.save() method in an infinite loop programmatically. final mv = MachineVersion(machineSerialNumber: 23);
while (true) {
print("-- Saving");
try {
await Amplify.DataStore.save(mv);
} catch (e) {
print("-- Error: $e");
}
print("-- Saved");;
} After some cycles, the program gets stucks printing as last message "--Saving" and the execution never enters in the catch block. This occurs only when the device has not internet connection but is connected to a local WiFi network (without internet connection). final auth = AmplifyAuthCognito();
final api = AmplifyAPI();
final datastore = AmplifyDataStore(
modelProvider: ModelProvider.instance,
options: DataStorePluginOptions(syncExpressions: [
DataStoreSyncExpression(
MachineVersion.classType, () => MachineVersion.ID.eq("test")),
]));
await Amplify.addPlugins([datastore, api, auth]);
await Amplify.configure(amplifyconfig); If I do not specify a DataStoreSyncExpression (removing the entire options attribute), the execution does not stuck. This is the graphQl for the model used as example (but it happens with any models defined in my graphQl): [...]
type MachineVersion @model @auth(
rules: [
{ allow: groups, groups: ["Admins"], operations: [create, read, update, delete]}
{ allow: owner }
]
){
id: ID! @primaryKey
machineSerialNumber: Int!
remoteSoftwareUpdateDate: String
workingData: [WorkingData] @hasMany(fields: ["id"])
diagnosisSession: [DiagnosisSession] @hasMany(fields: ["id"])
machineComponent: [MachineComponent] @hasMany(fields: ["id"])
owner: String @auth(
rules: [
{ allow: groups, groups: ["Admins"], operations: [create, read, update, delete]}
{ allow: owner, operations: [read, delete] }
]
)
}
[...] Note also that whenever Amplify tries to save the model (before it gets stuck), the debug console shows many exceptions as:
Also other exception occurs, let me know if you need the entire detailed debug log |
@giulitu95 thank you for providing these details. we will look into this issue and get back to you with any updates. |
Thank you @NikaHsn. I forgot to mention that the problem is not related only to the save method, but if I alternate save with query methods the execution could get stuck also in the query future. |
@giulitu95 thanks for providing more details on this. we will look into this issue and provide update as we have them. |
@giulitu95 thanks again for the added information! I have been successful in reproducing this issue and we will track it as a bug. I also noticed the massive amounts of other exceptions in the output so we'll investigate that too |
Description
This problem occurs on Android platforms when the device is connected to a wify network without internet connection.
If a selective sync is configured and data are cyclically saved on the datastore, eventually, the execution gets stuck in the save method. My configuration includes Datastore, Api and Auth plugins.
Categories
Steps to Reproduce
await Amplify.Datastore.save(model)
Screenshots
No response
Platforms
Flutter Version
3.24.4
Amplify Flutter Version
2.5.0
Deployment Method
Amplify CLI (Gen 1)
Schema
No response
The text was updated successfully, but these errors were encountered: