boinc icon indicating copy to clipboard operation
boinc copied to clipboard

Missing DB connection closing

Open brevilo opened this issue 1 year ago • 3 comments

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 as INFORMATION but 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:

  • files issuing boinc_db.open(): 30
  • files issuing boinc_db.close(): 9

This indicates a general issue, not just in the C API.

Thanks

brevilo avatar Jul 17 '24 11:07 brevilo

Also the Db_conn of the web code (in html/inc/db_conn.inc) is lacking a method to close a DB connection.

bema-aei avatar Jul 17 '24 15:07 bema-aei

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.

brevilo avatar Jul 17 '24 15:07 brevilo

There should at least be the possibility given to do it. This is a generic general purpose class, not a specific page.

bema-aei avatar Jul 17 '24 15:07 bema-aei