Leaklens

django__django-14011

LiveServerTestCase's ThreadedWSGIServer doesn't close database connections after each thread

Verdict: the fix is stated in the issue (Tier A).

It looks like this issue's fix might be as simple as adding the following method to Django's ThreadedWSGIServer (code: ​https://github.com/django/django/blob/50a5f8840fa564dcefdb1fa5c58f06fcd472ee70/django/core/servers/basehttp.py#L80-L82) (it seems to be fixing it for me): from django.db import connections def close_request(self, request): """Called to clean up an individual request.""" connections.close_all() super().close_request(request)

The text states the fix: “It looks like this issue's fix might be as simple as adding the following method to Django's ThreadedWSGIServer (code: ​https://github.com/django/django/blob/50a5f8840fa…”

All SWE-bench Verified tasks · more django/django tasks · How the check works