SQLite Forum

Help to solve database locked
Login
Hi there,

I'm using Sqlite3(sqlcipher) with flutter ffi, the database get locked after application hot-restart, ie. the connection is not properly closed (see [Database is locked after hot restart and sometimes in production](https://github.com/simolus3/moor/issues/835) for more details).

However, `pragma lock_status` actually shows that database is unlocked,  

```
sqlite> pragma lock_status;
main|unlocked
temp|closed
sqlite> select * from note;
1|1605168690261|1605168690261|111|111
2|1605168692461|1605168692461|2222|2222
3|1605168695966|1605168858667|33333xxx2222|33333xxx2222
sqlite> delete from note where id=1;
Error: database is locked
sqlite> pragma lock_status;
main|unlocked
temp|closed
sqlite> pragma integrity_check;
ok
sqlite>
```

Is this by design or is a bug? How can I figure out which connection locked the database?

Thanks!