[Boost-bugs] [Boost C++ Libraries] #13605: Filedescriptor leak in boost::process

Subject: [Boost-bugs] [Boost C++ Libraries] #13605: Filedescriptor leak in boost::process
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2018-06-14 13:27:47


#13605: Filedescriptor leak in boost::process
------------------------------+---------------------
 Reporter: 4hopp | Owner: (none)
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: process
  Version: Boost 1.64.0 | Severity: Problem
 Keywords: |
------------------------------+---------------------
 Hi,

 I am using boost 1.64.0 on linux.
 I am using boost process to execute subprocesses. When, for some reason,
 the path does not point to a file, or when the file is not executable,
 then I keep leaking file descriptors.

 Minimal example:

 {{{
 #include <boost/process.hpp>
 #include <boost/process/extend.hpp>
 #include <boost/filesystem.hpp>
 #include <boost/asio.hpp>
 #include <sys/prctl.h>

 int main() {
         namespace bp = boost::process;
         namespace ex = bp::extend;

         system("ls -l /proc/self/fd");

         try {
                 boost::asio::io_service ios;
                 bp::child process ("/does/not/exist", ios);
                 process.wait();
         } catch (const bp::process_error& e) {
                 // A process_error has been thrown - there is no file
 /does/not/exist
         }

         system("ls -l /proc/self/fd");
 }

 }}}

 Example output:

 {{{
 total 0
 lrwx------ 1 hopp hopp 64 Jun 14 12:04 0 -> /dev/pts/3
 lrwx------ 1 hopp hopp 64 Jun 14 12:04 1 -> /dev/pts/3
 lrwx------ 1 hopp hopp 64 Jun 14 12:04 2 -> /dev/pts/3
 lr-x------ 1 hopp hopp 64 Jun 14 12:04 3 -> /proc/19629/fd
 total 0
 lrwx------ 1 hopp hopp 64 Jun 14 12:04 0 -> /dev/pts/3
 lrwx------ 1 hopp hopp 64 Jun 14 12:04 1 -> /dev/pts/3
 lrwx------ 1 hopp hopp 64 Jun 14 12:04 2 -> /dev/pts/3
 lr-x------ 1 hopp hopp 64 Jun 14 12:04 3 -> pipe:[82382]
 lr-x------ 1 hopp hopp 64 Jun 14 12:04 4 -> /proc/19632/fd
 }}}

 The file descriptor leaked by the example is {{{3 -> pipe:[82382]}}}. Is
 this a bug or am I doing something wrong?

-- 
Ticket URL: <https://svn.boost.org/trac10/ticket/13605>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2018-06-14 13:32:56 UTC