-
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
calling Pool::close
doesn't close connection
#897
Comments
let _ = self
.idle_conns
.pop()
.map(|idle| Floating::from_idle(idle, self))
.map(|f| async { f.close().await }); This doesn't actually call To ensure if let Some(idle) = self.idle_conns.pop() {
let _ = Floating::from_idle(idle, self).close().await;
} which looks better anyway. |
In fact, I wrote in this style because it seems to working and it works after tested. But i agree that it's a little confusing. |
That is an old RFC and is not exactly representative of the current implementation of async/await; even so, it does not purport to demonstrate that If you still don't believe me, see for yourself: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=a3f6b6336f79dcc5df4adf721e9f9102 |
Thank you, I got your point, you can close this issue as you like |
Closed by #895 |
after calling pool.close and process exits, mysql log message
which indicates that sqlx doesn't send
QUIT
command to mysql and close tcp connection directly.test env
mysql 5.7, start command
docker run -d --name mysql -p 3307:3306 -e MYSQL_ROOT_PASSWORD=1234TttT mysql:5.7
rust code
deps
after digging into sqlx code, I found that impl of SharedPool pub(super) async fn close(&self)
seem to forget calling close. after fixing like
warning from mysql is gone
The text was updated successfully, but these errors were encountered: