pybind11 embed leaves uncleaned processes












1















sim_wrapper.h



#pragma once
#include <pybind11/embed.h>

namespace n_sim
{
namespace py = pybind11;
// __attribute__ needed for pybind to work
class __attribute__((visibility("default"))) Sim
{
public:
Sim();
// python sim class instance we're using
py::object sim;

private:
// python module want to load into our C++ code.
py::module SimWrapModule;
// Needed to initialize pybind. As soon as this goes out of scope, pybind is un-initialized.
py::scoped_interpreter guard{};
};
}


sim_wrapper.cpp



#include <iostream>
#include "sim_wrapper.h"

using namespace n_sim;

Sim::Sim()
{
// import python module
SimWrapModule = py::module::import("wrapper");
// catch return values from python functions
sim = SimWrapModule.attr("initialize_sim")();
}

int main()
{
Sim* SimWrap = new Sim();
py::str name = SimWrap->sim.attr("name");
std::cout << name.cast<std::string>() << std::endl;
return 0;
}


When this program is run it print the name and program closes but it leaves three uncleaned processes. Tried gstack with these processes and all have output like,



$ gstack 22763
#0 0x00000036f42df3c8 in poll () from /lib64/libc.so.6
#1 0x00007f012a43867b in poll_poll () from /opt/debesys/ext/linux/x86-64/release/lib/python2.7/lib-dynload/select.so
#2 0x00007f01346b50cb in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
#3 0x00007f01346b65cd in PyEval_EvalCodeEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
#4 0x00007f0134631190 in function_call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
#5 0x00007f01345ff793 in PyObject_Call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
#6 0x00007f01346b1956 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
#7 0x00007f01346b65cd in PyEval_EvalCodeEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
#8 0x00007f01346b5ab5 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
#9 0x00007f01346b65cd in PyEval_EvalCodeEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
#10 0x00007f01346b5ab5 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
#11 0x00007f01346b65cd in PyEval_EvalCodeEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
#12 0x00007f0134631265 in function_call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
#13 0x00007f01345ff793 in PyObject_Call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
#14 0x00007f01346b1956 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
#15 0x00007f01346b65cd in PyEval_EvalCodeEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
#16 0x00007f01346b5ab5 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
#17 0x00007f01346b65cd in PyEval_EvalCodeEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
#18 0x00007f0134631265 in function_call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
#19 0x00007f01345ff793 in PyObject_Call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
#20 0x00007f01346b1956 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
#21 0x00007f01346b5b63 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
#22 0x00007f01346b5b63 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
#23 0x00007f01346b65cd in PyEval_EvalCodeEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
#24 0x00007f0134631190 in function_call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
#25 0x00007f01345ff793 in PyObject_Call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
#26 0x00007f013460e21d in instancemethod_call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
#27 0x00007f01345ff793 in PyObject_Call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
#28 0x00007f013466ac6f in slot_tp_init () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
#29 0x00007f01346697ef in type_call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
#30 0x00007f01345ff793 in PyObject_Call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
#31 0x00007f01346b2281 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
#32 0x00007f01346b5b63 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
#33 0x00007f01346b65cd in PyEval_EvalCodeEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
#34 0x00007f01346b5ab5 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
#35 0x00007f01346b65cd in PyEval_EvalCodeEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
#36 0x00007f0134631190 in function_call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
#37 0x00007f01345ff793 in PyObject_Call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
#38 0x00007f01346aff67 in PyEval_CallObjectWithKeywords () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
#39 0x0000000000417299 in pybind11::detail::simple_collector<(pybind11::return_value_policy)1>::call(_object*) const ()
#40 0x0000000000413c48 in _ZNK8pybind116detail10object_apiINS0_8accessorINS0_17accessor_policies8str_attrEEEEclILNS_19return_value_policyE1EJEEENS_6objectEDpOT0_ ()
#41 0x00000000004054b7 in n_sim::Sim::Sim() ()
#42 0x00000000004055f5 in main ()


Any idea on what need to be done to cleanly run this program?










share|improve this question



























    1















    sim_wrapper.h



    #pragma once
    #include <pybind11/embed.h>

    namespace n_sim
    {
    namespace py = pybind11;
    // __attribute__ needed for pybind to work
    class __attribute__((visibility("default"))) Sim
    {
    public:
    Sim();
    // python sim class instance we're using
    py::object sim;

    private:
    // python module want to load into our C++ code.
    py::module SimWrapModule;
    // Needed to initialize pybind. As soon as this goes out of scope, pybind is un-initialized.
    py::scoped_interpreter guard{};
    };
    }


    sim_wrapper.cpp



    #include <iostream>
    #include "sim_wrapper.h"

    using namespace n_sim;

    Sim::Sim()
    {
    // import python module
    SimWrapModule = py::module::import("wrapper");
    // catch return values from python functions
    sim = SimWrapModule.attr("initialize_sim")();
    }

    int main()
    {
    Sim* SimWrap = new Sim();
    py::str name = SimWrap->sim.attr("name");
    std::cout << name.cast<std::string>() << std::endl;
    return 0;
    }


    When this program is run it print the name and program closes but it leaves three uncleaned processes. Tried gstack with these processes and all have output like,



    $ gstack 22763
    #0 0x00000036f42df3c8 in poll () from /lib64/libc.so.6
    #1 0x00007f012a43867b in poll_poll () from /opt/debesys/ext/linux/x86-64/release/lib/python2.7/lib-dynload/select.so
    #2 0x00007f01346b50cb in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
    #3 0x00007f01346b65cd in PyEval_EvalCodeEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
    #4 0x00007f0134631190 in function_call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
    #5 0x00007f01345ff793 in PyObject_Call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
    #6 0x00007f01346b1956 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
    #7 0x00007f01346b65cd in PyEval_EvalCodeEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
    #8 0x00007f01346b5ab5 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
    #9 0x00007f01346b65cd in PyEval_EvalCodeEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
    #10 0x00007f01346b5ab5 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
    #11 0x00007f01346b65cd in PyEval_EvalCodeEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
    #12 0x00007f0134631265 in function_call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
    #13 0x00007f01345ff793 in PyObject_Call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
    #14 0x00007f01346b1956 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
    #15 0x00007f01346b65cd in PyEval_EvalCodeEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
    #16 0x00007f01346b5ab5 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
    #17 0x00007f01346b65cd in PyEval_EvalCodeEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
    #18 0x00007f0134631265 in function_call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
    #19 0x00007f01345ff793 in PyObject_Call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
    #20 0x00007f01346b1956 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
    #21 0x00007f01346b5b63 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
    #22 0x00007f01346b5b63 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
    #23 0x00007f01346b65cd in PyEval_EvalCodeEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
    #24 0x00007f0134631190 in function_call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
    #25 0x00007f01345ff793 in PyObject_Call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
    #26 0x00007f013460e21d in instancemethod_call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
    #27 0x00007f01345ff793 in PyObject_Call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
    #28 0x00007f013466ac6f in slot_tp_init () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
    #29 0x00007f01346697ef in type_call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
    #30 0x00007f01345ff793 in PyObject_Call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
    #31 0x00007f01346b2281 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
    #32 0x00007f01346b5b63 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
    #33 0x00007f01346b65cd in PyEval_EvalCodeEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
    #34 0x00007f01346b5ab5 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
    #35 0x00007f01346b65cd in PyEval_EvalCodeEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
    #36 0x00007f0134631190 in function_call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
    #37 0x00007f01345ff793 in PyObject_Call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
    #38 0x00007f01346aff67 in PyEval_CallObjectWithKeywords () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
    #39 0x0000000000417299 in pybind11::detail::simple_collector<(pybind11::return_value_policy)1>::call(_object*) const ()
    #40 0x0000000000413c48 in _ZNK8pybind116detail10object_apiINS0_8accessorINS0_17accessor_policies8str_attrEEEEclILNS_19return_value_policyE1EJEEENS_6objectEDpOT0_ ()
    #41 0x00000000004054b7 in n_sim::Sim::Sim() ()
    #42 0x00000000004055f5 in main ()


    Any idea on what need to be done to cleanly run this program?










    share|improve this question

























      1












      1








      1








      sim_wrapper.h



      #pragma once
      #include <pybind11/embed.h>

      namespace n_sim
      {
      namespace py = pybind11;
      // __attribute__ needed for pybind to work
      class __attribute__((visibility("default"))) Sim
      {
      public:
      Sim();
      // python sim class instance we're using
      py::object sim;

      private:
      // python module want to load into our C++ code.
      py::module SimWrapModule;
      // Needed to initialize pybind. As soon as this goes out of scope, pybind is un-initialized.
      py::scoped_interpreter guard{};
      };
      }


      sim_wrapper.cpp



      #include <iostream>
      #include "sim_wrapper.h"

      using namespace n_sim;

      Sim::Sim()
      {
      // import python module
      SimWrapModule = py::module::import("wrapper");
      // catch return values from python functions
      sim = SimWrapModule.attr("initialize_sim")();
      }

      int main()
      {
      Sim* SimWrap = new Sim();
      py::str name = SimWrap->sim.attr("name");
      std::cout << name.cast<std::string>() << std::endl;
      return 0;
      }


      When this program is run it print the name and program closes but it leaves three uncleaned processes. Tried gstack with these processes and all have output like,



      $ gstack 22763
      #0 0x00000036f42df3c8 in poll () from /lib64/libc.so.6
      #1 0x00007f012a43867b in poll_poll () from /opt/debesys/ext/linux/x86-64/release/lib/python2.7/lib-dynload/select.so
      #2 0x00007f01346b50cb in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #3 0x00007f01346b65cd in PyEval_EvalCodeEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #4 0x00007f0134631190 in function_call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #5 0x00007f01345ff793 in PyObject_Call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #6 0x00007f01346b1956 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #7 0x00007f01346b65cd in PyEval_EvalCodeEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #8 0x00007f01346b5ab5 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #9 0x00007f01346b65cd in PyEval_EvalCodeEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #10 0x00007f01346b5ab5 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #11 0x00007f01346b65cd in PyEval_EvalCodeEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #12 0x00007f0134631265 in function_call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #13 0x00007f01345ff793 in PyObject_Call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #14 0x00007f01346b1956 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #15 0x00007f01346b65cd in PyEval_EvalCodeEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #16 0x00007f01346b5ab5 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #17 0x00007f01346b65cd in PyEval_EvalCodeEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #18 0x00007f0134631265 in function_call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #19 0x00007f01345ff793 in PyObject_Call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #20 0x00007f01346b1956 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #21 0x00007f01346b5b63 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #22 0x00007f01346b5b63 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #23 0x00007f01346b65cd in PyEval_EvalCodeEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #24 0x00007f0134631190 in function_call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #25 0x00007f01345ff793 in PyObject_Call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #26 0x00007f013460e21d in instancemethod_call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #27 0x00007f01345ff793 in PyObject_Call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #28 0x00007f013466ac6f in slot_tp_init () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #29 0x00007f01346697ef in type_call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #30 0x00007f01345ff793 in PyObject_Call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #31 0x00007f01346b2281 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #32 0x00007f01346b5b63 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #33 0x00007f01346b65cd in PyEval_EvalCodeEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #34 0x00007f01346b5ab5 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #35 0x00007f01346b65cd in PyEval_EvalCodeEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #36 0x00007f0134631190 in function_call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #37 0x00007f01345ff793 in PyObject_Call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #38 0x00007f01346aff67 in PyEval_CallObjectWithKeywords () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #39 0x0000000000417299 in pybind11::detail::simple_collector<(pybind11::return_value_policy)1>::call(_object*) const ()
      #40 0x0000000000413c48 in _ZNK8pybind116detail10object_apiINS0_8accessorINS0_17accessor_policies8str_attrEEEEclILNS_19return_value_policyE1EJEEENS_6objectEDpOT0_ ()
      #41 0x00000000004054b7 in n_sim::Sim::Sim() ()
      #42 0x00000000004055f5 in main ()


      Any idea on what need to be done to cleanly run this program?










      share|improve this question














      sim_wrapper.h



      #pragma once
      #include <pybind11/embed.h>

      namespace n_sim
      {
      namespace py = pybind11;
      // __attribute__ needed for pybind to work
      class __attribute__((visibility("default"))) Sim
      {
      public:
      Sim();
      // python sim class instance we're using
      py::object sim;

      private:
      // python module want to load into our C++ code.
      py::module SimWrapModule;
      // Needed to initialize pybind. As soon as this goes out of scope, pybind is un-initialized.
      py::scoped_interpreter guard{};
      };
      }


      sim_wrapper.cpp



      #include <iostream>
      #include "sim_wrapper.h"

      using namespace n_sim;

      Sim::Sim()
      {
      // import python module
      SimWrapModule = py::module::import("wrapper");
      // catch return values from python functions
      sim = SimWrapModule.attr("initialize_sim")();
      }

      int main()
      {
      Sim* SimWrap = new Sim();
      py::str name = SimWrap->sim.attr("name");
      std::cout << name.cast<std::string>() << std::endl;
      return 0;
      }


      When this program is run it print the name and program closes but it leaves three uncleaned processes. Tried gstack with these processes and all have output like,



      $ gstack 22763
      #0 0x00000036f42df3c8 in poll () from /lib64/libc.so.6
      #1 0x00007f012a43867b in poll_poll () from /opt/debesys/ext/linux/x86-64/release/lib/python2.7/lib-dynload/select.so
      #2 0x00007f01346b50cb in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #3 0x00007f01346b65cd in PyEval_EvalCodeEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #4 0x00007f0134631190 in function_call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #5 0x00007f01345ff793 in PyObject_Call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #6 0x00007f01346b1956 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #7 0x00007f01346b65cd in PyEval_EvalCodeEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #8 0x00007f01346b5ab5 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #9 0x00007f01346b65cd in PyEval_EvalCodeEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #10 0x00007f01346b5ab5 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #11 0x00007f01346b65cd in PyEval_EvalCodeEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #12 0x00007f0134631265 in function_call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #13 0x00007f01345ff793 in PyObject_Call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #14 0x00007f01346b1956 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #15 0x00007f01346b65cd in PyEval_EvalCodeEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #16 0x00007f01346b5ab5 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #17 0x00007f01346b65cd in PyEval_EvalCodeEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #18 0x00007f0134631265 in function_call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #19 0x00007f01345ff793 in PyObject_Call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #20 0x00007f01346b1956 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #21 0x00007f01346b5b63 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #22 0x00007f01346b5b63 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #23 0x00007f01346b65cd in PyEval_EvalCodeEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #24 0x00007f0134631190 in function_call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #25 0x00007f01345ff793 in PyObject_Call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #26 0x00007f013460e21d in instancemethod_call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #27 0x00007f01345ff793 in PyObject_Call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #28 0x00007f013466ac6f in slot_tp_init () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #29 0x00007f01346697ef in type_call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #30 0x00007f01345ff793 in PyObject_Call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #31 0x00007f01346b2281 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #32 0x00007f01346b5b63 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #33 0x00007f01346b65cd in PyEval_EvalCodeEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #34 0x00007f01346b5ab5 in PyEval_EvalFrameEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #35 0x00007f01346b65cd in PyEval_EvalCodeEx () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #36 0x00007f0134631190 in function_call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #37 0x00007f01345ff793 in PyObject_Call () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #38 0x00007f01346aff67 in PyEval_CallObjectWithKeywords () from /opt/debesys/ext/linux/x86-64/release/lib/libpython2.7.so.1.0
      #39 0x0000000000417299 in pybind11::detail::simple_collector<(pybind11::return_value_policy)1>::call(_object*) const ()
      #40 0x0000000000413c48 in _ZNK8pybind116detail10object_apiINS0_8accessorINS0_17accessor_policies8str_attrEEEEclILNS_19return_value_policyE1EJEEENS_6objectEDpOT0_ ()
      #41 0x00000000004054b7 in n_sim::Sim::Sim() ()
      #42 0x00000000004055f5 in main ()


      Any idea on what need to be done to cleanly run this program?







      python-2.7 c++11 python-embedding pybind11






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 21 '18 at 14:14









      shrishindeshrishinde

      1,439920




      1,439920
























          1 Answer
          1






          active

          oldest

          votes


















          1














          This was happening because some of the resources held by Python module were not getting released. Wrote python function stop in python module and called that in C++ at the end solved this issue.



          Just before return I am now calling SimWrap->sim.attr("stop")();






          share|improve this answer





















          • 1





            Add more details for this to helpful for others...perhaps an ex.

            – vks
            Dec 3 '18 at 13:32











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53414013%2fpybind11-embed-leaves-uncleaned-processes%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          This was happening because some of the resources held by Python module were not getting released. Wrote python function stop in python module and called that in C++ at the end solved this issue.



          Just before return I am now calling SimWrap->sim.attr("stop")();






          share|improve this answer





















          • 1





            Add more details for this to helpful for others...perhaps an ex.

            – vks
            Dec 3 '18 at 13:32
















          1














          This was happening because some of the resources held by Python module were not getting released. Wrote python function stop in python module and called that in C++ at the end solved this issue.



          Just before return I am now calling SimWrap->sim.attr("stop")();






          share|improve this answer





















          • 1





            Add more details for this to helpful for others...perhaps an ex.

            – vks
            Dec 3 '18 at 13:32














          1












          1








          1







          This was happening because some of the resources held by Python module were not getting released. Wrote python function stop in python module and called that in C++ at the end solved this issue.



          Just before return I am now calling SimWrap->sim.attr("stop")();






          share|improve this answer















          This was happening because some of the resources held by Python module were not getting released. Wrote python function stop in python module and called that in C++ at the end solved this issue.



          Just before return I am now calling SimWrap->sim.attr("stop")();







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Dec 6 '18 at 4:53

























          answered Dec 3 '18 at 13:30









          shrishindeshrishinde

          1,439920




          1,439920








          • 1





            Add more details for this to helpful for others...perhaps an ex.

            – vks
            Dec 3 '18 at 13:32














          • 1





            Add more details for this to helpful for others...perhaps an ex.

            – vks
            Dec 3 '18 at 13:32








          1




          1





          Add more details for this to helpful for others...perhaps an ex.

          – vks
          Dec 3 '18 at 13:32





          Add more details for this to helpful for others...perhaps an ex.

          – vks
          Dec 3 '18 at 13:32




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53414013%2fpybind11-embed-leaves-uncleaned-processes%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          Hercules Kyvelos

          Tangent Lines Diagram Along Smooth Curve

          Yusuf al-Mu'taman ibn Hud