dwavesystems / dwavesystems/dwave-cloud-client
Regions cache (sqlite3) access fails from a forked process
- Dominant language
- Python
- Stars
- 63
- Forks
- 44
- Avg merge
- 13h 45m
- Merged PRs (30d)
- 1
Description
When accessing regions cache (`dwave.cloud.regions.get_regions`) from multiple processes created by forking, the following error has been reported:
```
File "/home/wls/.conda/.../lib/python3.9/site-packages/dwave/system/samplers/dwave_sampler.py", line 30, in
from dwave.cloud.client import Client
File "/home/wls/.conda/.../lib/python3.9/site-packages/dwave/cloud/__init__.py", line 19, in
from dwave.cloud.client import Client
File "/home/wls/.conda/.../lib/python3.9/site-packages/dwave/cloud/client/__init__.py", line 17, in
from dwave.cloud.client.base import Client
File "/home/wls/.conda/.../lib/python3.9/site-packages/dwave/cloud/client/base.py", line 72, in
from dwave.cloud.regions import get_regions, resolve_endpoints
File "/home/wls/.conda/.../lib/python3.9/site-packages/dwave/cloud/regions.py", line 37, in
@cached.ondisk(maxage=_REGIONS_CACHE_MAXAGE, key='cache_key', bucket='regions')
File "/home/wls/.conda/.../lib/python3.9/site-packages/dwave/cloud/utils/decorators.py", line 291, in ondisk
cache = diskcache.Cache(disk=diskcache.JSONDisk, directory=directory,
File "/home/wls/.conda/.../lib/python3.9/site-packages/diskcache/core.py", line 478, in __init__
self.reset(key, value, update=False)
File "/home/wls/.conda/.../lib/python3.9/site-packages/diskcache/core.py", line 2431, in reset
((old_value,),) = sql(
sqlite3.OperationalError: locking protocol
```
Possible causes:
- "Under Unix, you should not carry an open SQLite database across a fork() system call into the child process." (source [here](https://www.sqlite.org/faq.html#q6))
- Windows accessing sqlite3 file over NFS (see [here](https://www.sqlite.org/faq.html#q5))
- DiskCache accessing a [file on WSL1](https://github.com/grantjenks/python-diskcache/issues/172)
- [this](https://stackoverflow.com/questions/46331178/) SO answer
See also: #621.
Possibly related: https://github.com/grantjenks/python-diskcache/issues/325, https://github.com/grantjenks/python-diskcache/issues/172.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.