-
Notifications
You must be signed in to change notification settings - Fork 35
Fix file descriptor leak in the postoffice plugin #1989
Conversation
But still, this line is not hit
|
8784f66
to
c2da76d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @ip1981)
iml-agent/src/daemon_plugins/postoffice.rs, line 183 at r1 (raw file):
Previously, ip1981 (Igor Pashev) wrote…
When all file descriptors referring to an inotify instance have been closed, the underlying object and its resources are freed for reuse by the kernel; all associated watches are automatically freed. --- https://linux.die.net/man/7/inotify
I'd expect inotify
to close everything on drop, do you know why this is not the case?
I would postulate it is not dropped :) |
5f7bf30
to
0d576f0
Compare
Since the issue is tricky, why not to add a description, how it is guaranteed now that the descriptors are freed? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something doesn't make sense.
In:
the same ffi::close
fn is called iff close_on_drop
is true
.
So, this means either one of three things:
- Inotify is not being dropped because something else has a reference to it (have you tried using a valve on the listener stream?).
close_on_drop
is somehowfalse
- The
ffi::close
in drop is somehow behaving differently than theclose
method (unlikely).
We should figure this out instead of calling close
explicitly as we're likely to use this crate elsewhere and may hit the same issue again.
The loop of inotify events was never ending keeping a reference to the opened file descriptor. On each new session a new file descriptor was allocated. New session is created every time the manager (iml-http-agent) restarts. Signed-off-by: Igor Pashev <pashev.igor@gmail.com>
it is moved into the spawned task and kept alive as long as the task is. Signed-off-by: Joe Grund <jgrund@whamcloud.io>
* Fix file descritor leak in the postoffice plugin The loop of inotify events was never ending keeping a reference to the opened file descriptor. On each new session a new file descriptor was allocated. New session is created every time the manager (iml-http-agent) restarts. Signed-off-by: Igor Pashev <pashev.igor@gmail.com> * Remove storage of inotify ref it is moved into the spawned task and kept alive as long as the task is. Signed-off-by: Joe Grund <jgrund@whamcloud.io> Co-authored-by: Joe Grund <jgrund@whamcloud.io>
Closes #1838.
Signed-off-by: Igor Pashev pashev.igor@gmail.com
This change is