Skip to content

Conversation

@nerdrew
Copy link
Contributor

@nerdrew nerdrew commented Jun 4, 2025

For Rails >= 7.2, this library gets a connection via #lease_connection. But it never releases the connection. Release the connection back to the pool after #clean-ing.

Rails >= 7.2 does connection health checks / reconnect on connection checkout. If the connection is never checked back into the pool, it will never get "repaired", which makes testing database connection issues tricky.

@nerdrew nerdrew force-pushed the clear-connections branch 3 times, most recently from 2c22251 to 5a23f40 Compare June 4, 2025 05:31
@nerdrew nerdrew marked this pull request as ready for review June 4, 2025 05:33
Copy link
Member

@etagwerker etagwerker left a comment

Choose a reason for hiding this comment

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

@nerdrew Looks good, could you please add an entry to the CHANGELOG.md file?

For Rails >= 7.2, this library gets a connection via
`#lease_connection`. But it never releases the connection. Release the
connection back to the pool after `#clean`-ing.

Rails >= 7.2 does connection health checks / reconnect on connection
checkout. If the connection is never checked back into the pool, it will
never get "repaired", which makes testing database connection issues
tricky.
@nerdrew nerdrew force-pushed the clear-connections branch from 5a23f40 to 4a16bf4 Compare July 14, 2025 16:57
@nerdrew
Copy link
Contributor Author

nerdrew commented Jul 28, 2025

Added a changelog entry.

@etagwerker etagwerker merged commit 988ccc3 into DatabaseCleaner:main Jul 30, 2025
23 checks passed
etagwerker pushed a commit that referenced this pull request Jul 30, 2025
For Rails >= 7.2, this library gets a connection via
`#lease_connection`. But it never releases the connection. Release the
connection back to the pool after `#clean`-ing.

Rails >= 7.2 does connection health checks / reconnect on connection
checkout. If the connection is never checked back into the pool, it will
never get "repaired", which makes testing database connection issues
tricky.
etagwerker added a commit that referenced this pull request Jul 30, 2025
* Fixes #120

* Add a reference to #121

* Patch test expectation

* [Feature][DX] Add Docker Configuration for Development (#109)

* Fixes #120

* Add docker configuration for development

This makes it easier to run the test suite in your local dev environment

* Add a development section for contributors

This should make it easier for people to set up the library and run the test suite within Docker

* Added ruby service to make it easier to get started with your contribution

* Update password to match Docker configuration

* Removed outdated docker-compose file

* Use older mysql to avoid trilogy error, fix docker compose and instructions, mount code for easier development

* Update readme to point to CONTRIBUTE.md file

* Run ./bin/setup so that we have the config file in place for tests

* Relax dependency

* Add a line about the Docker + DX change

---------

Co-authored-by: Ariel Juodziukynas <arieljuod@gmail.com>

* release_connection after cleaning (#122)

For Rails >= 7.2, this library gets a connection via
`#lease_connection`. But it never releases the connection. Release the
connection back to the pool after `#clean`-ing.

Rails >= 7.2 does connection health checks / reconnect on connection
checkout. If the connection is never checked back into the pool, it will
never get "repaired", which makes testing database connection issues
tricky.

* Add a reference to #121

* Change expectation to allow for a cascade option

---------

Co-authored-by: Ariel Juodziukynas <arieljuod@gmail.com>
Co-authored-by: Andrew Lazarus <nerdrew@gmail.com>
@nerdrew nerdrew deleted the clear-connections branch July 30, 2025 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants