[Ns-bugs] [Bug 815] New: waf shell file descriptor leak

code@nsnam.ece.gatech.edu code at nsnam.ece.gatech.edu
Sun Feb 14 12:38:42 PST 2010


http://www.nsnam.org/bugzilla/show_bug.cgi?id=815

           Summary: waf shell file descriptor leak
           Product: ns-3
           Version: ns-3-dev
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: minor
          Priority: P5
         Component: build system
        AssignedTo: ns-bugs at isi.edu
        ReportedBy: tgoff at tgoff.net
   Estimated Hours: 0.0


Created an attachment (id=761)
 --> (http://www.nsnam.org/bugzilla/attachment.cgi?id=761)
possible fix

A shared dev_null file is opened in waf-tools/shellcmd.py.  The
corresponding file descriptor remains open and is then inherited by
child processes on some platforms.  For example on linux:

    $ ./waf shell
    Waf: Entering directory `/home/jeos/ns-3-dev/build'
    Waf: Leaving directory `/home/jeos/ns-3-dev/build'
    $ ls -l /proc/self/fd
    total 0
    lrwx------ 1 jeos jeos 64 2010-02-14 12:00 0 -> /dev/pts/1
    lrwx------ 1 jeos jeos 64 2010-02-14 12:00 1 -> /dev/pts/1
    lrwx------ 1 jeos jeos 64 2010-02-14 12:00 2 -> /dev/pts/1
    lr-x------ 1 jeos jeos 64 2010-02-14 12:00 3 -> /proc/4112/fd
    l-wx------ 1 jeos jeos 64 2010-02-14 12:00 5 -> /dev/null

Note fd 5.  The attached patch sets the close-on-exec flag for
dev_null when possible and should not effect platforms that don't have
fcntl.

A somewhat related comment: it might be easier to use os.devnull
instead of choosing between "NUL:" and "/dev/null" in regression.py
and waf-tools/shellcmd.py.

-- 
Configure bugmail: http://www.nsnam.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the Ns-bugs mailing list