#22003 closed Bug (worksforme)
LiveServerTestCase with ATOMIC_REQUESTS leaves Postgres connections open after socket error
| Reported by: | Garron Moore | Owned by: | nobody |
|---|---|---|---|
| Component: | Testing framework | Version: | 1.6 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
When using LiveServerTestCase with ATOMIC_REQUESTS, a socket error happening in LiveServerThread can result in Postgres connections being left open. This results in the removal of the test database failing due to those open connections.
I've attached a sample test which exhibits this issue (when using postgres and ATOMIC_REQUESTS). In order for the test to exhibit the issue, there must be a view behind the targeted url.
I've also attached a patch to LiveServerThread that fixes this for me.
Attachments (2)
Change History (5)
by , 12 years ago
| Attachment: | live_server_testcase.patch added |
|---|
comment:1 by , 11 years ago
I wasn't able to reproduce this: I ran the test with a postgresql database named test_django configured with ATOMIC_REQUESTS, and a simple return HttpResponse(b"some response") view.
After the test runs (and I do see some Broken pipe error output in the logs), the test database is still removed.
I'm now closing this ticket as works for me, but please reopen it if the ticket is still relevant, with steps to reproduce (and a patch that applies cleanly on the trunk, which isn't the case anymore).
Thanks!
comment:2 by , 11 years ago
| Resolution: | → worksforme |
|---|---|
| Status: | new → closed |
Patch containing a fix