question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Sorry 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:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
chengguangnancommented, Oct 18, 2018

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.

1reaction
menshikh-ivcommented, Oct 18, 2018

@chengguangnan more safe way for “free” some resources is context manager, like

with MyResource() as resource:
    # make what's needed

also, good post about it - https://eli.thegreenplace.net/2009/06/12/safely-using-destructors-in-python/

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found