inejge / ldap3

A pure-Rust LDAP library using the Tokio stack
Apache License 2.0
220 stars 38 forks source link

File handles don't get closed #38

Closed haslersn closed 4 years ago

haslersn commented 4 years ago

I have a program that uses this ldap3 library so as to regularly create an ldap connection. Each time a file descriptor is opened, as can be seen in /proc/<PID>/fd. Unfortunately, those file descriptors are never closed, even if the corresponding handle to the connection (in the Rust code) is dropped. They are leaked. Therefore, the program eventually runs out of file descriptors and crashes.

inejge commented 4 years ago

I believe this is a bug in tokio. Try setting it explicitly to 0.1.11, which is (from my testing) the last version that drops the Core as expected.

[dependencies]
tokio = "=0.1.11"
haslersn commented 4 years ago

I believe this is a bug in tokio. Try setting it explicitly to 0.1.11, which is (from my testing) the last version that drops the Core as expected.

[dependencies]
tokio = "=0.1.11"

Thanks, that did the trick.

inejge commented 4 years ago

With the port to Tokio 0.2, this can now be closed. I've tested the new version by opening and dropping a connection in a tight loop, which would have exhausted the available file descriptors in under a second if there was a leak. There wasn't.