Hi, Most django-admin commands that connect to the database are never closing the database connection. This can be an issue because:
1) it will clutter the logs with errors like: (when using postgresql) 2010-12-11 13:09:04 EST LOG: could not receive data from client: Connection reset by peer 2010-12-11 13:09:04 EST LOG: unexpected EOF on client connection (when pooling connection with pgpool) Dec 23 11:10:24 Ubuntu10 pgpool: 2010-12-23 11:10:24 LOG: pid 23693: ProcessFrontendResponse: failed to read kind from frontend. frontend abnormally exited 2) if the command is only doing SELECT it will cause the transaction to be rolled back, which can be an issue if any of those SELECT are supposed to have side effects (for instance when using stored procedure) hose 2 issues are also described here: http://stackoverflow.com/questions/1303654/threaded-django-task-doesnt-automatically-handle-transactions-or-db-connections Examples of django-admin commands that are not closing the db connection are the built in "cleanup" command and the django-haystack "update_index" command. So far I have been updating my management command to explicitly close the database connection. But in this bug report: https://github.com/toastdriven/django-haystack/issues/issue/227 The authors of django-haystack seem to think this is an issue that should be fixed in django itself. I would like to know what the django developers think about this issue. It is annoying to me mainly because it makes it harder to monitor the logs so maybe you guys will think this is not something worth fixing in django? I can think of 2 options: 1) Update the django-admin commands documentation to recommend to explicitly close the db connection at the end of any custom commmand and use TransactionTestCase if you have any test using call_command. 2) Update BaseCommand.execute() so that it will always close the database connection, maybe by firing a command_finished signal What do you think? -- Djoume Salvetti Director of Development T:416.601.1999 x 249 www.trapeze.com twitter: trapeze 175 Bloor St. E., South Tower, Suite 900 Toronto, ON M4W 3R8 -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-develop...@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.