Missing DB connection closing
Various BOINC components don't properly close the DB connection they opened before. This is a problem because:
- Open connections are a limited resource on the database server and new clients might be rejected when all are used up.
- Left-open connections will eventually be aborted by the database server and logged as a
WARNING, at least by MariaDB. MySQL still logs it asINFORMATIONbut MariaDB has a good reason to warn about those: the root cause can in fact be caused by misconfiguration (e.g.max_allowed_packet) or networking issues. Both should not get masked by otherwise harmless missing connection closing.
Sampling only the current C API (e.g. used by daemons), you'll find:
This indicates a general issue, not just in the C API.
Thanks
Also the Db_conn of the web code (in html/inc/db_conn.inc) is lacking a method to close a DB connection.
To be fair, in a web context it might be harder to decide if and when to close a connection as you might want to reuse it (opening connections is expensive). However, when you know it can be closed, it ought to be closed.
There should at least be the possibility given to do it. This is a generic general purpose class, not a specific page.