Closed fingertap closed 6 years ago
you did not share the error and backtrace.
are you sure you only use ONE process, as LevelDB prescribes?
The error message is shown as follows:
Traceback (most recent call last):
File "test.py", line 6, in <module>
db_pool = plyvel.DB("./database/Users", create_if_missing=True)
File "plyvel/_plyvel.pyx", line 247, in plyvel._plyvel.DB.__init__
File "plyvel/_plyvel.pyx", line 88, in plyvel._plyvel.raise_for_status
plyvel._plyvel.IOError: b'IO error: lock ./database/Users/LOCK: Resource temporarily unavailable'
I guess the error may be the conflict where flask
wants to watch the change in the directory and plyvel
wants to write the database files.
i think you're using multiple processes somehow, which leveldb cannot do. (not a plyvel limitation).
how do you run it?
Just install the flask
and plyvel
and run the sample code like python test.py
.
There must be another process when the framework "watches" the directory.
I don't know exactly why multiple processes raises such error, but I think the issue here can save others' time.
the debug=True
makes flask use werkzeug's autoreloader, which forks subprocesses. as i said before:
i think you're using multiple processes somehow, which leveldb cannot do. (not a plyvel limitation).
so that explains the errors you're seeing.
the module-level database opening is not ok here. you'd be better off using a different pattern, such as those in the flask docs: http://flask.pocoo.org/docs/1.0/tutorial/database/
The code is simple:
If you add
debug=True
then the error is raised. Otherwise it's fine. But I think I should post this issue here so as you know.