augur icon indicating copy to clipboard operation
augur copied to clipboard

Prevent database connection leaks in config helpers #3452 issue resolved

Open paras-chinchalkar opened this issue 2 weeks ago • 2 comments

Fix: Prevent database connection leaks in config helpers

  • Ensured all AugurConfig value lookups (get_redis_conn_values, get_rabbitmq_conn_string) are performed inside active DatabaseSession context managers.
  • Adjusted DatabaseSession lifecycle to avoid disposing shared engines prematurely.
  • Corrected recursive insert logic to merge results and prevent hidden leaks during retries.
  • Added safety checks for empty config strings and fixed variable naming typo. This resolves the issue where repeated calls to get_redis_conn_values opened new DB connections that were never closed. With this fix, connection pool usage remains stable under repeated calls.

paras-chinchalkar avatar Dec 10 '25 05:12 paras-chinchalkar

Can you make the title of your pull request more descriptive of what is actually being fixed? Raw issue numbers by themselves arent very easy to read/understand at a glance

MoralCode avatar Dec 10 '25 17:12 MoralCode

Can you make the title of your pull request more descriptive of what is actually being fixed? Raw issue numbers by themselves arent very easy to read/understand at a glance

fix: correct regex parsing of PostgreSQL connection string what I tried to do:- This update improves the parse_database_string function so it correctly pulls out the username, password, host, port, and database from a PostgreSQL connection string. If the input doesn’t match the expected format, the function now raises a clear ValueError instead of silently failing. The changes are kept focused only on the parsing logic, without any unrelated reformatting, to make the review straightforward.

paras-chinchalkar avatar Dec 12 '25 14:12 paras-chinchalkar

fix: correct regex parsing of PostgreSQL connection string what I tried to do:- This update improves the parse_database_string function so it correctly pulls out the username, password, host, port, and database from a PostgreSQL connection string. If the input doesn’t match the expected format, the function now raises a clear ValueError instead of silently failing. The changes are kept focused only on the parsing logic, without any unrelated reformatting, to make the review straightforward.

This is a completely different and unrelated fix than the one in the initial issue description you provided.

Ensured all AugurConfig value lookups (get_redis_conn_values, get_rabbitmq_conn_string) are performed inside active DatabaseSession context managers.

Several maintainers have tried solving this issue in the past, and I really dont think this is it.

I dont really see a realistic path to this getting merged, so i'm going to close it

MoralCode avatar Dec 16 '25 14:12 MoralCode