Commit 5bff35e9 authored by Pavel Vainerman's avatar Pavel Vainerman

Попытка решить проблеммы с SIGSEGV при выходе из программы.

parent 4a406f56
......@@ -8,7 +8,8 @@ cd ../../../Utilities/Admin/
./uniset2-start.sh -f ./exist | grep -q UNISET_PLC/Controllers || exit 1
cd -
./uniset2-start.sh -g ./tests-with-sm $* -- --confile mbmaster-test-configure.xml --e-startup-pause 10 \
./uniset2-start.sh -f ./tests-with-sm $* -- --confile mbmaster-test-configure.xml --e-startup-pause 10 \
--mbs-name MBSlave1 --mbs-type TCP --mbs-inet-addr 127.0.0.1 --mbs-inet-port 20048 --mbs-my-addr 0x01 \
--mbs-askcount-id SVU_AskCount_AS --mbs-respond-id RespondRTU_S --mbs-respond-invert 1 \
--mbs-filter-field mbs --mbs-filter-value 1 --ulog-add-levels any
--mbs-filter-field mbs --mbs-filter-value 1
# --ulog-add-levels any --dlog-add-levels any
......@@ -140,9 +140,19 @@ void UniSetActivator::init()
UniSetActivator::~UniSetActivator()
{
if( orbthr )
{
orbthr->stop();
if( orbthr->isRunning() )
orbthr->join();
delete orbthr;
orbthr = 0;
}
if( !procterm )
{
ulogsys << myname << "(destructor): ..."<< endl << flush;
ulogsys << myname << "(destructor): ..." << endl << flush;
if( !omDestroy )
oaDestroy();
......@@ -152,16 +162,6 @@ UniSetActivator::~UniSetActivator()
gActivator.reset();
}
if( orbthr )
{
orbthr->stop();
if( orbthr->isRunning() )
orbthr->join();
delete orbthr;
orbthr = 0;
}
#if 0
try
{
......@@ -220,7 +220,7 @@ void UniSetActivator::oaDestroy(int signo)
}
catch(...){}
}
}
try
{
ulogsys << myname << "(stop):: shutdown orb... "<<endl;
......@@ -241,15 +241,6 @@ void UniSetActivator::oaDestroy(int signo)
}
catch(...){}
#endif
/*
if( orbthr )
{
delete orbthr;
orbthr = 0;
}
*/
}
// waittermMutex.unlock();
}
// ------------------------------------------------------------------------------------------
......@@ -261,7 +252,7 @@ void UniSetActivator::oaDestroy(int signo)
* Иначе все ресурсы основного потока передаются для обработки приходящих сообщений (и она не выходит)
*
*/
void UniSetActivator::run(bool thread)
void UniSetActivator::run( bool thread )
{
ulogsys << myname << "(run): создаю менеджер "<< endl;
......@@ -502,7 +493,7 @@ void UniSetActivator::terminated( int signo )
if( gActivator )
{
UniSetActivator::set_signals(false);
gActivator.reset();
// gActivator.reset();
}
sigset(SIGALRM, SIG_DFL);
......@@ -524,7 +515,7 @@ void UniSetActivator::normalexit()
void UniSetActivator::normalterminate()
{
if( gActivator )
ucrit << gActivator->getName() << "(default exception terminate): Никто не выловил исключение!!! Good bye."<< endl<< flush;
ucrit << gActivator->getName() << "(default exception terminate): Unkown exception.. Good bye."<< endl<< flush;
// abort();
// std::exception_ptr p = std::current_exception();
......@@ -544,6 +535,16 @@ void UniSetActivator::term( int signo )
try
{
ulogsys << myname << "(term): вызываем sigterm()" << endl;
if( orbthr )
{
orbthr->stop();
if( orbthr->isRunning() )
orbthr->join();
delete orbthr;
orbthr = 0;
}
sigterm(signo);
s_term.emit(signo);
ulogsys << myname << "(term): sigterm() ok." << endl;
......
......@@ -47,8 +47,11 @@ class MPush: public unary_function< const std::shared_ptr<UniSetManager>& , bool
{
try
{
m->push( msg );
m->broadcast( msg );
if( m )
{
m->push( msg );
m->broadcast( msg );
}
return true;
}
catch(...){}
......@@ -68,8 +71,11 @@ class OPush: public unary_function< const std::shared_ptr<UniSetObject>& , bool>
{
try
{
o->push( msg );
return true;
if( o )
{
o->push( msg );
return true;
}
}
catch(...){}
return false;
......
......@@ -783,7 +783,14 @@ void UniSetObject::callback()
if( waitMessage(msg) )
processingMessage(&msg);
}
catch(...){}
catch( Exception& ex )
{
ucrit << ex << endl;
}
catch( std::exception& ex )
{
ucrit << ex.what() << endl;
}
}
// ------------------------------------------------------------------------------------------
void UniSetObject::processingMessage( UniSetTypes::VoidMessage *msg )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment