Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[1.5.x] Fixed #18984 -- Avoided a deadlock in test teardown.

Thanks Jeremy Dunck for the report.

Backport of 891c530 from master.
  • Loading branch information...
commit b9f9bc9a170430901fae188c375076f9b2cac784 1 parent 9bd67f0
@aaugustin aaugustin authored
Showing with 6 additions and 0 deletions.
  1. +6 −0 django/test/testcases.py
View
6 django/test/testcases.py
@@ -505,6 +505,12 @@ def _fixture_teardown(self):
# If the test case has a multi_db=True flag, flush all databases.
# Otherwise, just flush default.
databases = connections if getattr(self, 'multi_db', False) else [DEFAULT_DB_ALIAS]
+
+ # Roll back any pending transactions in order to avoid a deadlock
+ # during flush when TEST_MIRROR is used (#18984).
+ for conn in connections.all():
+ conn.rollback_unless_managed()
+
for db in databases:
call_command('flush', verbosity=0, interactive=False, database=db,
skip_validation=True, reset_sequences=False)
Please sign in to comment.
Something went wrong with that request. Please try again.