Opened 12 months ago

Last modified 9 months ago

#22414 new Bug

Persistent connections not closed by LiveServerTestCase, preventing dropping test databases

Reported by: Koterpillar Owned by:
Component: Testing framework Version: 1.6
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

Whenever a PostgreSQL connection is marked as persistent (CONN_MAX_AGE = None) and a LiveServerTestCase is executed, the connection from the server thread is never closed, leading to inability to drop the test database.

Attachments (1)

patch (1.7 KB) - added by Koterpillar 11 months ago.
test and patch

Download all attachments as: .zip

Change History (10)

comment:1 Changed 12 months ago by Koterpillar

  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 12 months ago by claudep

  • Component changed from Uncategorized to Testing framework
  • Triage Stage changed from Unreviewed to Accepted
  • Type changed from Uncategorized to Bug

comment:3 Changed 12 months ago by anonymous

We are using only TestCase and TransactionTestCases in our code. CONN_MAX_AGE is set to 180.

comment:4 Changed 12 months ago by jrothenbuhler

  • Owner changed from nobody to jrothenbuhler
  • Status changed from new to assigned

comment:5 Changed 12 months ago by jrothenbuhler

  • Owner jrothenbuhler deleted
  • Status changed from assigned to new

comment:6 Changed 12 months ago by claudep

  • Patch needs improvement set

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 :-(

Changed 11 months ago by Koterpillar

test and patch

comment:7 Changed 11 months ago by Koterpillar

  • Patch needs improvement unset

It turns out the patch was not closing _all_ connections properly - just whatever happened to be in conn. Fixed.

comment:8 Changed 11 months ago by magopian

  • Patch needs improvement set

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.

comment:9 Changed 9 months ago by Koterpillar

Can you share the results you are getting, along with the environment? I'm always getting a success.

Note: See TracTickets for help on using tickets.
Back to Top