--
Ticket URL: <https://code.djangoproject.com/ticket/22414>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* has_patch: 0 => 1
* needs_tests: => 0
* needs_docs: => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/22414#comment:1>
* type: Uncategorized => Bug
* component: Uncategorized => Testing framework
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/22414#comment:2>
Comment (by anonymous):
We are using only `TestCase` and `TransactionTestCase`s in our code.
CONN_MAX_AGE is set to 180.
--
Ticket URL: <https://code.djangoproject.com/ticket/22414#comment:3>
* owner: nobody => jrothenbuhler
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/22414#comment:4>
* owner: jrothenbuhler =>
* status: assigned => new
--
Ticket URL: <https://code.djangoproject.com/ticket/22414#comment:5>
* needs_better_patch: 0 => 1
Comment:
The test is currently failing for me, as `wrapped_close` seems to be
called after the test assertion.
I also wonder if closing the connections should happen in
`LiveServerTestCase._tearDownClassInternal`, but then it will be even more
difficult to test :-(
--
Ticket URL: <https://code.djangoproject.com/ticket/22414#comment:6>
* needs_better_patch: 1 => 0
Comment:
It turns out the patch was not closing _all_ connections properly - just
whatever happened to be in `conn`. Fixed.
--
Ticket URL: <https://code.djangoproject.com/ticket/22414#comment:7>
* needs_better_patch: 0 => 1
Comment:
This patch is still not working for me on an up to date master.
On a side note, it might be related to #22420 and #22003.
--
Ticket URL: <https://code.djangoproject.com/ticket/22414#comment:8>
Comment (by Koterpillar):
Can you share the results you are getting, along with the environment? I'm
always getting a success.
--
Ticket URL: <https://code.djangoproject.com/ticket/22414#comment:9>
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>
* cc: chris.jerdonek@… (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/22414#comment:11>
* owner: => cjerdonek
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/22414#comment:12>
Comment (by cjerdonek):
I posted a pull request for this
[https://github.com/django/django/pull/7096 here]. Also, I confirmed on
the CI servers (on six of the build configurations) that the test I added
fails without the change.
--
Ticket URL: <https://code.djangoproject.com/ticket/22414#comment:13>
* needs_better_patch: 1 => 0
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/22414#comment:14>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"f6cd669ff203192c29495174e53da6b16883b039" f6cd669f]:
{{{
#!CommitTicketReference repository=""
revision="f6cd669ff203192c29495174e53da6b16883b039"
Fixed #22414 -- Ensured that LiveServerTestCase closes connections.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/22414#comment:15>