I found the cause. On the surface, my
problem appears to be Map<int, Thread*> threadids in
Thread_win32.cc not storing Thread*, which results in NULL entry returned,
causing crash. For example, first time
Thread::initialize() is called from RTRT’s constructor, after threadids is set in
the middle of initialize(), threadids naturally has size one. The second time Thread::initialize() is
called, prior to setting another thread (could still be the main thread) to
threadids, I see threadids has size 0. The previously set entry was gone. Looking deeper, the second invocation of
Thread::initialize() was done from my scene_0.dll rather than strictly from
manta.exe. That is: Our manta.exe calls ReadMOScene() Loads scene_0.dll via LoadLibrary() Fine the function pointer “make_scene” in
scene_0.dll and call it Now in the .dll, this function calls new
Group(), which constructs Barrier, which eventually calls Thread::initialize(). At this second ::initialize, the threadids
has size 0 rather than 1. As I haven’t observed the threadids being
changed else where, it almost seems that the code going into the .dll creates a
new copy of threadids. And indeed, I created some static integers for testing
and similar results are observed. Probably some simple DLL concept I am not
aware of? Thanks Bo From: Abe Stephens
[mailto:
My guess is that this is an initialization problem with some of the
static variables in Thread, possibly related to how the dlls are loaded. To debug, it might be useful to disable the exception handler which is
printing the stack trace. This mechanism is leftover from a SCIRun dependency
and is easily disabled with an environment variable: THREAD_NO_CATCH_SIGNAL=1.
Toss the program in a debugger and take a look at those static variables.
The suspect functions are self() in Thread_win32.cc and couldBlock() in
Thread.cc. Abe On Oct 29, 2008, at 9:34 AM, Bo Huang wrote:
Hi In Scene* Factory::readMOScene(), after successfully loading a .dll such as scene_0.dll, and
locating the dll’s ‘make_scene’ function, a valid Scene object is generated for
RTRT. However, when rendering starts, I get the
Thread crash as shown in the attached image. This crash does not occur if I do not
load the ‘make_scene’ function from a dll, and instead include 0.cc, which
contains the ‘make_scene’ source to be compiled into Factory.cc. I understand this is more Windows
centric. I would be interested in knowing how come Thread::couldBlock() self
fails and the meaning. Thanks Bo <manta_thread_crash.PNG> |
Archive powered by MHonArc 2.6.16.