﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
25329	_nodb_connection is open for an entire test suite run	Matthew Taylor	nobody	"I was running into an issue with my test suite in which I would get occasionally get an {{{OperationalError: (2006, 'MySQL server has gone away'}}} error during test database teardown – i.e. during {{{connection.creation.destroy_test_db(old_name, self.verbosity, self.keepdb)}}} in the test runner.

I would often run into this when running the entire test suite, or tests against multiple apps in my project – running tests against just one app, or one unit test, would not cause this tear down issue. Upon investigation, I discovered that by setting {{{wait_timeout}}} on my MySQL instance high (it had been set to 180 seconds, so I tried setting it back to the default 28800 and running tests again), I was able to prevent the error from occurring on runs of the entire test suite, or multi-app tests. 

After a bit of investigation, it appeared to me that part of the issue I was experiencing was that the {{{_nodb_connection}}} property on the {{{BaseDatabaseCreation}}} object was being set on instantiation, and then kept alive for the duration of the tests. If my understanding is indeed the case, I was wondering if it might be possible/better to have this connection be closed after test database creation (i.e. in {{{create_test_db()}}}), and reopened again for tear down, rather than being kept open for the entire test duration."	Bug	closed	Testing framework	dev	Normal	fixed	nodb, testing, test runner		Ready for checkin	1	0	0	0	0	0
