Flask and Lock error?

109 views
Skip to first unread message

Shuhao

unread,
Feb 21, 2013, 2:05:29 AM2/21/13
to py-le...@googlegroups.com
Hi,

I'm currently using Flask and LevelDB for an application. This application defines a couple of LevelDB instances in a file. When i start the server (test server, werkzeug), it complains that the db is locked (I'm not even using the db for anything yet). However, if the server is already started and it is reloaded, it doesn't complain.

I'm trying to browse through the flask code and I don't think it forks or anything... Anyone have any idea on why this would be happening?

Thanks,
Shuhao

Shuhao

unread,
Feb 21, 2013, 2:23:51 AM2/21/13
to py-le...@googlegroups.com
Resolved my own problem

It turns out that in the mail app.run file I imported the file for some unrelated stuff which also contained the leveldb instances. app.run causes reload, but since the leveldb instances are not garbaged collected, reloading the server run file will cause that file with the leveldb instance to reload and therefore we have the lock problem

Fix: put the leveldb instances in a file that's not imported by the run script or don't use the reloader.
Reply all
Reply to author
Forward
0 new messages