-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
0.7.2 - "failed to close setup connection" in #[sqlx::test]
with MySqlPool
#2888
Comments
I'm seeing the same issue intermittently.
|
FWIW, getting a very similar error coming from the same lines, but different OS error code:
This is 100%, not intermittent. Running in Github Actions
|
github action, same thing with postgres https://github.com/nextuponstream/totsugeki/actions/runs/8439727791/job/23114999504#step:5:860 usually, I try to rerun and it "works". I have yet to test the I've seen it happen locally on my popos machine with postgres running as a service I don't mind that it sometimes fail but it's still annoying to see. |
Same here, getting this when calling |
Bug Description
I am intermittently getting a test failure:
when running tests using the
#[sqlx::test]
macro with a test argument type ofMySqlPool
. This issues has appeared since upgrading to0.7.2
- I believe the errors are caused by the changes introduced here #2742.The error is coming from https://github.com/launchbadge/sqlx/blob/main/sqlx-core/src/testing/mod.rs#L258-L260 - the test setup database connection is already closed by some other task when that code runs. Running with
cargo test -- --test-threads=1
prevents the error, implying some race condition, but I cannot explain why the PR I linked to is causing the race, or which task is closing the connection.Minimal Reproduction
See: https://github.com/mattgray/sqlx-test-0-7-2-issue/blob/main/src/main.rs for a minimal reproduction. The actual codebase where I encountered this runs approximately 20 tests that use
sqlx::test
.The issue occurs approximately 1 in 100 test runs that use
sqlx::test
andMySqlPool
. Runningcargo test -- --test-threads=1
seems to fix the error.The error occurs whether or not I am connecting via unix socket
DATABASE_URL=mysql://root@localhost/test
or TCP on loopbackDATABASE_URL=mysql://root@127.0.0.1/test
Info
rustc --version
:rustc 1.74.0 (79e9716c9 2023-11-13)
The text was updated successfully, but these errors were encountered: