You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes the (await WasmDatabase.open) never completes for our web app and just gets stuck on await. I don't know what could cause that as no errors were reported at that time. So, to catch such issues we added a timeout and from that, we were able to see it happening.
Here is the code I'm using:
/// Obtains a database connection for running drift on the web.DatabaseConnectionconnect(DbType dbType) {
returnDatabaseConnection.delayed(
Future(() async {
try {
final db =awaitWasmDatabase.open(
databaseName: dbType.name,
sqlite3Uri:Uri.parse('sqlite3.wasm'),
driftWorkerUri:Uri.parse('drift_worker.js'),
).timeout(
constDuration(seconds:15),
onTimeout: () {
// Log error for stuck connectiondebugPrint('Database connection timed out for ${dbType.name}.');
throwTimeoutException('Database connection stuck.');
},
);
if (db.missingFeatures.isNotEmpty) {
debugPrint('Using ${db.chosenImplementation} due to unsupported ''browser features: ${db.missingFeatures}');
}
return db.resolvedExecutor;
} catch (e) {
// Log error and rethrow for further handlingdebugPrint('Error while connecting to database: $e');
throwException('Failed to connect to database: $e');
}
}),
);
}
After the browser restarts it starts working again but cannot be fixed by a refresh on the web app. So, Do you have any idea what could have caused this?
Probable reproducible step: Trying multiple hot reloads on the web. (I was able to see it in debug mode also doing that) Dependencies\Files:
Thanks for the report! I'll try to come up with a version of the worker/drift that logs interactions so that we can trace this down more easily.
Trying multiple hot reloads on the web. (I was able to see it in debug mode also doing that)
Did you only hit this in debug mode or also in release builds? Do you have a distribution of browsers where this happens (just wondering if it happens more often on some browsers/devices than others).
Thanks for the report! I'll try to come up with a version of the worker/drift that logs interactions so that we can trace this down more easily.
Yes, agreed. Let me know once you can give that.
Did you only hit this in debug mode or also in release builds? Do you have a distribution of browsers where this happens (just wondering if it happens more often on some browsers/devices than others).
I have hit this in both debug and deployed profile builds. A profile build would work as a release build in this case, right? I don't have "distribution of browsers" data, but it happened on the Edge in debug and Chrome in the deployed profile build.
Describe the bug
Sometimes the (await WasmDatabase.open) never completes for our web app and just gets stuck on await. I don't know what could cause that as no errors were reported at that time. So, to catch such issues we added a timeout and from that, we were able to see it happening.
Here is the code I'm using:
After the browser restarts it starts working again but cannot be fixed by a refresh on the web app. So, Do you have any idea what could have caused this?
Probable reproducible step: Trying multiple hot reloads on the web. (I was able to see it in debug mode also doing that)
Dependencies\Files:
sqlite3.wasm (2.4.6)
drift_worker.js (2.20.1)
Let me know if I can help you in any way to find the cause of this issue.
The text was updated successfully, but these errors were encountered: