Stuck at commit?
See original GitHub issueSorry I can’t figure out a reproducible example for this. But in a real world project, whenever 100 keys were added, reopen the Sqlitedict will stuck at the commit below.
logger.info("opening Sqlite table %r in %s" % (tablename, filename))
MAKE_TABLE = 'CREATE TABLE IF NOT EXISTS "%s" (key TEXT PRIMARY KEY, value BLOB)' % self.tablename
logger.info(MAKE_TABLE)
self.conn = self._new_conn()
logger.info("execute")
self.conn.execute(MAKE_TABLE)
logger.info("commit")
self.conn.commit()
I tried to reproduce this in an isolated example, but the problem doesn’t happen in this example. But I attached it below anyway. My values contains nested dictionaries and about 30 fields, about 180K on disk. I switched to shelve
because I have no idea what could be the cause. JFYI.
import sqlitedict
def ss():
return sqlitedict.SqliteDict("cache.sqlite", autocommit=True)
for i in range(3000000):
key = f"key-{i}"
print(key)
with ss() as sd:
sd[key] = dict(foo=1, nested=dict(bar=1))
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Stuck in a git commit - Stack Overflow
Stuck in a git commit · 1. Could you run 'git status' and show us the output? · 1. If the commit succeeded...
Read more >Beginner stuck in a commit - Google Groups
I finally just closed the bash and opened a new bash and tried to commit and got all kinds of error messages with...
Read more >'Commit area' stuck after one commit · Issue #4359 - GitHub
I have the message "Committing to %branch%" and the commit message and description are not empty when my commit is done, I have...
Read more >Stuck at Commit to repository - Mendix Forum
I have the problem that Studio Pro hangs at the step Commit to repository (see screenshot). The internet connection is stable and the ......
Read more >Github Pull Requests: file tree on Commits pane gets stuck in ...
on opened New Pull Request tab go to Commits tab; select second commit in the list. Current behavior: the Loading spinner occurs and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Ha, I know what’s going on. The problematic call was inside a
__del__
function upon program exit. I guess the some sqlitedict internal stuff has been disposed at that time?I was trying to save unsaved content in the
__del__
function. Maybe not a good place to do that.@chengguangnan more safe way for “free” some resources is context manager, like
also, good post about it - https://eli.thegreenplace.net/2009/06/12/safely-using-destructors-in-python/