#29280: Fix for a class of SQLite "database is locked" problems
-------------------------------------+-------------------------------------
     Reporter:  Ove Kåven            |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  2.0
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  sqlite, databases    |             Triage Stage:
                                     |  Unreviewed
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Aymeric Augustin):

 So the proposal here is to always use immediate rather than deferred
 transactions.

 Per https://www.sqlite.org/lang_transaction.html:
 > After a BEGIN IMMEDIATE, no other database connection will be able to
 write to the database or do a BEGIN IMMEDIATE or BEGIN EXCLUSIVE.

 This means all `atomic` blocks will be serialized. Combined with
 `ATOMIC_REQUESTS = True`, HTTP requests will be serialized. I don't think
 that's an acceptable behavior.

 In general the performance hit of removing the possibility of concurrent
 database reads — and web workflows tend to be read-heavy — seems too high
 to implement this in Django.

 Also I'm not sure it fits well with the premise of allowing concurrency.
 It brings us back to "Don't use SQLite, or don't do concurrency."

 FWIW you can trivially subclass (or monkey-patch) the SQLite database
 adapter to make this change in your project.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29280#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.b2f4b0fce5f7d9b65e89130c4a70d99e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to