"database is locked" with the django development server

40 views
Skip to first unread message

pni...@gmail.com

unread,
Aug 19, 2020, 1:08:27 PM8/19/20
to OpenWISP
In the development server (./manage.py runserver 0.0.0.0:8000), when I try to delete something i get the error "database is locked".

Only development server is launched, not celery.

Tanks.

Federico Capoano

unread,
Aug 19, 2020, 1:27:08 PM8/19/20
to OpenWISP
Which module? Can you share the exact operations to cause this? A screenshot or gif would help as well.

F.

--
You received this message because you are subscribed to the Google Groups "OpenWISP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openwisp+u...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/openwisp/f92ea215-df79-456e-9062-2b7cf6a231dfn%40googlegroups.com.

pni...@gmail.com

unread,
Aug 19, 2020, 1:44:43 PM8/19/20
to OpenWISP
Anything I try to delete.
Network-administration-OpenWISP-Admin.webm

Federico Capoano

unread,
Aug 19, 2020, 1:52:30 PM8/19/20
to OpenWISP
MM.. I tried doing that in the dev env of openwisp-controller but does not happen.
"database is locked" is a very typical sqlite error, if you google it you'll find many people having this issue, it has to do with concurrency.
If some kind of process is using the database, even a failed operation that remained pending forever, it will cause the DB to not be writable by other processes.
Does it happen also if you kill most processes or if you reboot?

Fed

pni...@gmail.com

unread,
Aug 20, 2020, 2:56:23 AM8/20/20
to OpenWISP
Yes, I googled, but there are no many processes, only test server.
It always fails, even when kill and reload test server, It doesn't matter what I try to delete.
Tested on windows and ubuntu.

Oliver Kraitschy

unread,
Aug 20, 2020, 3:01:22 AM8/20/20
to open...@googlegroups.com
On Wed, Aug 19, 2020 at 11:56:22PM -0700, pni...@gmail.com wrote:
> Yes, I googled, but there are no many processes, only test server.
> It always fails, even when kill and reload test server, It doesn't matter
> what I try to delete.
> Tested on windows and ubuntu.

Do you access the database with any other tool (sqlitebrowser for
example)? Does the server process have write access to the directory where
the database file is?

Greetings,
Oliver

pni...@gmail.com

unread,
Aug 20, 2020, 3:11:13 AM8/20/20
to OpenWISP
"access the database with any other tool"  MM... i think i have opened database with PyCharm sometime, but it have testes in four different installations, two of them remotes which i dont have opened.

Oliver Kraitschy

unread,
Aug 20, 2020, 3:15:22 AM8/20/20
to open...@googlegroups.com
On Thu, Aug 20, 2020 at 12:11:12AM -0700, pni...@gmail.com wrote:
> "access the database with any other tool" MM... i think i have opened
> database with PyCharm sometime, but it have testes in four different
> installations, two of them remotes which i dont have opened.

Well, I also had this issue in the past and I think it was either when I
had the development server running and was accessing the database with
sqlitebrowser at the same time or when I was interacting with the app
through several browser tabs at the same time.

Greetings,
Oliver

pni...@gmail.com

unread,
Sep 15, 2020, 8:26:33 AM9/15/20
to OpenWISP
The problem resolves adding

from .celery import app as celery_app

__all__ = ('celery_app',)

to the app __init__.py file.

I will document it.
Reply all
Reply to author
Forward
0 new messages