[Ace-users] [tao-bugs] Crash in TAO_ORB_Core_Static_Resources::instance()

J.T. Conklin jtc at acorntoolworks.com
Thu Nov 1 23:23:56 CDT 2007


"Johnny Willemsen" <jwillemsen at remedy.nl> writes:
> Thanks for using the PRF form. Can you make a small reproducer, report the
> problem in bugzilla and then put the test in svn with the given bugzilla
> number. 

Hi Johnny,

It took most of the day, but I think I've tracked down the root cause.
It's not strictly an ACE/TAO problem, but there may be a workaround we
can add until it's addressed in NetBSD.

In NetBSD, the pthread library is initialized by the function
pthread_init().  This is set up as a static constructor with gcc's
__constructor__ function attribute.  As C++ programmers well know, the
order of static constructor execution is not well defined, and that is
exactly what was happening.  The TAO static ctor was using the new
ACE_Service_Gestalt, which uses thread specific storage; but it ran
_before_ the libpthread static ctor actually initialized the thread
library.

I've got some of my failing programs to work, by fiddling around with
the order libraries are specified on the compiler's command line, but
this seems too fragile for any practical use.

Ultimately, NetBSD folks will have to fix this somehow.  But to support 
current versions, ACE/TAO may have to add something like:

#if __NetBSD__
   extern int __isthreaded;
   if (__isthreaded == 0) {
      pthread_init ();
   }
#endif

to one or more of the wrapper facades.  For this particular failure,
I'm hoping just ACE_OS::thr_keycreate() will be enough.  I'll know
more when I try it out tomorrow.

    --jtc

-- 
J.T. Conklin



More information about the Ace-users mailing list