FD leak in SDaemon

Bug #1537982 reported by Takashi Kajinami
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
storlets
Fix Released
Undecided
Takashi Kajinami

Bug Description

In our testing, we found that SDaemon leaks the following two file descriptors.

 * the file descriptor for storlet log file
 * the file descriptor for (TBD) pipe

Revision history for this message
Takashi Kajinami (kajinamit) wrote :

I found SDaemon leaks two descriptors for each storlet execution.
Here I show an example about the two descriptors.

> java 6518 swift 29w FIFO 0,8 0t0 191003148 pipe
> java 6518 swift 34w REG 259,1 3554872 26084249 /home/docker_device/logs/scopes/.../storlet_invoke.log

The fist one is a writable pipe, which is used to deliver data from SDaemon to storlet_middleware.
(I suppose it may be execution message pipe used for ping, but I have to make sure that now)

The second one is connected to a log file, and I found that SDaemon never closes that log fd.

Eran Rom (eranr)
Changed in storlets:
status: New → Confirmed
Revision history for this message
Eran Rom (eranr) wrote :

Takashi,
Good catch!
Yes, indeed those two are leaked.
In fact looking at SExecutionTask.run I wonder if we are not potentially leaking more fds.
That is, what if the storlet writer does not close the in and out fds. There will be a timeout, but I am not sure the fds are closed.

BTW - the writable pipe has the following role: whenever we execute a storlet, the storlet daemon writes back an identifier of the task that it invoked. The storlet middleware can make use of this id if it wishes to signal the daemon to stop the task.
see e.g. SCancelTask. On the middleware side we use it upon read timeout, to ask the daemon to stop the task.

Revision history for this message
Takashi Kajinami (kajinamit) wrote :

I committed a patch for this bug, and needs code review for it.

https://review.openstack.org/#/c/272379/

Changed in storlets:
assignee: nobody → Takashi Kajinami (kajinamit)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to storlets (master)

Reviewed: https://review.openstack.org/272379
Committed: https://git.openstack.org/cgit/openstack/storlets/commit/?id=e9e1efe07ea66480897bf1b07337c98b02d86801
Submitter: Jenkins
Branch: master

commit e9e1efe07ea66480897bf1b07337c98b02d86801
Author: Takashi Kajinami <email address hidden>
Date: Tue Jan 26 13:47:11 2016 +0900

    Fix the fd leak in SDaemon

    This patch prevent SDaemon from leaking the following two file
    descriptors.
     * fd for log file
     * fd for task id pipe

    This patch also adds some "close"s to make sure output streams
    get closed in SDaemon.

    Change-Id: I59119243c785526f7b97ac379b0e541cabd44750
    Closes-Bug: #1537982

Changed in storlets:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.