Massive unit test vs MySQL

Stephan Schaumann stephan.delete-schaumann at online.de
Fri Sep 5 10:33:17 EDT 2003


"Richard Wesley" <hawkfish at trustedmedianetworks.com> schrieb:
> I don't know if this is really a Python question of a MySQL question,
> but i am hopen that there is enough overlap that someone can help me ;-)
>
> I have a unit test suite for our server that loads a clean database
> image for many of the tests.  I use
>
> p = os.popen('mysql -u uid -ppassword mydatabase', 'w')
> p.write(sql_commands)

Do you p.close() when you are finished? Otherwise the connection opend by
mysql will stay open.

> to load the database.
>
> While the tests are running, I find that mysql has a growing number of
> "Sleeping" threads in the 'show processlist' table.  Towards the end of
> the test suite, the database loads start to fail with a MySQL error of
> "ERROR 1040: Too many connections".
>
> So my question would be, is there any way to shut down the child process
> so that MySQL notices and cleans up after itself before it runs out of
> threads?






More information about the Python-list mailing list