Thanks to visit codestin.com
Credit goes to github.com

Skip to content

sqlite3.OperationalError database or disk is full on a new directory #349

@AjinkyaGawali

Description

@AjinkyaGawali

I am running diskcache in docker to maintain cache between multiple dask workers.

In the beginning of the execution I remove the directory (cleaning) and then create new one (fresh start)

shutil.rmtree(self._cache_directory)
os.makedirs(self._cache_directory, exist_ok=True)

I have logs to verify that directory was indeed deleted and created anew.

Immediately after this run diskcache.Cache(directory)

Expected Behavior

The cache should initialize successfully on the freshly created directory.

Actual Behavior

Intermittently receive a SQLite "database or disk is full" error during initialization:

 "exception": {
        "args": [
            "database or disk is full"
        ],
        "class": "sqlite3.OperationalError",
        "source": [
            {
                "file": "",
                "function": "set_contract_path_cache",
                "line": 148,
                "text": "_CACHE = diskcache.Cache(directory)"
            },
            {
                "file": "",
                "function": "__init__",
                "line": 509,
                "text": "self.reset(key, value, update=False)"
            },
            {
                "file": "",
                "function": "reset",
                "line": 2467,
                "text": "sql('PRAGMA %s = %s' % (pragma, value)).fetchall()"
            },
            {
                "file": "",
                "function": "execute",
                "line": 32,
                "text": "return self.cursor().execute(*args, **kwargs)"
            },

        ]```

I have checked, there is more than enough disk space free. I am confused why would I see this error on a empty directory.


### Environment

- diskcache version: 4.1.0
- Python version: 3.9
- Operating system: Linux (in Docker container)
- Docker: Yes, running multiple dask workers sharing the same cache directory

### Additional Context

- The error is intermittent and doesn't happen every time
- I've verified there is plenty of disk space available
- The directory is freshly created before initializing the cache
- The error happens during the PRAGMA statement execution in the `reset` method


Any guidance on how to resolve or work around this issue would be greatly appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions