#22414: Persistent connections not closed by LiveServerTestCase, preventing
dropping test databases
-----------------------------------+------------------------------------
     Reporter:  Koterpillar        |                    Owner:
         Type:  Bug                |                   Status:  new
    Component:  Testing framework  |                  Version:  1.6
     Severity:  Normal             |               Resolution:
     Keywords:                     |             Triage Stage:  Accepted
    Has patch:  1                  |      Needs documentation:  0
  Needs tests:  0                  |  Patch needs improvement:  1
Easy pickings:  0                  |                    UI/UX:  0
-----------------------------------+------------------------------------

Comment (by cjerdonek):

 I also ran into this issue with Django 1.9.7.

 What I observed is that with `CONN_MAX_AGE=None`, after
 `LiveServerTestCase.tearDownClass()`, querying PostgreSQL's
 `pg_stat_activity` shows a lingering connection in state "idle" (which was
 a connection created by the test case).

 It looks like the culprit may be Django's
 
[https://github.com/django/django/blob/418658f453bed7fe7949dda26651aab370003e6a/django/test/testcases.py#L1230
 LiveServerThread]. The idle connections are not closed when the thread
 terminates. It looks like that's what the most recent patch proposes.

 Other info:

 PostgreSQL 9.3.13, psycopg2 2.6.2, Python 3.5.2.

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

Reply via email to