You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, first off, thanks for this project, it's very cool. I have noticed an issue with reads/writes to the config file in multi-threaded situations though.
save_config appears to always get called regardless of the overwrite_config value, as far as I can tell it gets called everytime the config is loaded. Because the issue is sporadic it's difficult to reproduce with an example but the symptoms are an error message like this:
File "/home/vagrant/.pyvenv/rcvenv/src/blitzdb-master/blitzdb/backends/file/backend.py", line 111, in __init__
self.load_config(config, overwrite_config)
File "/home/vagrant/.pyvenv/rcvenv/src/blitzdb-master/blitzdb/backends/file/backend.py", line 285, in load_config
self._config = JsonSerializer.deserialize(config_file.read())
File "/home/vagrant/.pyvenv/rcvenv/src/blitzdb-master/blitzdb/backends/file/serializers.py", line 33, in deserialize
return json.loads(data.decode('utf-8'))
File "/usr/lib/python3.4/json/__init__.py", line 318, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.4/json/decoder.py", line 343, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.4/json/decoder.py", line 361, in raw_decode
raise ValueError(errmsg("Expecting value", s, err.value)) from None
ValueError: Expecting value: line 1 column 1 (char 0)
I'm pretty certain that it is due to the file being written and read at the same time. It should be a simple fix, so if I can, I'll issue a PR in the next few days if I can find the time.
The text was updated successfully, but these errors were encountered:
Hi, first off, thanks for this project, it's very cool. I have noticed an issue with reads/writes to the config file in multi-threaded situations though.
If you take a look at line 299 here https://github.com/adewes/blitzdb/blob/master/blitzdb/backends/file/backend.py#L299
save_config appears to always get called regardless of the overwrite_config value, as far as I can tell it gets called everytime the config is loaded. Because the issue is sporadic it's difficult to reproduce with an example but the symptoms are an error message like this:
I'm pretty certain that it is due to the file being written and read at the same time. It should be a simple fix, so if I can, I'll issue a PR in the next few days if I can find the time.
The text was updated successfully, but these errors were encountered: