-
Notifications
You must be signed in to change notification settings - Fork 117
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
Tokio executor is assumed to be present for Conn cleanup #56
Comments
@blackbeam Do you need any help with this? If I have some spare time I could try to create a PR. |
Hi!
Actually yeah, because i don't have much spare time atm. However the solution is unclear to me. Consider this test: mysql_async/src/conn/pool/mod.rs Lines 536 to 544 in bfea526
Pool here will outlive the runtime created on line 539. I believe this means that any async cleanup code Now consider the following test: #[test]
fn disconnect_on_another_runtime() {
let fut = Conn::new(get_opts());
let conn = run(fut).unwrap(); // <- first runtime
run(conn.disconnect()).unwrap(); // <- second runtime
} Here the connection is created using the first runtime and then disconnected using the second runtime. But this test will panic with This means, i think, that asynchronous cleanup just can't be executed if Approach that i tried is to unwrap raw handle from tokio TcpStream and perform synchronous cleanup, but it turns out that IntoRawFd is not implemented for tokio TcpStream (because of this, i think). I might, however, be wrong. Do you have any thoughts about all this? |
I think if the runtime is dropped before the I think you misunderstood my issue slightly; I'm using your lib without a tokio runtime, I use my own. However, the cleanup code is hardcoded to use the last used tokio runtime. If this is not present, it will silently fail. My proposal is to allow a custom Do you agree on this? Is |
Oh. This clears thing a bit. Thanks.
Yesterday i've hoped for a blitzkrieg while adding |
Great! It may be helpful to look at |
Any progress on this issue? |
The crate should not expect a tokio executor to be present.
Perhaps the Pool can contain an (optional) reference to an Executor, similar to how Hyper does it. This gives users the freedom to provide their own executor, or use the default one.
As far as I could see, this is the only place where a future is spawned. Without an executor present, the cleanup is never run.
The text was updated successfully, but these errors were encountered: