-
Notifications
You must be signed in to change notification settings - Fork 372
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
Database locked after update 2.19 > 2.20 #3244
Comments
Thanks for the report, I'll try to reproduce this. The only recent change that comes to mind was transactions obtaining the lock before invoking the callback (previously the first statement in the |
There are no nested transactions, from stepping through the debugger, it looks like this:
|
I can't reproduce the problem like this, which sounds like what you're describing right? db.transaction(() async {
print('First transaction: Start');
await db.customSelect('SELECT 1').get();
for (var i = 0; i < 5; i++) {
print('First transaction, query $i');
await db.customSelect('SELECT 1').get();
print('First transaction, query $i end');
await Future.delayed(const Duration(seconds: 1));
}
});
await Future.delayed(const Duration(seconds: 1));
db.transaction(() async {
print('Second transaction: Start');
await db.customSelect('SELECT 1').get();
print('Second transaction: Done');
}); However, if I spawn another nested transaction in the first one, I can reproduce the deadlock: db.transaction(() async {
print('First transaction: Start');
await db.customSelect('SELECT 1').get();
for (var i = 0; i < 5; i++) {
print('First transaction, query $i');
await db.customSelect('SELECT 1').get();
print('First transaction, query $i end');
await Future.delayed(const Duration(seconds: 1));
}
print('trying nested');
await db.transaction(() async {
print('nested'); // never called
});
});
await Future.delayed(const Duration(seconds: 1));
db.transaction(() async {
print('Second transaction: Start');
await db.customSelect('SELECT 1').get();
print('Second transaction: Done');
}); I'll fix that, maybe that also solves your issue. |
Can you try checking whether f781aa3 fixes this issue? |
Yes that fixes it! |
Thanks for the confirmation, I've released a patch release containing the fix as |
Hi @simolus3, after updating from 2.19 to 2.20 my gets stuck on parallel write operations.
I am using
Future.wait
to start parallel downloads of data which afterwards gets inserted into the database via separate parallel transactions. This completely locks the database since 2.20.0.The transaction never complete, after a hot restart there are database locked errors.
Same thing happens in release builds.
I am using a drift isolate setup that has worked perfectly for a some time now.
Do you have an idea on what could cause this?
The text was updated successfully, but these errors were encountered: