#32416: Apparent regression of #22414 from switching to ThreadedWSGIServer in
LiveServerTestCase (#20238)
--------------------------------+--------------------------------------
     Reporter:  Chris Jerdonek  |                    Owner:  nobody
         Type:  Uncategorized   |                   Status:  new
    Component:  Uncategorized   |                  Version:  2.2
     Severity:  Normal          |               Resolution:
     Keywords:                  |             Triage Stage:  Unreviewed
    Has patch:  0               |      Needs documentation:  0
  Needs tests:  0               |  Patch needs improvement:  0
Easy pickings:  0               |                    UI/UX:  0
--------------------------------+--------------------------------------

Comment (by Chris Jerdonek):

 I wonder if this issue is because `ThreadingMixIn` creates a new thread
 for each request, but those threads don't close their database connections
 at their conclusion, e.g. like `LiveServerThread` does.

 Here is the code in CPython for `ThreadingMixIn`'s `process_request()` and
 `server_close()`:
 https://github.com/python/cpython/blob/v3.9.1/Lib/socketserver.py#L656-L674

 And here is the code for Django's `LiveServerThread.run()`, which does
 close its connections:
 
https://github.com/django/django/blob/3f8979e37b6c498101d09a583ccc521d7f2879e5/django/test/testcases.py#L1460-L1484

 (I wonder if it's also a problem that `ThreadingMixIn` doesn't implement
 the same thread-sharing logic that `LiveServerThread` does, which is
 needed for SQLite.)

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32416#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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.7074b78e10e7c23c810257c13cd5c340%40djangoproject.com.

Reply via email to