-
-
Notifications
You must be signed in to change notification settings - Fork 2.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
Tokio leaks file descriptors #2635
Comments
I was unable to reproduce with the following code: fn main() {
for _ in 0..50 {
drop(tokio::runtime::Runtime::new());
}
} I also tried some file IO which didn't work. Trying a more extended example now which uses rusoto_s3 and futures, then I'll see what I can minimize from there. |
Here is a self-contained example: https://github.com/jyn514/tokio-leak-example. However it requires that you have a local s3 instance running (using Command line and output
|
It would be nice with an example that uses Tokio's types directly. Can you try something that uses both tcp streams and timers? And perhaps also unix pipes, as those show up on your valgrind outputs. |
It only works about 60% of the time, but this leaks fds use tokio::{io::AsyncWriteExt, net::TcpStream, runtime::Runtime};
fn main() {
let runtime = Runtime::new().unwrap();
runtime.handle().block_on(async {
let mut stream = TcpStream::connect("127.0.0.1:8080").await.unwrap();
stream.write_all(b"hello world!").await.unwrap();
});
} Valgrind Output
Using use tokio::{io::AsyncWriteExt, net::UnixStream, runtime::Runtime};
fn main() {
let runtime = Runtime::new().unwrap();
runtime.handle().block_on(async {
let mut stream = UnixStream::connect("127.0.0.1:8080").await.unwrap();
stream.write_all(b"hello world!").await.unwrap();
});
} Valgrind Output
|
#2649 has merged, closing now. Thanks all! |
Version
Platform
Description
I unfortunately don't have a minimal reproduction, but I have the specific segment of code that causes this.
The commandline command runs this portion, and valgrind calls out
S3Backend::new
, which seems rather trivial and just constructs a new runtime, at my best guess things aren't being cleaned up as they should in theDrop
implementation ofRuntime
For valgrind I ran
cargo build && valgrind --track-fds=yes target/debug/cratesfyi build crate lasso 0.2.2
.Valgrind output
The text was updated successfully, but these errors were encountered: