Dear List,

Attached is the patch file to apply to the STAF 3.3.3 source tree in order
to compile it with Sun Studio C++ compiler on Solaris 10 (sparc) OS.

The build system that I use here was:

$ uname -a
SunOS oberon 5.10 Generic_137137-09 sun4u sparc SUNW,Sun-Fire-880
$ CC -V
CC: Sun C++ 5.9 SunOS_sparc Patch 124863-04 2008/04/16

The patch file is very similar to the one that I posted earlier (2008-11-19)
for OpenSolaris x86, which is available from
http://sourceforge.net/tracker/?func=detail&aid=2316610&group_id=33142&atid=
407383

During the Sun CC/Solaris port however I have come across a strange
exception while executing a shutdown request. A demo and debugger transcript
of this problem is also attached.
I have come to the conclusion that the exception is caused by
initialization/destruction sequence by one of STL containers. 


Lastly, could STAF developers/team please schedule this patch to be
integrated into main truck?

I understand that it is exceedingly difficult to support multitude of C++
compilers and platforms. However please note;
1- Gcc ABI and name mangling scheme is different and incompatible with Sun
CC's one.
2- Sun CC is the native compiler on Solaris platform and comes with plethora
of tools that Gcc may not have.
3- Especially in our case we have very large code base compilable only by
Sun CC which we intend to integrate with STAF. Due to the issue indicated in
#1, compiling STAF with Sun CC is a necessity for us. On the other hand
re-applying the patch to the every new STAF release is not a desirable
prospect.


I believe my patches can be reviewed/integrated within an hour, as changes
are mostly guarded by conditionals which would not affect other platforms
that STAF currently supports.


Thanks, regards,
Semih Cemiloglu 

diff -bwruN -x '*.bak' -x '*.org' -x CVS src.gcc4sun/staf/build/makefile.suncc 
src/staf/build/makefile.suncc
--- src.gcc4sun/staf/build/makefile.suncc       1970-01-01 10:00:00.000000000 
+1000
+++ src/staf/build/makefile.suncc       2009-04-23 16:21:02.783368600 +1000
@@ -0,0 +1,68 @@
+#############################################################################
+# Software Testing Automation Framework (STAF)                              #
+# (C) Copyright IBM Corp. 2001                                              #
+#                                                                           #
+# This software is licensed under the Eclipse Public License (EPL) V1.0.    #
+#############################################################################
+
+#########################
+# Setup C/C++ variables #
+#########################
+
+CC_CC             := CC -mt
+CC_C              := cc -mt
+CC_MK_SHARED_LIB  := CC -mt -G
+
+ifeq ($(BUILD_TYPE),retail)
+    CC_BUILD_TYPE_FLAGS = $(CC_OPTIMIZE) -DNDEBUG
+else
+    CC_BUILD_TYPE_FLAGS = $(CC_DEBUG)
+endif
+
+CC_DEBUG        := -g #-g0
+CC_OPTIMIZE     := #-xO2
+CC_FPIC         := -KPIC
+CC_STL_PTHREADS := -D_PTHREADS
+CC_SHAREDLIBNAMEFLAGS = -DSTAF_SHARED_LIB_PREFIX=$(OS_SHARED_LIB_PREFIX) \
+                        -DSTAF_SHARED_LIB_SUFFIX=$(OS_SHARED_LIB_SUFFIX)
+                        
+ifeq ($(OS_NAME),solaris)
+    ifeq ($(BUILD_ARCH),SPARC64)
+        CC_ARCHFLAGS = -m64
+    endif    
+    ifeq ($(BUILD_ARCH),x64-64)
+        CC_ARCHFLAGS = -m64
+    endif
+endif    
+
+CC_COMMONFLAGS = $(OS_COMMONFLAGS) $(COMMONFLAGS) $(CC_FPIC)\
+                 $(CC_BUILD_TYPE_FLAGS) $(CC_SHAREDLIBNAMEFLAGS)\
+                 $(CC_STL_PTHREADS) -DSTAF_NATIVE_COMPILER\
+                 $(CC_ARCHFLAGS) 
+
+CC_CFLAGS = $(CC_COMMONFLAGS) $(CFLAGS)
+
+CC_LINKFLAGS     = $(CC_COMMONFLAGS) $(LINKFLAGS)
+CC_SHARED_LIB_LINKFLAGS = $(CC_COMMONFLAGS) $(LINKFLAGS)
+
+
+##########################################
+# Set commands needed by master makefile #
+##########################################
+
+CC_DEPEND_IT     = cd $(@D); $(CC_CC) -xM1 $(CC_CFLAGS) $(ALL_INCLUDEDIR_LIST) 
\
+                   $< | sed -e 's...@\(.*\)\.o:@$(@D)/\1.o $(@D)/\1.d:@' >$@
+
+CC_DEPEND_IT_C   = cd $(@D); $(CC_C) -xM1 $(CC_CFLAGS) $(ALL_INCLUDEDIR_LIST) \
+                   $< | sed -e 's...@\(.*\)\.o:@$(@D)/\1.o $(@D)/\1.d:@' >$@
+
+CC_COMPILE_IT    = $(CC_CC) -c -o $@ $(CC_CFLAGS) $(ALL_INCLUDEDIR_LIST) $<
+
+CC_COMPILE_IT_C  = $(CC_C) -c -o $@ $(CC_CFLAGS) $(ALL_INCLUDEDIR_LIST) $<
+
+CC_LINK_IT       = $(CC_CC) -o $@ $(CC_LINKFLAGS) $(ALL_INCLUDEDIR_LIST)\
+                   $(ALL_LIBDIR_LIST) $(ALL_LIB_LIST) $(OBJS)
+
+CC_SHARED_LIB_IT = $(CC_MK_SHARED_LIB) -o $@ $(CC_SHARED_LIB_LINKFLAGS) \
+                   $(ALL_INCLUDEDIR_LIST) $(ALL_LIBDIR_LIST) $(ALL_LIB_LIST) \
+                   $(OBJS)
diff -bwruN -x '*.bak' -x '*.org' -x CVS 
src.gcc4sun/staf/connproviders/tcp/STAFTCPConnProvider.cpp 
src/staf/connproviders/tcp/STAFTCPConnProvider.cpp
--- src.gcc4sun/staf/connproviders/tcp/STAFTCPConnProvider.cpp  2009-03-30 
15:02:49.000000000 +1100
+++ src/staf/connproviders/tcp/STAFTCPConnProvider.cpp  2009-04-28 
16:01:41.454987100 +1000
@@ -1185,7 +1185,10 @@
         {
             STAFMutexSemLock lock(sActiveProvidersSem);
 
-            if (!initedAtExit) atexit(atExit);
+            if (!initedAtExit) { 
+              atexit(atExit);
+              initedAtExit = true;
+            }
         }
 
         STAFTCPConnectionProviderImpl tcpData;
diff -bwruN -x '*.bak' -x '*.org' -x CVS src.gcc4sun/staf/makefile 
src/staf/makefile
--- src.gcc4sun/staf/makefile   2009-03-30 15:03:20.000000000 +1100
+++ src/staf/makefile   2009-04-23 14:59:59.715827100 +1000
@@ -601,55 +601,55 @@
 define COPY_FILE
     @$(CREATE_PATH)
     @echo "*** Copying $(@F) ***"
-    @$(COPY) $< $@
+    $(COPY) $< $@
 endef
 
 define RXPP_IT
     @$(CREATE_PATH)
     @echo "*** Building $(@F) ***"
-    @PATH=$(REXX_IMAGE_DIR):$$PATH RXPPPATH='$(subst $(SPACE),$(OS_PS),$(strip 
$(RXPP_PATH)))' $(RXPP) '$(OS_<)' '$(OS_@)'
+    PATH=$(REXX_IMAGE_DIR):$$PATH RXPPPATH='$(subst $(SPACE),$(OS_PS),$(strip 
$(RXPP_PATH)))' $(RXPP) '$(OS_<)' '$(OS_@)'
 endef
 
 define STRIP_IT
     @echo "*** Stripping $(@F) ***"
-    @$(STRIP) $@
+    $(STRIP) $@
 endef
 
 define C_DEPEND_IT
     @$(CREATE_PATH)
     @echo "*** Generating dependency for $(@F) *** "
-    @$(CC_DEPEND_IT)
+    $(CC_DEPEND_IT)
 endef
 
 define C_DEPEND_IT_C
     @$(CREATE_PATH)
     @echo "*** Generating dependency for $(@F) *** "
-    @$(CC_DEPEND_IT_C)
+    $(CC_DEPEND_IT_C)
 endef
 
 define COMPILE_IT
     @$(CREATE_PATH)
     @echo "*** Compiling $(@F) ***"
-    @$(CC_COMPILE_IT)
+    $(CC_COMPILE_IT)
 endef
 
 define COMPILE_IT_C
     @$(CREATE_PATH)
     @echo "*** Compiling $(@F) ***"
-    @$(CC_COMPILE_IT_C)
+    $(CC_COMPILE_IT_C)
 endef
 
 define LINK_IT
     @$(CREATE_PATH)
     @echo "*** Linking $(@F) ***"
-    @$(CC_LINK_IT)
+    $(CC_LINK_IT)
 endef
 
 define SHARED_LIB_IT
     @$(CREATE_PATH)
     @echo "*** Linking shared library $(@F) ***"
     @$(CC_SHARED_LIB_IT)
-    @$(MOVE_SIDE_DECK)
+    $(MOVE_SIDE_DECK)
 endef
 
 # Setup our global inference rules
diff -bwruN -x '*.bak' -x '*.org' -x CVS 
src.gcc4sun/staf/stafif/STAFCommandParser.cpp 
src/staf/stafif/STAFCommandParser.cpp
--- src.gcc4sun/staf/stafif/STAFCommandParser.cpp       2009-03-30 
15:03:48.000000000 +1100
+++ src/staf/stafif/STAFCommandParser.cpp       2009-04-23 14:54:29.845564800 
+1000
@@ -853,7 +853,9 @@
         }
         else
         {
-            #ifdef STAF_OS_NAME_HPUX
+            #if defined(STAF_OS_NAME_HPUX)
+                std::distance(iterPair.first, iterPair.second, *numTimes);
+            #elif defined(STAF_OS_NAME_SOLARIS) && defined(__SUNPRO_CC)
                 std::distance(iterPair.first, iterPair.second, *numTimes);
             #else
                 *numTimes = std::distance(iterPair.first, iterPair.second);
diff -bwruN -x '*.bak' -x '*.org' -x CVS 
src.gcc4sun/staf/stafif/STAFConnectionProviderInlImpl.cpp 
src/staf/stafif/STAFConnectionProviderInlImpl.cpp
--- src.gcc4sun/staf/stafif/STAFConnectionProviderInlImpl.cpp   2009-03-30 
15:03:48.000000000 +1100
+++ src/staf/stafif/STAFConnectionProviderInlImpl.cpp   2009-04-28 
16:40:19.707615000 +1000
@@ -225,9 +225,17 @@
 
 STAF_INLINE STAFConnectionProvider::~STAFConnectionProvider()
 {
+  try {
     fFuncTable.provDestruct(&fProvider, 0, 0, 0);
     STAFDynamicLibraryClose(&fConnLib, 0);
 }
+  catch(STAFException& se) {
+    se.write("STAFConnectionProvider::~STAFConnectionProvider()", std::cerr);
+  }
+  catch(...) {
+    std::cerr << "Unknown exception at 
STAFConnectionProvider::~STAFConnectionProvider()" << endl;
+  }
+}
 
 
 STAF_INLINE STAFConnectionProvider::STAFConnectionProvider(
diff -bwruN -x '*.bak' -x '*.org' -x CVS src.gcc4sun/staf/stafif/STAFTrace.h 
src/staf/stafif/STAFTrace.h
--- src.gcc4sun/staf/stafif/STAFTrace.h 2009-03-30 15:03:49.000000000 +1100
+++ src/staf/stafif/STAFTrace.h 2009-04-23 14:54:38.427925600 +1000
@@ -54,17 +54,6 @@
     kSTAFTraceAll                 = 0xFFFFFFFF
 } STAFTracePoint_t;
 
-#ifdef __cplusplus
-
-inline STAFTracePoint_t operator|(const STAFTracePoint_t lhs,
-                                  const STAFTracePoint_t rhs)
-{
-    return static_cast<STAFTracePoint_t>(static_cast<unsigned int>(lhs) |
-                                         static_cast<unsigned int>(rhs));
-}
-
-#endif
-
 typedef enum STAFTraceDestination_e
 {
     kSTAFTraceToStdout        = 0,
@@ -201,6 +190,13 @@
 };
 
 // Now include inline definitions
+inline STAFTracePoint_t operator|(const STAFTracePoint_t lhs,
+                                  const STAFTracePoint_t rhs)
+{
+    return static_cast<STAFTracePoint_t>(static_cast<unsigned int>(lhs) |
+                                         static_cast<unsigned int>(rhs));
+}
+
 
 #ifndef STAF_NATIVE_COMPILER
 #include "STAFTraceInlImpl.cpp"
diff -bwruN -x '*.bak' -x '*.org' -x CVS src.gcc4sun/staf/test/testrwsem.cpp 
src/staf/test/testrwsem.cpp
--- src.gcc4sun/staf/test/testrwsem.cpp 2009-03-30 15:03:55.000000000 +1100
+++ src/staf/test/testrwsem.cpp 2009-04-23 14:53:26.969605300 +1000
@@ -55,6 +55,10 @@
 
 //        gRWSem.readUnlock();
     }
+#if defined(STAF_OS_NAME_SOLARIS) && defined(__SUNPRO_CC)
+    return 0;
+#endif
+
 }
 
 
# Starting STAFProc
oberon$ STAFProc &
[1] 15623
oberon$ 
Machine          : oberon
Machine nickname : oberon
Startup time     : 20090428-16:24:01

STAFProc version 3.3.3 initialized

# Attaching debugger to STAFProc process
oberon$ dbx - 15623
For information about new features see `help changes'
To remove this message, put `dbxenv suppress_startup_message 7.6' in your .dbxrc
Reading STAFProc
Reading ld.so.1
Reading libumem.so.1
Reading libpthread.so.1
Reading libsocket.so.1
Reading libresolv.so.2
Reading libSTAF.so
Reading libCstd.so.1
Reading libCrun.so.1
Reading libm.so.2
Reading libthread.so.1
Reading libc.so.1
Reading libnsl.so.1
Reading libdl.so.1
Reading libCstd_isa.so.1
Reading libc_psr.so.1
Reading libSTAFLIPC.so
Reading libscf.so.1
Reading libdoor.so.1
Reading libuutil.so.1
Reading libgen.so.1
Reading libmd.so.1
Reading libmd_psr.so.1
Reading libmp.so.2
Reading libSTAFTCP.so
Reading libSTAFDSLS.so
Attached to process 15623 with 15 LWPs
t...@1 (l...@1) stopped in __lwp_park at 0xfedc6dec
0xfedc6dec: __lwp_park+0x0010:  ta       %icc,0x00000008
Current function is STAFEventSemWait
  317                       rc2 = pthread_cond_wait(&eventSem.fPrivate.fCond,
(dbx) cont                                                                   

oberon$ STAF local ping ping
Response
--------
PONG

# Issue shutdown command for STAFProc
oberon$ STAF local shutdown shutdown
Response
--------

oberon$ 

# We got an exception with following stack trace
(dbx) cont                                                                   
STAFProc ending normally
Exception of type class STAFInvalidObjectException is unhandled
t...@1 (l...@1) stopped in __exdbg_notify_of_throw at 0xff2a4a3c
0xff2a4a3c: __exdbg_notify_of_throw       :     retl     
Current function is STAFException::checkStandardExceptions
  161               THROW_STAF_EXCEPTION(STAFInvalidObjectException(buffer, 
rc));
(dbx) 
(dbx) where
current thread: t...@1
  ---- hidden frames, use 'where -h' to see them all ----
=>[5] STAFException::checkStandardExceptions(buffer = 0xffbfe7cc "STA", rc = 
41U, errorMessage = 0xff26c696 "STAFMutexSemRequest", osRC = 0), line 161 in 
"STAFException.h"
  [6] STAFException::checkRC(rc = 41U, errorMessage = 0xff26c696 
"STAFMutexSemRequest", osRC = 0), line 133 in "STAFException.h"
  [7] STAFMutexSem::request(this = 0xfe9bc0c4, timeout = 4294967295U), line 31 
in "STAFMutexSemInlImpl.cpp"
  [8] STAFMutexSemLock::STAFMutexSemLock(this = 0xffbfeb2c, theMutex = CLASS, 
timeout = 4294967295U), line 127 in "STAFMutexSem.h"
  [9] STAFConnectionProviderDestruct(baseProvider = 0x477c1c, destructInfo = 
(nil), destructInfoLevel = 0, errorBuffer = (nil)), line 2098 in 
"STAFTCPConnProvider.cpp"
  [10] STAFConnectionProvider::~STAFConnectionProvider(this = 0x477c10), line 
228 in "STAFConnectionProviderInlImpl.cpp"
  [11] STAFRefPtr<STAFConnectionProvider>::~STAFRefPtr(this = 0x561204), line 
182 in "ostream"
  [12] std::pair<const STAFString,STAFRefPtr<STAFConnectionProvider> 
>::~pair(0x561200, 0xffffff, 0xff000000, 0xfdbd27c0, 0x1cc4, 0xfffc00), at 
0x14aecc 
  [13] __rwstd::__destroy<std::pair<const 
STAFString,STAFRefPtr<STAFConnectionProvider> > >(pointer = 0x561200), line 179 
in "memory"
  [14] std::allocator_interface<std::allocator<std::pair<const 
STAFString,STAFRefPtr<STAFConnectionProvider> > >,std::pair<const 
STAFString,STAFRefPtr<STAFConnectionProvider> > >::destroy(this = 0xffbfed8b, p 
= 0x561200), line 516 in "memory"
  [15] __rwstd::__rb_tree<STAFString,std::pair<const 
STAFString,STAFRefPtr<STAFConnectionProvider> 
>,__rwstd::__select1st<std::pair<const 
STAFString,STAFRefPtr<STAFConnectionProvider> 
>,STAFString>,std::less<STAFString>,std::allocator<std::pair<const 
STAFString,STAFRefPtr<STAFConnectionProvider> > > >::__put_node(this = 
0x3931ec, p = 0x5611f0, do_destroy = true), line 240 in "tree"
  [16] __rwstd::__rb_tree<STAFString,std::pair<const 
STAFString,STAFRefPtr<STAFConnectionProvider> 
>,__rwstd::__select1st<std::pair<const 
STAFString,STAFRefPtr<STAFConnectionProvider> 
>,STAFString>,std::less<STAFString>,std::allocator<std::pair<const 
STAFString,STAFRefPtr<STAFConnectionProvider> > > >::__erase(this = 0x3931ec, x 
= 0x5611f0), line 527 in "tree.cc"
  [17] __rwstd::__rb_tree<STAFString,std::pair<const 
STAFString,STAFRefPtr<STAFConnectionProvider> 
>,__rwstd::__select1st<std::pair<const 
STAFString,STAFRefPtr<STAFConnectionProvider> 
>,STAFString>,std::less<STAFString>,std::allocator<std::pair<const 
STAFString,STAFRefPtr<STAFConnectionProvider> > > >::__erase(this = 0x3931ec, x 
= 0x5611c8), line 525 in "tree.cc"
  [18] __rwstd::__rb_tree<STAFString,std::pair<const 
STAFString,STAFRefPtr<STAFConnectionProvider> 
>,__rwstd::__select1st<std::pair<const 
STAFString,STAFRefPtr<STAFConnectionProvider> 
>,STAFString>,std::less<STAFString>,std::allocator<std::pair<const 
STAFString,STAFRefPtr<STAFConnectionProvider> > > >::erase(this = 0x3931ec, 
first = CLASS, locallast = CLASS), line 540 in "tree.cc"
  [19] __rwstd::__rb_tree<STAFString,std::pair<const 
STAFString,STAFRefPtr<STAFConnectionProvider> 
>,__rwstd::__select1st<std::pair<const 
STAFString,STAFRefPtr<STAFConnectionProvider> 
>,STAFString>,std::less<STAFString>,std::allocator<std::pair<const 
STAFString,STAFRefPtr<STAFConnectionProvider> > > >::~__rb_tree(this = 
0x3931ec), line 726 in "tree"
  [20] 
std::map<STAFString,STAFRefPtr<STAFConnectionProvider>,std::less<STAFString>,std::allocator<std::pair<const
 STAFString,STAFRefPtr<STAFConnectionProvider> > > >::~map(0x3931ec, 0xffffff, 
0xff000000, 0xfdbd27c0, 0x1cc4, 0xfffc00), at 0x14ae94 
  [21] STAFConnectionManager::~STAFConnectionManager(this = 0x3931ec), line 428 
in "STAFConnectionManager.cpp"
  [22] __SLIP.FINAL__I(), line 203 in "STAFProc.cpp"
  [23] _exithandle(0xfee45400, 0xfee43800, 0x1c00, 0x0, 0xffbfe8bc, 0x0), at 
0xfed42124 
  [24] exit(0x0, 0xffbff1ac, 0xffbff1b4, 0x392c00, 0xfef609c0, 0x0), at 
0xfed30550 
(dbx)
 
# Continuing within debugger causes STAFProc to core dump
(dbx) cont
STAFProc ending abnormally: terminate() called
t...@1 (l...@1) signal SEGV (no mapping at the fault address) in (unknown) at 
0x0
0x00000000:     <bad address 0x0>
Current function is STAFRefPtr<STAFConnectionProvider>::~STAFRefPtr
  182     typedef basic_iostream<char, char_traits<char> >            iostream;
(dbx) where
current thread: t...@1
  [1] 0x0(0x477c10, 0x3931ec, 0xffbfef58, 0xffbfef54, 0xfee45180, 0x0), at 0x0 
=>[2] STAFRefPtr<STAFConnectionProvider>::~STAFRefPtr(this = 0x561204), line 
182 in "iosfwd"
  [3] std::pair<const STAFString,STAFRefPtr<STAFConnectionProvider> 
>::~pair(0x561200, 0xffffff, 0xff000000, 0xfdbd27c0, 0x1cc4, 0xfffc00), at 
0x14aecc 
  [4] __rwstd::__destroy<std::pair<const 
STAFString,STAFRefPtr<STAFConnectionProvider> > >(pointer = 0x561200), line 179 
in "memory"
  [5] std::allocator_interface<std::allocator<std::pair<const 
STAFString,STAFRefPtr<STAFConnectionProvider> > >,std::pair<const 
STAFString,STAFRefPtr<STAFConnectionProvider> > >::destroy(this = 0xffbfed8b, p 
= 0x561200), line 516 in "memory"
  [6] __rwstd::__rb_tree<STAFString,std::pair<const 
STAFString,STAFRefPtr<STAFConnectionProvider> 
>,__rwstd::__select1st<std::pair<const 
STAFString,STAFRefPtr<STAFConnectionProvider> 
>,STAFString>,std::less<STAFString>,std::allocator<std::pair<const 
STAFString,STAFRefPtr<STAFConnectionProvider> > > >::__put_node(this = 
0x3931ec, p = 0x5611f0, do_destroy = true), line 240 in "tree"
  [7] __rwstd::__rb_tree<STAFString,std::pair<const 
STAFString,STAFRefPtr<STAFConnectionProvider> 
>,__rwstd::__select1st<std::pair<const 
STAFString,STAFRefPtr<STAFConnectionProvider> 
>,STAFString>,std::less<STAFString>,std::allocator<std::pair<const 
STAFString,STAFRefPtr<STAFConnectionProvider> > > >::__erase(this = 0x3931ec, x 
= 0x5611f0), line 527 in "tree.cc"
  [8] __rwstd::__rb_tree<STAFString,std::pair<const 
STAFString,STAFRefPtr<STAFConnectionProvider> 
>,__rwstd::__select1st<std::pair<const 
STAFString,STAFRefPtr<STAFConnectionProvider> 
>,STAFString>,std::less<STAFString>,std::allocator<std::pair<const 
STAFString,STAFRefPtr<STAFConnectionProvider> > > >::__erase(this = 0x3931ec, x 
= 0x5611c8), line 525 in "tree.cc"
  [9] __rwstd::__rb_tree<STAFString,std::pair<const 
STAFString,STAFRefPtr<STAFConnectionProvider> 
>,__rwstd::__select1st<std::pair<const 
STAFString,STAFRefPtr<STAFConnectionProvider> 
>,STAFString>,std::less<STAFString>,std::allocator<std::pair<const 
STAFString,STAFRefPtr<STAFConnectionProvider> > > >::erase(this = 0x3931ec, 
first = CLASS, locallast = CLASS), line 540 in "tree.cc"
  [10] __rwstd::__rb_tree<STAFString,std::pair<const 
STAFString,STAFRefPtr<STAFConnectionProvider> 
>,__rwstd::__select1st<std::pair<const 
STAFString,STAFRefPtr<STAFConnectionProvider> 
>,STAFString>,std::less<STAFString>,std::allocator<std::pair<const 
STAFString,STAFRefPtr<STAFConnectionProvider> > > >::~__rb_tree(this = 
0x3931ec), line 726 in "tree"
  [11] 
std::map<STAFString,STAFRefPtr<STAFConnectionProvider>,std::less<STAFString>,std::allocator<std::pair<const
 STAFString,STAFRefPtr<STAFConnectionProvider> > > >::~map(0x3931ec, 0xffffff, 
0xff000000, 0xfdbd27c0, 0x1cc4, 0xfffc00), at 0x14ae94 
  [12] STAFConnectionManager::~STAFConnectionManager(this = 0x3931ec), line 428 
in "STAFConnectionManager.cpp"
  [13] __SLIP.FINAL__I(), line 203 in "STAFProc.cpp"
  [14] _exithandle(0xfee45400, 0xfee43800, 0x1c00, 0x0, 0xffbfe8bc, 0x0), at 
0xfed42124 
  [15] exit(0x0, 0xffbff1ac, 0xffbff1b4, 0x392c00, 0xfef609c0, 0x0), at 
0xfed30550 
(dbx) threads
*>    t...@1  a  l...@1   ?()   signal SIGSEGV in  in <can't get PC>() 
      t...@2  b  l...@2   RealSTAFThread()   sleep on 0x503528  in  
__lwp_park() 
      t...@3  b  l...@3   RealSTAFThread()   running          in  _so_accept() 
      t...@4  b  l...@4   RealSTAFThread()   sleep on 0x502c28  in  
__lwp_park() 
      t...@5  b  l...@5   RealSTAFThread()   sleep on 0x502aa8  in  
__lwp_park() 
      t...@6  b  l...@6   RealSTAFThread()   sleep on 0x502ba8  in  
__lwp_park() 
      t...@7  b  l...@7   RealSTAFThread()   sleep on 0x502a28  in  
__lwp_park() 
      t...@8  b  l...@8   RealSTAFThread()   sleep on 0x5029a8  in  
__lwp_park() 
      t...@9  b  l...@9   RealSTAFThread()   sleep on 0x502928  in  
__lwp_park() 
     t...@10  b l...@10   RealSTAFThread()   sleep on 0x5028a8  in  
__lwp_park() 
     t...@11  b l...@11   RealSTAFThread()   sleep on 0x502828  in  
__lwp_park() 
     t...@12  b l...@12   RealSTAFThread()   sleep on 0x5027a8  in  
__lwp_park() 
     t...@13  b l...@13   RealSTAFThread()   sleep on 0x502728  in  
__lwp_park() 
     t...@14  b l...@14   RealSTAFThread()   sleep on 0x5026a8  in  
__lwp_park() 
     t...@15  b l...@15   RealSTAFThread()   sleep on 0x502428  in  
__lwp_park() 
     t...@16  b l...@16   umem_update_thread()   sleep on 0xff393ec0  in  
__lwp_park() 
     t...@17  b l...@17   RealSTAFThread()   sleep on 0x4b3f28  in  
__lwp_park() 
     t...@18  b l...@18   RealSTAFThread()   sleep on 0x502228  in  
__lwp_park() 
(dbx) 
(dbx) quit  
detaching from process 15623
20090428-16:32:07;1;00000100;Received signal 11 (SIGSEGV)
20090428-16:32:07;1;00000100;Received signal 6 (SIGABRT)


# I have traced the issue to the following procedure where
# lock is trying to lock a null semaphore:
--- STAFTCPConnProvider.cpp #2084 ----
STAFRC_t STAFConnectionProviderDestruct(STAFConnectionProvider_t *baseProvider,
                                        void *destructInfo,
                                        unsigned int destructInfoLevel,
                                        STAFString_t *errorBuffer)
{
    if (baseProvider == 0) return kSTAFInvalidObject;
    if (*baseProvider == 0) return kSTAFInvalidObject;
    if (destructInfoLevel != 0) return kSTAFInvalidAPILevel;

    try
    {
        STAFTCPConnectionProviderImpl *provider =
            static_cast<STAFTCPConnectionProviderImpl *>(*baseProvider);

        STAFMutexSemLock lock(sActiveProvidersSem);

        sActiveProviders.erase(provider);
        
---

sActiveProvidersSem.fMutexImpl is null!   


# In order to fix the issue I had to put try/catch block within
# STAFConnectionProvider::~STAFConnectionProvider() destructor.


        
------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to