Skip to content

Wrap DB connection in listActive method with DbConnectionFactory#34944

Merged
spbolton merged 1 commit intomainfrom
claude/fix-issue-34831-cQUlI
Mar 12, 2026
Merged

Wrap DB connection in listActive method with DbConnectionFactory#34944
spbolton merged 1 commit intomainfrom
claude/fix-issue-34831-cQUlI

Conversation

@spbolton
Copy link
Contributor

@spbolton spbolton commented Mar 11, 2026

Proposed Changes

  • Wrapped the database query execution in ExperimentsFactoryImpl.listActive() with DbConnectionFactory.wrapConnection() to ensure proper connection management
  • Added import for DbConnectionFactory class
  • Refactored the method to use a lambda expression for connection handling

Rationale

This change ensures that database connections are properly managed and released when querying active experiments by page identifier. Using DbConnectionFactory.wrapConnection() provides consistent connection lifecycle management across the codebase.

Checklist

  • Tests
  • Translations
  • Security Implications Contemplated (add notes if applicable)

Additional Info

The functional behavior of the listActive() method remains unchanged - it still queries for active experiments (excluding ENDED and ARCHIVED statuses) and transforms the results into a collection of Experiment objects. This is a refactoring to improve resource management.

https://claude.ai/code/session_01QgxjLmXpypRcAYADtkEgg7

This PR fixes: #34831

Wrap the DotConnect query in DbConnectionFactory.wrapConnection() to ensure
connections are properly closed when called from background threads (e.g.,
ReindexThread, CDI async events, scheduler tasks) that lack CMSFilter cleanup.

Fixes #34831

https://claude.ai/code/session_01QgxjLmXpypRcAYADtkEgg7
Copy link
Contributor

@wezell wezell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@spbolton spbolton enabled auto-merge March 11, 2026 18:54
@spbolton spbolton added this pull request to the merge queue Mar 12, 2026
Merged via the queue into main with commit 3c0089c Mar 12, 2026
44 checks passed
@spbolton spbolton deleted the claude/fix-issue-34831-cQUlI branch March 12, 2026 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area : Backend PR changes Java/Maven backend code

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

fix(experiments): DB connection leak — ExperimentsAPIImpl.listActive() has no connection lifecycle management on background thread call paths

4 participants