Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Python API] Segfault when creating RenderJob on shallow copy of a scene #13

Open
eliemichel opened this issue May 3, 2017 · 1 comment

Comments

@eliemichel
Copy link

eliemichel commented May 3, 2017

I am following section 13.2.7 of the manual in order to render animation frames on different machines, and in particular creates a so called shallow copy of the scene using newScene = Scene(scene), but whenever I create a render job on it, it crashes.

Steps to reproduce

Open a Python session and run:

import mitsuba
from mitsuba.core import *
from mitsuba.render import Scene, SceneHandler, RenderQueue, RenderJob
scene = SceneHandler.loadScene('scene.xml'))
scheduler = Scheduler.getInstance()
scheduler.registerWorker(LocalWorker(0, 'worker'))
scheduler.start()
queue = RenderQueue()
job = RenderJob('jobName', Scene(scene), queue)

The last line raises a segfault with the following backtrace:

(gdb) bt
#0  0x00007ffff5b419b3 in mitsuba::RenderJob::RenderJob(std::string const&, mitsuba::Scene*, mitsuba::RenderQueue*, int, int, int, bool, bool) ()
   from /cal/homes/emichel/src/mitsuba/build/binaries/libmitsuba-render.so
#1  0x00007ffff64cec88 in boost::python::objects::make_holder<3>::apply<boost::python::objects::pointer_holder<mitsuba::ref<mitsuba::RenderJob>, mitsuba::RenderJob>, boost::mpl::joint_view<boost::python::detail::drop1<boost::python::detail::type_list<std::string const&, mitsuba::Scene*, mitsuba::RenderQueue*, boost::python::optional<int, int, int, bool, bool, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_>, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_> >, boost::python::optional<int, int, int, bool, bool, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_> > >::execute(_object*, std::string const&, mitsuba::Scene*, mitsuba::RenderQueue*) ()
   from /cal/homes/emichel/src/mitsuba/build/binaries/python/mitsuba.so
#2  0x00007ffff64f6c26 in boost::python::objects::caller_py_function_impl<boost::python::detail::caller<void (*)(_object*, std::string const&, mitsuba::Scene*, mitsuba::RenderQueue*), boost::python::default_call_policies, boost::mpl::vector5<void, _object*, std::string const&, mitsuba::Scene*, mitsuba::RenderQueue*> > >::operator()(_object*, _object*) ()
   from /cal/homes/emichel/src/mitsuba/build/binaries/python/mitsuba.so
#3  0x00007ffff54a60ed in operator() (kw=0x0,
    args=(<RenderJob at remote 0x7ffff6ce2fc8>, 'jobName', <Scene at remote 0x7ffff6ce2f70>, <RenderQueue at remote 0x7ffff6ce2f18>), this=0xc0ffb0) at ./boost/python/object/py_function.hpp:143
#4  boost::python::objects::function::call (this=0xc0ffa0,
    args=(<RenderJob at remote 0x7ffff6ce2fc8>, 'jobName', <Scene at remote 0x7ffff6ce2f70>, <RenderQueue at remote 0x7ffff6ce2f18>), keywords=0x0) at libs/python/src/object/function.cpp:226
#5  0x00007ffff54a6308 in operator() (this=<optimized out>)
    at libs/python/src/object/function.cpp:585
#6  boost::detail::function::void_function_ref_invoker0<boost::python::objects::(anonymous namespace)::bind_return, void>::invoke (function_obj_ptr=...) at ./boost/function/function_template.hpp:188
#7  0x00007ffff54b0793 in operator() (this=0x7fffffffdc90)
    at ./boost/function/function_template.hpp:767
#8  boost::python::handle_exception_impl (f=...) at libs/python/src/errors.cpp:25
#9  0x00007ffff54a4ae9 in handle_exception<boost::python::objects::(anonymous namespace)::bind_return> (f=...) at ./boost/python/errors.hpp:29
#10 boost::python::objects::function_call (func=<optimized out>, args=<optimized out>,
    kw=<optimized out>) at libs/python/src/object/function.cpp:626
#11 0x0000000000502ab8 in PyObject_Call (kw=<optimized out>, arg=<optimized out>,
    func=<optimized out>) at ../Objects/abstract.c:2529
#12 instancemethod_call.lto_priv () at ../Objects/classobject.c:2602
#13 0x0000000000501afa in PyObject_Call (kw=0x0,
    arg=('jobName', <Scene at remote 0x7ffff6ce2f70>, <RenderQueue at remote 0x7ffff6ce2f18>),
    func=<instancemethod at remote 0x7ffff7f58b90>) at ../Objects/abstract.c:2529
#14 slot_tp_init.lto_priv () at ../Objects/typeobject.c:5692
#15 0x00000000004b988b in type_call.lto_priv () at ../Objects/typeobject.c:745
#16 0x00000000004c9e8b in PyObject_Call (kw=<optimized out>, arg=<optimized out>,
    func=<optimized out>) at ../Objects/abstract.c:2529
#17 do_call (nk=<optimized out>, na=<optimized out>, pp_stack=<optimized out>,
    func=<optimized out>) at ../Python/ceval.c:4251
#18 call_function (oparg=<optimized out>, pp_stack=<optimized out>) at ../Python/ceval.c:4056
#19 PyEval_EvalFrameEx () at ../Python/ceval.c:2679
#20 0x00000000004c7a59 in PyEval_EvalCodeEx () at ../Python/ceval.c:3265
#21 0x000000000050160f in PyEval_EvalCode (
    locals={'InterpolatedSpectrum': <Boost.Python.class at remote 0xba5a10>, 'getPrivateMemoryUsage': <Boost.Python.function at remote 0xbfb6f0>, 'getTotalSystemMemory': <Boost.Python.function at remote 0xbfb760>, 'Point3i': <Boost.Python.class at remote 0xbd31e0>, 'SHRotation': <Boost.Python.class at remote 0xc03970>, 'NativeBuffer': <Boost.Python.class at remote 0xbafdc0>, 'sampleTEA': <Boost.Python.function at remote 0xbfbca0>, 'mitsuba': <module at remote 0x7ffff7ea9ad0>, 'radicalInverse2': <Boost.Python.function at remote 0xbfb990>, 'SceneHandler': <Boost.Python.class at remote 0xc0f120>, 'getHostName': <Boost.Python.function at remote 0xbfb680>, 'fresnelConductorExact': <Boost.Python.function at remote 0xbfb1b0>, 'Epsilon': <float at remote 0x9d66d0>, 'Object': <Boost.Python.class at remote 0xb95380>, 'StringVector': <Boost.Python.class at remote 0xb90ee0>, 'Scheduler': <Boost.Python.class at remote 0xbb9f80>, 'WorkProcessor': <Boost.Python.class at remote 0xbb6210>, 'MTS_VERSION': '0.5.0', 'getCoreCount': <Boost....(truncated),
    globals={'InterpolatedSpectrum': <Boost.Python.class at remote 0xba5a10>, 'getPrivateMemoryUsage': <Boost.Python.function at remote 0xbfb6f0>, 'getTotalSystemMemory': <Boost.Python.function at remote 0xbfb760>, 'Point3i': <Boost.Python.class at remote 0xbd31e0>, 'SHRotation': <Boost.Python.class---Type <return> to continue, or q <return> to quit---
 at remote 0xc03970>, 'NativeBuffer': <Boost.Python.class at remote 0xbafdc0>, 'sampleTEA': <Boost.Python.function at remote 0xbfbca0>, 'mitsuba': <module at remote 0x7ffff7ea9ad0>, 'radicalInverse2': <Boost.Python.function at remote 0xbfb990>, 'SceneHandler': <Boost.Python.class at remote 0xc0f120>, 'getHostName': <Boost.Python.function at remote 0xbfb680>, 'fresnelConductorExact': <Boost.Python.function at remote 0xbfb1b0>, 'Epsilon': <float at remote 0x9d66d0>, 'Object': <Boost.Python.class at remote 0xb95380>, 'StringVector': <Boost.Python.class at remote 0xb90ee0>, 'Scheduler': <Boost.Python.class at remote 0xbb9f80>, 'WorkProcessor': <Boost.Python.class at remote 0xbb6210>, 'MTS_VERSION': '0.5.0', 'getCoreCount': <Boost....(truncated), co=0x7ffff7eeaa30) at ../Python/ceval.c:667
#22 run_mod.lto_priv () at ../Python/pythonrun.c:1371
#23 0x00000000004495f2 in PyRun_InteractiveOneFlags (fp=0x0,
    fp@entry=0x7ffff72974e0 <_IO_2_1_stdin_>, filename=0x0, filename@entry=0x603d84 "<stdin>",
    flags=0x7fffffffe2e0) at ../Python/pythonrun.c:858
#24 0x000000000044941e in PyRun_InteractiveLoopFlags (fp=fp@entry=0x7ffff72974e0 <_IO_2_1_stdin_>,
    filename=filename@entry=0x603d84 "<stdin>", flags=flags@entry=0x7fffffffe2e0)
    at ../Python/pythonrun.c:778
#25 0x000000000042d405 in PyRun_AnyFileExFlags (fp=0x7ffff72974e0 <_IO_2_1_stdin_>,
    filename=<optimized out>, closeit=0, flags=0x7fffffffe2e0) at ../Python/pythonrun.c:747
#26 0x00000000004981cd in Py_Main () at ../Modules/main.c:640
#27 0x00007ffff6f12b45 in __libc_start_main (main=0x497c60 <main>, argc=1, argv=0x7fffffffe4a8,
    init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>,
    stack_end=0x7fffffffe498) at libc-start.c:287
#28 0x0000000000497b8b in _start ()
@FlorentinJ
Copy link

I came across the same problem.
Try adding a "newScene.configure()" after copying and before rendering, it solved the issue in my case.
I found this inside "scene.h" ( https://searchcode.com/codesearch/view/46787189/ ), I guess sometimes looking into the code can be helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants