piskvorky / sqlitedict

Persistent dict, backed by sqlite3 and pickle, multithread-safe.
Apache License 2.0
1.17k stars 131 forks source link

Database connection stay in memory while killing the process (windows) #160

Open instasck opened 2 years ago

instasck commented 2 years ago

please check singlton https://github.com/pycontribs/tendo/issues/55

So sending a kill signal to process with sqlitedict will not close (not all the time) the db connection and the proccess can hang forever. Causing the "singlton" lock file to no be removed.

What can cause it ?

instasck commented 1 year ago

@mpenkov do you know if I can close connection to DB after commit, and open when write ? since connection is open all the time - the file is locked while proccess on

mpenkov commented 1 year ago

I don't think so, but why not try it and see?

instasck commented 1 year ago

image This is the locking I use. With sqlitedict I get the process stuck in memmory for up to 10 minute. Without sqlitedict it removing this file immediatly: image So if no fix fore that I wil lswitch to peewee ...

I also do for table in self.list_of_tables_user_data: self.user_data[table].close()

at the end of my process

instasck commented 1 year ago

@mpenkov image This is an example for the issue. all those db are file locked in, while process should been exit already. How can I close the connection with auto-commit ? I am also useing to peewee and sqlite3 and I dont see that happens.