Crash on rtcCommit()

Crash on rtcCommit()

I'm trying to use embree to raycast a set of quads. I've created a simple, command line test application, which runs fine and provides the expected results. However, if I integrate the same code in a Qt-based application, the application crashes when I submit the scene with rtcCommit(); the backtrace shows that the crash occurs inside the method tbb:interface7::internal::task_arena_base::internal_initialize(), called from rtcCommit(). This is the code I use to initialize embree, create the scene and submit it:

RTCDevice device = rtcNewDevice();
RTCScene scene = rtcDeviceNewScene( device, RTC_SCENE_STATIC, RTC_INTERSECT1 );

unsigned geomID = rtcNewQuadMesh2( scene, RTC_GEOMETRY_STATIC, num_quads, num_verts, 1 );

embree_vertex_t* verts_ptr = ( embree_vertex_t* )rtcMapBuffer( scene, geomID, RTC_VERTEX_BUFFER );
setup_verts_buffer( rectangles_, verts_ptr );  // fills vertex data based on the geometry stored in rectangles_
rtcUnmapBuffer( scene, geomID, RTC_VERTEX_BUFFER );

embree_quad_t* quads_ptr = ( embree_quad_t* )rtcMapBuffer( scene, geomID, RTC_INDEX_BUFFER );
setup_quads_buffer( rectangles_, quads_ptr );  // fills index data based on the geometry stored in rectangles_
rtcUnmapBuffer( scene, geomID, RTC_INDEX_BUFFER );

rtcCommit( scene );

This code is contained inside a static method of a class. Also note that I'm using Embree 2.16.4 under MacOS X 10.11. Any help on the possible causes of the problem or suggestions on how to further investigate this are highly appreciated!

Thanks, cheers

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

This sounds like an initialization issue with TBB. You have to invoke Embree API calls from the main function of your program, not from the constructor of a global variable.

Also could you try to pass "start_threads=1" to rtcNewDevice. This will likely cause the crash in rtcNewDevice.

Thank you very much for your reply! I tried passing the parameter "start_threads=1" to rtcNewDevice(), but the crash still occurs in rtcCommit().

Due to the design of my application, using embree inside the main() function is not possible. Should it be maybe the same thread as the one running the main function? As of now, all embree API calls are made inside a QT slot; however, I am now also making sure that they are not made from a static method.

 

Maybe try the following the narrow down the issue:

1) try to move the Embree invocation to a different location of the code, e.g. into the main function, just to see if that works

2) invoke just a tbb::parallel_for(0,10000,[] (int i) { volatile int k =i; }) instead of the Embree code to see if Embree is causing the issue at all

3) Could you send us the backtrace of the crash, maybe this gives more insights

 

Leave a Comment

Please sign in to add a comment. Not a member? Join today