Changes between Version 1 and Version 2 of Ticket #29062, comment 17


Ignore:
Timestamp:
Feb 5, 2021, 1:33:50 PM (4 years ago)
Author:
Chris Jerdonek

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #29062, comment 17

    v1 v2  
    11FYI, yesterday I found and described the root cause of this issue on #32416. (There I was interested in a different issue that affected non-SQLite databases, though, namely database connections not being closed when `LiveServerTestCase` is used with the new threading behavior.)
    22
    3 If you read my first comments on that issue, you can see that a possible fix is to define suitable method overrides in `ThreadedWSGIServer`. Basically the same SQLite-specific connection-sharing logic that `LiveServerTestCase.setUpClass()` and `LiveServerThread.run()` have needs to be added to `ThreadedWSGIServer`. The `LiveServerTestCase` and `LiveServerThread` logic can be found more or less here:
     3If you read my first comments on that issue, you can see that a possible fix is to define suitable method overrides in `ThreadedWSGIServer`. Basically the same SQLite-specific connection-sharing logic that `LiveServerTestCase.setUpClass()` and `LiveServerThread.run()` currently have needs to be added to `ThreadedWSGIServer`. The `LiveServerTestCase` and `LiveServerThread` logic can be found more or less here:
    44https://github.com/django/django/blob/63d239db037f02d98b7771c90422840bbb4a319a/django/test/testcases.py#L1524-L1537
    55https://github.com/django/django/blob/63d239db037f02d98b7771c90422840bbb4a319a/django/test/testcases.py#L1465-L1469
     6
     7And `ThreadedWSGIServer`'s thread ''creation'' logic can be found here in CPython's `ThreadingMixIn.process_request()` (this is where you can work out what needs to be overridden):
     8https://github.com/python/cpython/blob/v3.9.1/Lib/socketserver.py#L656-L665
     9
    610 
Back to Top