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

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

parent 4a406f56
...@@ -8,7 +8,8 @@ cd ../../../Utilities/Admin/ ...@@ -8,7 +8,8 @@ cd ../../../Utilities/Admin/
./uniset2-start.sh -f ./exist | grep -q UNISET_PLC/Controllers || exit 1 ./uniset2-start.sh -f ./exist | grep -q UNISET_PLC/Controllers || exit 1
cd - 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-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-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() ...@@ -140,9 +140,19 @@ void UniSetActivator::init()
UniSetActivator::~UniSetActivator() UniSetActivator::~UniSetActivator()
{ {
if( orbthr )
{
orbthr->stop();
if( orbthr->isRunning() )
orbthr->join();
delete orbthr;
orbthr = 0;
}
if( !procterm ) if( !procterm )
{ {
ulogsys << myname << "(destructor): ..."<< endl << flush; ulogsys << myname << "(destructor): ..." << endl << flush;
if( !omDestroy ) if( !omDestroy )
oaDestroy(); oaDestroy();
...@@ -152,16 +162,6 @@ UniSetActivator::~UniSetActivator() ...@@ -152,16 +162,6 @@ UniSetActivator::~UniSetActivator()
gActivator.reset(); gActivator.reset();
} }
if( orbthr )
{
orbthr->stop();
if( orbthr->isRunning() )
orbthr->join();
delete orbthr;
orbthr = 0;
}
#if 0 #if 0
try try
{ {
...@@ -220,7 +220,7 @@ void UniSetActivator::oaDestroy(int signo) ...@@ -220,7 +220,7 @@ void UniSetActivator::oaDestroy(int signo)
} }
catch(...){} catch(...){}
} }
}
try try
{ {
ulogsys << myname << "(stop):: shutdown orb... "<<endl; ulogsys << myname << "(stop):: shutdown orb... "<<endl;
...@@ -241,15 +241,6 @@ void UniSetActivator::oaDestroy(int signo) ...@@ -241,15 +241,6 @@ void UniSetActivator::oaDestroy(int signo)
} }
catch(...){} catch(...){}
#endif #endif
/*
if( orbthr )
{
delete orbthr;
orbthr = 0;
}
*/
}
// waittermMutex.unlock();
} }
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
...@@ -261,7 +252,7 @@ void UniSetActivator::oaDestroy(int signo) ...@@ -261,7 +252,7 @@ void UniSetActivator::oaDestroy(int signo)
* Иначе все ресурсы основного потока передаются для обработки приходящих сообщений (и она не выходит) * Иначе все ресурсы основного потока передаются для обработки приходящих сообщений (и она не выходит)
* *
*/ */
void UniSetActivator::run(bool thread) void UniSetActivator::run( bool thread )
{ {
ulogsys << myname << "(run): создаю менеджер "<< endl; ulogsys << myname << "(run): создаю менеджер "<< endl;
...@@ -502,7 +493,7 @@ void UniSetActivator::terminated( int signo ) ...@@ -502,7 +493,7 @@ void UniSetActivator::terminated( int signo )
if( gActivator ) if( gActivator )
{ {
UniSetActivator::set_signals(false); UniSetActivator::set_signals(false);
gActivator.reset(); // gActivator.reset();
} }
sigset(SIGALRM, SIG_DFL); sigset(SIGALRM, SIG_DFL);
...@@ -524,7 +515,7 @@ void UniSetActivator::normalexit() ...@@ -524,7 +515,7 @@ void UniSetActivator::normalexit()
void UniSetActivator::normalterminate() void UniSetActivator::normalterminate()
{ {
if( gActivator ) 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(); // abort();
// std::exception_ptr p = std::current_exception(); // std::exception_ptr p = std::current_exception();
...@@ -544,6 +535,16 @@ void UniSetActivator::term( int signo ) ...@@ -544,6 +535,16 @@ void UniSetActivator::term( int signo )
try try
{ {
ulogsys << myname << "(term): вызываем sigterm()" << endl; ulogsys << myname << "(term): вызываем sigterm()" << endl;
if( orbthr )
{
orbthr->stop();
if( orbthr->isRunning() )
orbthr->join();
delete orbthr;
orbthr = 0;
}
sigterm(signo); sigterm(signo);
s_term.emit(signo); s_term.emit(signo);
ulogsys << myname << "(term): sigterm() ok." << endl; ulogsys << myname << "(term): sigterm() ok." << endl;
......
...@@ -47,8 +47,11 @@ class MPush: public unary_function< const std::shared_ptr<UniSetManager>& , bool ...@@ -47,8 +47,11 @@ class MPush: public unary_function< const std::shared_ptr<UniSetManager>& , bool
{ {
try try
{ {
if( m )
{
m->push( msg ); m->push( msg );
m->broadcast( msg ); m->broadcast( msg );
}
return true; return true;
} }
catch(...){} catch(...){}
...@@ -68,9 +71,12 @@ class OPush: public unary_function< const std::shared_ptr<UniSetObject>& , bool> ...@@ -68,9 +71,12 @@ class OPush: public unary_function< const std::shared_ptr<UniSetObject>& , bool>
{ {
try try
{ {
if( o )
{
o->push( msg ); o->push( msg );
return true; return true;
} }
}
catch(...){} catch(...){}
return false; return false;
} }
......
...@@ -783,7 +783,14 @@ void UniSetObject::callback() ...@@ -783,7 +783,14 @@ void UniSetObject::callback()
if( waitMessage(msg) ) if( waitMessage(msg) )
processingMessage(&msg); processingMessage(&msg);
} }
catch(...){} catch( Exception& ex )
{
ucrit << ex << endl;
}
catch( std::exception& ex )
{
ucrit << ex.what() << endl;
}
} }
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
void UniSetObject::processingMessage( UniSetTypes::VoidMessage *msg ) 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