summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsma <sma@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2013-04-24 08:21:15 +0000
committersma <sma@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2013-04-24 08:21:15 +0000
commit0c62b2709209ed7928f011d958784feda1f6254a (patch)
tree6cfaa4ab4aaac04a51686b063e07da5b3fb95192
parentc8e812f017a1c6926e1de84d1332c6c6ea1e79ef (diff)
downloadATCD-0c62b2709209ed7928f011d958784feda1f6254a.tar.gz
Wed Apr 24 08:21:00 UTC 2013 Simon Massey <simon dot massey at prismtech dot com> fix for thread unsafe singleton TAO::Unknown_IDL_Type::lock_i ()
-rw-r--r--TAO/ChangeLog15
-rw-r--r--TAO/tao/AnyTypeCode/AnyTypeCode_Adapter_Impl.cpp8
2 files changed, 23 insertions, 0 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index 488d1a27857..ddf5b69006f 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,18 @@
+Wed Apr 24 08:21:00 UTC 2013 Simon Massey <simon dot massey at prismtech dot com>
+
+ * tao/AnyTypeCode/AnyTypeCode_Adapter_Impl.cpp:
+
+ Thread unsafe singleton TAO::Unknown_IDL_Type::lock_i ()
+ initialization, used with any demarshaling, moved into dynamic
+ library loading initalization. This now happens prior to main
+ which is single threaded. Priviously, and only very rarely, multiple
+ threads attempt to demarshal the "first" Unknown_IDL_Type
+ and they all race to initialise the lock resulting in non-multual
+ exculsion and multiple partial locks being created, followed by
+ pure virtual functions being called and finaly aborts.
+ Failure occured appoximatly once every 300000 startups making this
+ impossialble to test and hard to detect.
+
Tue Apr 23 17:13:04 UTC 2013 Phil Mesnier <mesnier_p@ociweb.com>
* orbsvcs/ImplRepo_Service/ImR_ResponseHandler.h:
diff --git a/TAO/tao/AnyTypeCode/AnyTypeCode_Adapter_Impl.cpp b/TAO/tao/AnyTypeCode/AnyTypeCode_Adapter_Impl.cpp
index 7b75c7130ed..7dbf88c5b16 100644
--- a/TAO/tao/AnyTypeCode/AnyTypeCode_Adapter_Impl.cpp
+++ b/TAO/tao/AnyTypeCode/AnyTypeCode_Adapter_Impl.cpp
@@ -6,6 +6,7 @@
#include "tao/AnyTypeCode/WrongTransactionA.h"
#include "tao/AnyTypeCode/PolicyA.h"
#include "tao/AnyTypeCode/Any.h"
+#include "tao/AnyTypeCode/Any_Unknown_IDL_Type.h"
#include "tao/AnyTypeCode/BooleanSeqA.h"
#include "tao/AnyTypeCode/OctetSeqA.h"
@@ -290,6 +291,13 @@ TAO_AnyTypeCode_Adapter_Impl::insert_into_any (CORBA::Any * any, const CORBA::WS
int
TAO_AnyTypeCode_Adapter_Impl::Initializer (void)
{
+ // The TAO::Unknown_IDL_Type::lock_i () is a PRIVATE thread unsafe singleton
+ // which we need to initialise before Unknown_IDL_Types are used in a
+ // threaded environment. This singleton is called for every constructed
+ // Unknown_IDL_Type, so just create a throw-a-way from a null typecode.
+ TAO::Unknown_IDL_Type singleton_initaliser (0);
+ ACE_UNUSED_ARG (singleton_initaliser);
+
return ACE_Service_Config::process_directive (
ace_svc_desc_TAO_AnyTypeCode_Adapter_Impl);
}