diff options
| author | Jacob Walls <jacobtylerwalls@gmail.com> | 2026-03-30 09:19:20 -0400 |
|---|---|---|
| committer | Jacob Walls <jacobtylerwalls@gmail.com> | 2026-03-30 15:56:52 -0400 |
| commit | 6c9ef6282e65a79daba4dc2146e8b825b4ddadb9 (patch) | |
| tree | 9e2916cbccf0b8697e85326f76e6cc546886dafb /django | |
| parent | 8f50bae618c435863f68b162135468a6f5ca7301 (diff) | |
Refs #36770 -- Guarded against an endless wait in LiveServerThread.terminate().
terminate() shouldn't assume the main server was started. (A deadlock
from mishandling of in-memory SQLite databases may have occurred.)
Diffstat (limited to 'django')
| -rw-r--r-- | django/test/testcases.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/django/test/testcases.py b/django/test/testcases.py index de2a3eb61d..b31e70d9d1 100644 --- a/django/test/testcases.py +++ b/django/test/testcases.py @@ -1783,11 +1783,12 @@ class LiveServerThread(threading.Thread): ) def terminate(self): - if hasattr(self, "httpd"): - # Stop the WSGI server - self.httpd.shutdown() - self.httpd.server_close() - self.join() + if self.is_ready.is_set(): + if hasattr(self, "httpd"): + # Stop the WSGI server + self.httpd.shutdown() + self.httpd.server_close() + self.join() class LiveServerTestCase(TransactionTestCase): |
