[Django] #29062: Sqlite in memory database does not work for testing.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

[Django] #29062: Sqlite in memory database does not work for testing.

Django
#29062: Sqlite in memory database does not work for testing.
-------------------------------------+-------------------------------------
               Reporter:  Juozas     |          Owner:  nobody
  Masiulis                           |
                   Type:  Bug        |         Status:  new
              Component:  Testing    |        Version:  2.0
  framework                          |       Keywords:  sqlite, testing,
               Severity:  Normal     |  databases
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 I am getting database table locked errors, when running tests which use
 sqlite in memory database.
 This issue was introduced with this commit:
 https://github.com/django/django/commit/bece837829eafbc22f2598dadf82c9a8364b085a
 I know this because reversing this commit resolves the issue for me.
 If sqlite in memory testing is no longer supported, it should be mentioned
 in the documentation. If it is supported, there needs to be some parameter
 in the settings to use liveserver without multithreading. Or just make a
 new class liveservermultithreaded.

--
Ticket URL: <https://code.djangoproject.com/ticket/29062>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/053.560350e70e0509776987ee9b14203a24%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #29062: Sqlite in memory database does not work for testing.

Django
#29062: Sqlite in memory database does not work for testing.
-------------------------------------+-------------------------------------
     Reporter:  Juozas Masiulis      |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Testing framework    |                  Version:  2.0
     Severity:  Normal               |               Resolution:
     Keywords:  sqlite, testing,     |             Triage Stage:
  databases                          |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Tim Graham):

 Please provide a sample project that reproduces the problem.

--
Ticket URL: <https://code.djangoproject.com/ticket/29062#comment:1>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/068.47e63dc0eb645267b9e8cec249e55277%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #29062: "database table locked errors" when using sqlite in-memory database with LiveServerTestCase (was: Sqlite in memory database does not work for testing.)

Django
In reply to this post by Django
#29062: "database table locked errors" when using sqlite in-memory database with
LiveServerTestCase
-------------------------------------+-------------------------------------
     Reporter:  Juozas Masiulis      |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:  Testing framework    |                  Version:  2.0
     Severity:  Normal               |               Resolution:  needsinfo
     Keywords:  sqlite, testing,     |             Triage Stage:
  databases                          |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

 * status:  new => closed
 * resolution:   => needsinfo


--
Ticket URL: <https://code.djangoproject.com/ticket/29062#comment:2>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/068.5caf744ec6e6f168316628d974a49dde%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #29062: "database table locked errors" when using sqlite in-memory database with LiveServerTestCase

Django
In reply to this post by Django
#29062: "database table locked errors" when using sqlite in-memory database with
LiveServerTestCase
-------------------------------------+-------------------------------------
     Reporter:  Juozas Masiulis      |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:  Testing framework    |                  Version:  2.0
     Severity:  Normal               |               Resolution:  needsinfo
     Keywords:  sqlite, testing,     |             Triage Stage:
  databases                          |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Juozas Masiulis):

 https://github.com/Euphorbium/django-bug-demo here is the sample project.
 Sorry for the mess in the test, the issue is with multiprocessing. The
 test pass with my version of django, check requirements, and fails with
 the unmodified django.

--
Ticket URL: <https://code.djangoproject.com/ticket/29062#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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/068.a886afac777ceaf46f083799860cf477%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #29062: "database table locked errors" when using sqlite in-memory database with LiveServerTestCase

Django
In reply to this post by Django
#29062: "database table locked errors" when using sqlite in-memory database with
LiveServerTestCase
-------------------------------------+-------------------------------------
     Reporter:  Juozas Masiulis      |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Testing framework    |                  Version:  2.0
     Severity:  Normal               |               Resolution:
     Keywords:  sqlite, testing,     |             Triage Stage:
  databases                          |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Juozas Masiulis):

 * status:  closed => new
 * resolution:  needsinfo =>


--
Ticket URL: <https://code.djangoproject.com/ticket/29062#comment:4>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/068.dac7acbd368b3ab0abbbe0ee4f9df0ae%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #29062: "database table locked errors" when using sqlite in-memory database with LiveServerTestCase

Django
In reply to this post by Django
#29062: "database table locked errors" when using sqlite in-memory database with
LiveServerTestCase
-------------------------------------+-------------------------------------
     Reporter:  Juozas Masiulis      |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:  Testing framework    |                  Version:  2.0
     Severity:  Normal               |               Resolution:
                                     |  worksforme
     Keywords:  sqlite, testing,     |             Triage Stage:
  databases                          |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

 * status:  new => closed
 * resolution:   => worksforme


Comment:

 Is the error consistent? I ran your sample project ten times and the test
 usually passes. Once in a while, I see this failure:
 {{{
 ======================================================================
 FAIL: testStuff (bugdemo.tests.TestDatabaseLocking)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/home/tim/code/django-bug-demo/bugdemo/tests.py", line 75, in
 testStuff
     self.assertEqual(Question.objects.count(), 30)
 AssertionError: 29 != 30
 }}}
 I think you'll have to explain why Django is at fault to move this report
 forward. Possibly the problem might be dependent on the Python version. I
 tested with Python 3.4.7, 3.5.5, and 3.6.4.

--
Ticket URL: <https://code.djangoproject.com/ticket/29062#comment:5>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/068.42ed3c782aa2473ed1f4eb04066f5bab%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #29062: "database table locked errors" when using sqlite in-memory database with LiveServerTestCase

Django
In reply to this post by Django
#29062: "database table locked errors" when using sqlite in-memory database with
LiveServerTestCase
-------------------------------------+-------------------------------------
     Reporter:  Juozas Masiulis      |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Testing framework    |                  Version:  2.0
     Severity:  Normal               |               Resolution:
     Keywords:  sqlite, testing,     |             Triage Stage:
  databases                          |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Juozas Masiulis):

 * status:  closed => new
 * resolution:  worksforme =>


Comment:

 It is a race condition. It is consistent in my system, but it gets locked
 by node process, and I did not want to go outside of python to demonstrate
 the bug. It needs something faster to lock the database consistently.

--
Ticket URL: <https://code.djangoproject.com/ticket/29062#comment:6>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/068.1a801d3d1b85a1a7183510bb2992a53b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #29062: "database table locked errors" when using sqlite in-memory database with LiveServerTestCase

Django
In reply to this post by Django
#29062: "database table locked errors" when using sqlite in-memory database with
LiveServerTestCase
-------------------------------------+-------------------------------------
     Reporter:  Juozas Masiulis      |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Testing framework    |                  Version:  2.0
     Severity:  Normal               |               Resolution:
     Keywords:  sqlite, testing,     |             Triage Stage:
  databases                          |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Tim Graham):

 Unfortunately your comment doesn't help with my understanding of the
 problem. Can explain why Django is at fault or propose a solution? If not,
 I'm not sure how to move this issue forward.

--
Ticket URL: <https://code.djangoproject.com/ticket/29062#comment:7>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/068.622cf3cf5ba5569f856610f595b6ccbf%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.