knowledge-database (beta)

Current group: comp.soft-sys.ace

[tao-users] Segmentation fault in ORB::shutdown

[tao-users] Segmentation fault in ORB::shutdown  
Lothar Werzinger
From:Lothar Werzinger
Subject:[tao-users] Segmentation fault in ORB::shutdown
Date:21 Jan 2005 22:52:51 -0600
--Boundary-00=_frb8BMXr9LvV/Hd
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi,

the PRF is attached.

We have a regression between ACE 5.4.2 to 5.4.3 when we call ORB::shutdown.

After we moved from ACE 5.4.2 to 5.4.3 we get a Segmentation fault in
ORB::shutdown without any changes in our code. What the code does is loading
and unloading an ORB with the service configuration facilities. I attached
the code for our DllORB class that we load/unload.

Why does ORB::shutdown Segmentation fault? I assume we did not do anything
wrong in the DllORB code, as it ran without problems on 5.4.2. Any help
appreciated.

Here's a gdb stacktrace

Program terminated with signal 11, Segmentation fault.

(gdb) where
#0 0x0000000e in ?? ()
#1 0x411b225e in ACE_Sig_Handler::dispatch (signum=11, siginfo=0xbfffd950,
ucontext=0xbfffd950) at Signal.cpp:423
#2
#3 0x40fbf44e in TAO_Adapter_Registry::check_close (this=0x80ba8d8,
wait_for_completion=1) at Adapter.cpp:81
#4 0x40f89db9 in TAO_ORB_Core::shutdown (this=0x80ba738,
wait_for_completion=true)
at ORB_Core.cpp:1930
#5 0x40f28e2c in CORBA::ORB::shutdown (this=0x80c9ab8,
wait_for_completion=true)
at ORB.i:70
#6 0x417e33e9 in xcerla::utility::DllOrb::fini (this=0x80b49b8)
at src/corbautility/DllOrb.cpp:148
#7 0x4112f78d in ACE_Service_Object_Type::fini (this=0x80b4af8) at
Service_Types.cpp:402
#8 0x4112d976 in ACE_Service_Type::fini (this=0x420a08e8) at
Service_Object.cpp:73
#9 0x4112da25 in ~ACE_Service_Type (this=0x80b4900) at Service_Object.cpp:62
#10 0x4112e2bc in ACE_Service_Repository::remove (this=0x805b928,
name=0x80ba470 "\b\234\f\b\020\r\b", ps=0x0) at Service_Repository.cpp:379
#11 0x41129dd3 in ACE_Service_Config::remove (
svc_name=0x420a08e8
) at
Service_Config.cpp:95
#12 0x41dfa048 in ACEXML_Svcconf_Handler::startElement (this=0x80994c4,
qName=0x80bfd38 "testDllOrb", alist=0x0) at Svcconf_Handler.i:36
#13 0x41e078b3 in ACEXML_Parser::parse_element (this=0x80993f4, is_root=0)
at Parser.cpp:874
#14 0x41e0717c in ACEXML_Parser::parse_content (this=0x80993f4,
startname=0x80ba470 "\b\234\f\b\020\r\b", ns_uri=0x420749eb "",
ns_lname=0x80d93c8 "ACE_Svc_Conf") at Parser.cpp:1090
#15 0x41e07686 in ACEXML_Parser::parse_element (this=0x80993f4, is_root=1)
at Parser.cpp:985
#16 0x41e0a928 in ACEXML_Parser::parse (this=0x80993f4, input=0x0) at
Parser.cpp:225
#17 0x41df8132 in ACEXML_Svcconf_Parser::parse_string (this=0x80993f0,
str=0x8099518 "hj\aB(\r\b") at Svcconf.cpp:110
#18 0x4112a8db in ACE_Service_Config::process_directive (
directive=0x418533f8 "id=\"testDllOrb\"/>")
at memory:283

Lothar
--
Lothar Werzinger Dipl.-Ing. Univ.
framework & platform architect
Xcerla Corporation
275 Tennant Avenue, Suite 202
Morgan Hill, Ca 95037
email: lothar@xcerla.com
phone: +1-408-776-9018

--Boundary-00=_frb8BMXr9LvV/Hd
Content-Type: text/plain;
charset="iso-8859-1";
name="PRF.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="PRF.txt"

ACE VERSION: 5.4.3

HOST MACHINE and OPERATING SYSTEM:
uname -a
Linux janus-w 2.6.5-7.111.19-default #1 Fri Dec 10 15:10:58 UTC 2004 i686 i686 i386 GNU/Linux

TARGET MACHINE and OPERATING SYSTEM, if different from HOST:
COMPILER NAME AND VERSION (AND PATCHLEVEL):
/opt2/GNU/bin/g++-3.4.1 --version
g++-3.4.1 (GCC) 3.4.1
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

CONTENTS OF $ACE_ROOT/ace/config.h [if you use a link to a platform-
specific file, simply state which one]:
cat $ACE_ROOT/ace/config.h
#define ACE_HAS_XML_SVC_CONF
#include "ace/config-linux.h"

CONTENTS OF $ACE_ROOT/include/makeinclude/platform_macros.GNU (unless
this isn't used in this case, e.g., with Microsoft Visual C++):
cat $ACE_ROOT/include/makeinclude/platform_macros.GNU

# configure ACE/TAO for our use

debug=1
optimize=1
exceptions=1
threads=1
inline=1
rtti=1
versioned_so=1
interface_repo=1
ssl=1

include $(ACE_ROOT)/include/makeinclude/platform_linux.GNU

# Compile for Pention Pro or higher
CPPFLAGS += -march=pentiumpro
# Disable the RCSID for release/non-debug builds.
CPPFLAGS += -DACE_USE_RCSID=0

CC += -V 3.4.1
CXX += -V 3.4.1
POSTLINK += -lstdc++
TAO_IDL_PREPROCESSOR=g++

CONTENTS OF $ACE_ROOT/bin/MakeProjectCreator/config/default.features
(used by MPC when you generate your own makefiles):
cat $ACE_ROOT/bin/MakeProjectCreator/config/default.features
// $Id$
// This is an automatically generated file.

ssl=0
qos=1
cidl=0
rwho=0
sctp=0

AREA/CLASS/EXAMPLE AFFECTED:
[What example failed? What module failed to compile?]

DOES THE PROBLEM AFFECT:
COMPILATION?
LINKING?
On Unix systems, did you run make realclean first?
EXECUTION?
OTHER (please specify)?
[Please indicate whether ACE, your application, or both are affected.]

SYNOPSIS:
[Brief description of the problem]

DESCRIPTION:
[Detailed description of problem. Don't just say "
doesn't work, here's a fix," explain what your program does
to get to the state. ]

REPEAT BY:
[What you did to get the error; include test program or session
transcript if at all possible. ]

SAMPLE FIX/WORKAROUND:
[If available ]

--Boundary-00=_frb8BMXr9LvV/Hd
Content-Type: text/x-c++src;
charset="iso-8859-1";
name="DllOrb.cpp"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="DllOrb.cpp"

/*
* Copyright (c) 2004 Xcerla Inc. All rights reserved.
*
* @author lothar
*/


#include "ace/Arg_Shifter.h"
#include "tao/corba.h"
#include "log4cplus/logger.h"

#include "utility/XcerlaException.h"
#include "corbautility/DllOrb.h"

namespace xcerla
{
namespace utility
{

log4cplus::Logger DllOrb::ms_logger(
log4cplus::Logger::getInstance("xcerla.utility.DllOrb")
);

#if !defined (__XRS_INLINE__)
#include "DllOrb.inl"
#endif /* __XRS_INLINE__ */


DllOrb::DllOrb ( )
:
mp_barrier(0),
mv_orb(),
mv_rootPOA()
{
log4cplus::TraceLogger trace(ms_logger, "DllOrb");
log4cplus::NDCContextCreator context("DllOrb");
LOG4CPLUS_DEBUG(ms_logger, "(" << this << ")");
} /* end of DllOrb::DllOrb ( ) */


DllOrb::~DllOrb ( )
throw ()
{
log4cplus::TraceLogger trace(ms_logger, "~DllOrb");
log4cplus::NDCContextCreator context("~DllOrb");
LOG4CPLUS_DEBUG(ms_logger, "(" << this << ")");
delete mp_barrier;
} /* end of DllOrb::~DllOrb ( ) */


int DllOrb::init (int argc, char *argv[])
{
log4cplus::TraceLogger trace(ms_logger, "init");
log4cplus::NDCContextCreator context("init");
LOG4CPLUS_DEBUG(ms_logger, "(" << this << ")");

int threadCnt = 1;

try
{
ENFORCE(argc >= 1)("need at least one argument");
for(int i = 0; i < argc; ++i)
{
LOG4CPLUS_TRACE(ms_logger, "argv[" << i << "]=" << argv[i]);
}

ACE_Arg_Shifter as(argc, argv);
const ACE_TCHAR *currentArg = 0;
while(as.is_anything_left())
{
if((currentArg = as.get_the_parameter("-NumThreads")))
{
int num = ACE_OS::atoi(currentArg);
if(num >= 1)
threadCnt = num;
as.consume_arg();
}
else
as.ignore_arg();
}

// Initialize the ORB
mv_orb = CORBA::ORB_init(
argc,
argv,
""
);
if (CORBA::is_nil(mv_orb.in()))
{
LOG4CPLUS_ERROR(ms_logger, "nil ORB");
return -1;
}
LOG4CPLUS_TRACE(ms_logger, "got ORB");

CORBA::Object_var v_poa = mv_orb->resolve_initial_references("RootPOA");
LOG4CPLUS_TRACE(ms_logger, "got root POA");

mv_rootPOA = PortableServer::POA::_narrow(v_poa.in ());
if (CORBA::is_nil(mv_rootPOA.in()))
{
LOG4CPLUS_ERROR(ms_logger, "nil RootPOA");
return -1;
}
LOG4CPLUS_TRACE(ms_logger, "narrowed root POA");

mv_poaManager = mv_rootPOA->the_POAManager();
LOG4CPLUS_TRACE(ms_logger, "got POA manager");
if (CORBA::is_nil(mv_poaManager.in()))
{
LOG4CPLUS_ERROR(ms_logger, "nil POAManager");
return -1;
}

mv_poaManager->activate();
LOG4CPLUS_TRACE(ms_logger, "activated POA manager");
}
DM_catchExceptionsCORBA(ms_logger, return -1)
DM_catchExceptionsXcerla(ms_logger, true, return -1)
DM_catchExceptions(ms_logger, return -1)

mp_barrier = new ACE_Thread_Barrier(threadCnt + 1);
ENFORCE(mp_barrier != 0)("could not allocate barrier");

LOG4CPLUS_INFO(ms_logger, "ORB initialized");

this->activate(
THR_NEW_LWP|THR_JOINABLE|THR_INHERIT_SCHED,
threadCnt
);
mp_barrier->wait();

LOG4CPLUS_INFO(ms_logger, "ORB runs with " << threadCnt << " threads");

return 0;
} /* end of DllOrb::init ( ) */


int DllOrb::fini (void)
{
log4cplus::TraceLogger trace(ms_logger, "fini");
log4cplus::NDCContextCreator context("fini");
LOG4CPLUS_DEBUG(ms_logger, "(" << this << ")");

try
{
mv_poaManager->deactivate(1, 1);
mv_poaManager = PortableServer::POAManager::_nil();
mv_orb->shutdown(1);
}
DM_catchExceptionsCORBA(ms_logger, return -1)

// wait for our threads to finish
int result = wait();

delete mp_barrier;
mp_barrier = 0;

try
{
mv_orb->destroy();
mv_orb = CORBA::ORB::_nil();
}
catch(CORBA::Exception const & rc_ex)
{
LOG4CPLUS_ERROR(ms_logger, "could not destroy ORB: " << rc_ex);
return -1;
}

return result;
} /* end of DllOrb::fini ( ) */


int DllOrb::svc (void)
{
log4cplus::TraceLogger trace(ms_logger, "svc");
log4cplus::NDCContextCreator context("DllOrb::svc");

mp_barrier->wait();

int result = -1;

try
{
LOG4CPLUS_TRACE(ms_logger, "mv_orb->run ...");
mv_orb->run();
LOG4CPLUS_DEBUG(ms_logger, "mv_orb->run done");
}
DM_catchExceptionsCORBA(ms_logger, return result)
DM_catchExceptionsXcerla(ms_logger, true, return result)
DM_catchExceptions(ms_logger, return result)

result = 0;
return result;
} /* end of DllOrb::svc ( ) */


} /* end of namespace utility */
} /* end of namespace xcerla */

--Boundary-00=_frb8BMXr9LvV/Hd
Content-Type: text/x-chdr;
charset="iso-8859-1";
name="DllOrb.h"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="DllOrb.h"

/*
* Copyright (c) 2004 Xcerla Inc. All rights reserved.
*
* @author lothar
*/

#ifndef xcerla_utility_DllOrb_h
#define xcerla_utility_DllOrb_h

#include "ace/Barrier.h"
#include "ace/Task.h"
#include "tao/ORB.h"
#include "tao/PortableServer/PortableServer.h"

#include "log4cplus/logger.h"

#include "utility/Common.h"


namespace xcerla
{
namespace utility
{

/** shortdescription
*
*/
class DllOrb
:
// remove if this class is copyable and implement the right copy constructor
private utility::NonCopyable
// remove if this class is assignable and implement the right assignment operator
,private utility::NonAssignable
// remove if this class is comparable and implement the comparison operators
,private utility::NonComparable
// remove if your class has no base class
,public ACE_Task_Base
{
// public types and methods
public:
/// Default constructor.
DllOrb ( );

/// Destructor.
~DllOrb ( )
throw ();

// protected types and methods
protected:

virtual int init (int argc, char *argv[]);

virtual int fini (void);

virtual int svc (void);

// private methods and instance variables
private:
static log4cplus::Logger ms_logger;
ACE_Thread_Barrier * mp_barrier;
CORBA::ORB_var mv_orb;
PortableServer::POA_var mv_rootPOA;
PortableServer::POAManager_var mv_poaManager;
}; /* end of DllOrb */

#if defined (__XRS_INLINE__)
#include "DllOrb.inl"
#endif /* __XRS_INLINE__ */


} /* end of namespace utility */
} /* end of namespace xcerla */

#endif /* xcerla_utility_DllOrb_h */

--Boundary-00=_frb8BMXr9LvV/Hd
Content-Type: text/x-c++src;
charset="iso-8859-1";
name="DllOrb.inl"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="DllOrb.inl"

/*
* Copyright (c) 2004 Xcerla Inc. All rights reserved.
*
* @author lothar
*/

#ifndef xcerla_utility_DllOrb_inl
#define xcerla_utility_DllOrb_inl

//XRS_INLINE
//void DllOrb::methodname ( )
//{
// log4cplus::TraceLogger trace(s_logger, "methodname");
// log4cplus::NDCContextCreator context("methodname");
//
//} /* end of DllOrb::methodname */

#endif /* xcerla_utility_DllOrb_inl */

--Boundary-00=_frb8BMXr9LvV/Hd--
   

Copyright © 2006 knowledge-database   -   All rights reserved