Commit 966da383 authored by Pavel Vainerman's avatar Pavel Vainerman

Установил sm-ready-timeout по умолчанию на 120000 мсек (2 мин),

Заменил raise(SIGTERM) --> std::terminate()
parent c3d639fe
...@@ -242,7 +242,7 @@ namespace uniset ...@@ -242,7 +242,7 @@ namespace uniset
int sm_tout = conf->getArgInt("--" + prefix + "-sm-ready-timeout", it.getProp("ready_timeout")); int sm_tout = conf->getArgInt("--" + prefix + "-sm-ready-timeout", it.getProp("ready_timeout"));
if( sm_tout == 0 ) if( sm_tout == 0 )
smReadyTimeout = 60000; smReadyTimeout = 120000;
else if( sm_tout < 0 ) else if( sm_tout < 0 )
smReadyTimeout = UniSetTimer::WaitUpTime; smReadyTimeout = UniSetTimer::WaitUpTime;
else else
...@@ -1561,7 +1561,8 @@ namespace uniset ...@@ -1561,7 +1561,8 @@ namespace uniset
<< smReadyTimeout << " msec"; << smReadyTimeout << " msec";
iocrit << err.str() << endl; iocrit << err.str() << endl;
throw SystemError(err.str()); //throw SystemError(err.str());
std::terminate();
} }
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
......
...@@ -30,10 +30,10 @@ LProcessor::LProcessor( const std::string& name ): ...@@ -30,10 +30,10 @@ LProcessor::LProcessor( const std::string& name ):
{ {
auto conf = uniset_conf(); auto conf = uniset_conf();
sleepTime = conf->getArgPInt("--sleepTime", 200); sleepTime = conf->getArgPInt("--sleepTime", 200);
int tout = conf->getArgInt("--sm-ready-timeout", ""); int tout = conf->getArgInt("--sm-ready-timeout", "120000");
if( tout == 0 ) if( tout == 0 )
smReadyTimeout = 60000; smReadyTimeout = 120000;
else if( tout < 0 ) else if( tout < 0 )
smReadyTimeout = UniSetTimer::WaitUpTime; smReadyTimeout = UniSetTimer::WaitUpTime;
else else
......
...@@ -180,7 +180,7 @@ namespace uniset ...@@ -180,7 +180,7 @@ namespace uniset
UInterface ui; UInterface ui;
timeout_t sleepTime = { 200 }; timeout_t sleepTime = { 200 };
timeout_t smReadyTimeout = { 30000 } ; /*!< время ожидания готовности SM, мсек */ timeout_t smReadyTimeout = { 120000 } ; /*!< время ожидания готовности SM, мсек */
std::string logname = { "" }; std::string logname = { "" };
std::atomic_bool canceled = {false}; std::atomic_bool canceled = {false};
......
...@@ -151,7 +151,7 @@ void PassiveLProcessor::sysCommand( const uniset::SystemMessage* sm ) ...@@ -151,7 +151,7 @@ void PassiveLProcessor::sysCommand( const uniset::SystemMessage* sm )
if( !shm->waitSMready(smReadyTimeout) ) if( !shm->waitSMready(smReadyTimeout) )
{ {
dcrit << myname << "(ERR): SM not ready. Terminated... " << endl; dcrit << myname << "(ERR): SM not ready. Terminated... " << endl;
raise(SIGTERM); std::terminate();
return; return;
} }
......
...@@ -302,8 +302,8 @@ namespace uniset ...@@ -302,8 +302,8 @@ namespace uniset
void MBExchange::waitSMReady() void MBExchange::waitSMReady()
{ {
// waiting for SM is ready... // waiting for SM is ready...
int tout = uniset_conf()->getArgInt("--" + prefix + "-sm-ready-timeout", "15000"); int tout = uniset_conf()->getArgInt("--" + prefix + "-sm-ready-timeout", "120000");
timeout_t ready_timeout = 60000; timeout_t ready_timeout = 120000;
if( tout > 0 ) if( tout > 0 )
ready_timeout = tout; ready_timeout = tout;
...@@ -315,10 +315,7 @@ namespace uniset ...@@ -315,10 +315,7 @@ namespace uniset
ostringstream err; ostringstream err;
err << myname << "(waitSMReady): failed waiting SharedMemory " << ready_timeout << " msec. ==> TERMINATE!"; err << myname << "(waitSMReady): failed waiting SharedMemory " << ready_timeout << " msec. ==> TERMINATE!";
mbcrit << err.str() << endl; mbcrit << err.str() << endl;
raise(SIGTERM); std::terminate();
//if( checkProcActive() )
// throw SystemError(err.str());
} }
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
...@@ -2817,7 +2814,8 @@ namespace uniset ...@@ -2817,7 +2814,8 @@ namespace uniset
if( devices.empty() ) if( devices.empty() )
{ {
mbcrit << myname << "(sysCommand): ************* ITEM MAP EMPTY! terminated... *************" << endl; mbcrit << myname << "(sysCommand): ************* ITEM MAP EMPTY! terminated... *************" << endl;
raise(SIGTERM); //raise(SIGTERM);
std::terminate();
return; return;
} }
......
...@@ -528,8 +528,8 @@ namespace uniset ...@@ -528,8 +528,8 @@ namespace uniset
void MBSlave::waitSMReady() void MBSlave::waitSMReady()
{ {
// waiting for SM is ready... // waiting for SM is ready...
int tout = uniset_conf()->getArgInt("--" + prefix + "-sm-ready-timeout", "15000"); int tout = uniset_conf()->getArgInt("--" + prefix + "-sm-ready-timeout", "120000");
timeout_t ready_timeout = 60000; timeout_t ready_timeout = 120000;
if( tout > 0 ) if( tout > 0 )
ready_timeout = tout; ready_timeout = tout;
...@@ -541,10 +541,8 @@ namespace uniset ...@@ -541,10 +541,8 @@ namespace uniset
ostringstream err; ostringstream err;
err << myname << "(waitSMReady): Не дождались готовности SharedMemory к работе в течение " << ready_timeout << " мсек"; err << myname << "(waitSMReady): Не дождались готовности SharedMemory к работе в течение " << ready_timeout << " мсек";
mbcrit << err.str() << endl; mbcrit << err.str() << endl;
// throw SystemError(err.str()); //terminate();
raise(SIGTERM); std::terminate();
terminate();
// abort();
} }
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
...@@ -565,7 +563,8 @@ namespace uniset ...@@ -565,7 +563,8 @@ namespace uniset
if( vaddr.empty() ) if( vaddr.empty() )
{ {
mbcrit << "(execute_rtu): Unknown my modbus addresses!" << endl; mbcrit << "(execute_rtu): Unknown my modbus addresses!" << endl;
raise(SIGTERM); //raise(SIGTERM);
std::terminate();
return; return;
} }
...@@ -604,7 +603,8 @@ namespace uniset ...@@ -604,7 +603,8 @@ namespace uniset
if( !tcpserver ) if( !tcpserver )
{ {
mbcrit << myname << "(execute_tcp): DYNAMIC CAST ERROR (mbslot --> ModbusTCPServerSlot)" << std::endl; mbcrit << myname << "(execute_tcp): DYNAMIC CAST ERROR (mbslot --> ModbusTCPServerSlot)" << std::endl;
raise(SIGTERM); //raise(SIGTERM);
std::terminate();
return; return;
} }
...@@ -626,7 +626,8 @@ namespace uniset ...@@ -626,7 +626,8 @@ namespace uniset
if( vaddr.empty() ) if( vaddr.empty() )
{ {
mbcrit << "(execute_tcp): Unknown my modbus addresses!" << endl; mbcrit << "(execute_tcp): Unknown my modbus addresses!" << endl;
raise(SIGTERM); //raise(SIGTERM);
std::terminate();
return; return;
} }
...@@ -892,7 +893,8 @@ namespace uniset ...@@ -892,7 +893,8 @@ namespace uniset
if( iomap.empty() ) if( iomap.empty() )
{ {
mbcrit << myname << "(sysCommand): iomap EMPTY! terminated..." << endl; mbcrit << myname << "(sysCommand): iomap EMPTY! terminated..." << endl;
raise(SIGTERM); // raise(SIGTERM);
std::terminate();
return; return;
} }
......
...@@ -100,10 +100,10 @@ SMDBServer::~SMDBServer() ...@@ -100,10 +100,10 @@ SMDBServer::~SMDBServer()
void SMDBServer::waitSMReady() void SMDBServer::waitSMReady()
{ {
// waiting for SM is ready... // waiting for SM is ready...
int ready_timeout = conf->getArgInt("--" + prefix + "-sm-ready-timeout", "15000"); int ready_timeout = conf->getArgInt("--" + prefix + "-sm-ready-timeout", "120000");
if( ready_timeout == 0 ) if( ready_timeout == 0 )
ready_timeout = 60000; ready_timeout = 120000;
else if( ready_timeout < 0 ) else if( ready_timeout < 0 )
ready_timeout = UniSetTimer::WaitUpTime; ready_timeout = UniSetTimer::WaitUpTime;
...@@ -112,7 +112,8 @@ void SMDBServer::waitSMReady() ...@@ -112,7 +112,8 @@ void SMDBServer::waitSMReady()
ostringstream err; ostringstream err;
err << myname << "(waitSMReady): Wait SharedMemory failed. [ " << ready_timeout << " msec ]"; err << myname << "(waitSMReady): Wait SharedMemory failed. [ " << ready_timeout << " msec ]";
dcrit << err.str() << endl; dcrit << err.str() << endl;
throw SystemError(err.str()); //throw SystemError(err.str());
std::terminate();
} }
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
......
...@@ -894,7 +894,8 @@ namespace uniset ...@@ -894,7 +894,8 @@ namespace uniset
err << myname << "(initFromReserv): Not found ID for '" << smName << "'"; err << myname << "(initFromReserv): Not found ID for '" << smName << "'";
smcrit << err.str() << endl; smcrit << err.str() << endl;
// throw SystemError(err.str()); // throw SystemError(err.str());
raise(SIGTERM); //raise(SIGTERM);
std::terminate();
} }
std::string smNode(it.getProp("node")); std::string smNode(it.getProp("node"));
...@@ -910,7 +911,8 @@ namespace uniset ...@@ -910,7 +911,8 @@ namespace uniset
err << myname << "(initFromReserv): Not found NodeID for '" << smNode << "'"; err << myname << "(initFromReserv): Not found NodeID for '" << smNode << "'";
smcrit << err.str() << endl; smcrit << err.str() << endl;
// throw SystemError(err.str()); // throw SystemError(err.str());
raise(SIGTERM); //raise(SIGTERM);
std::terminate();
} }
......
...@@ -475,9 +475,9 @@ void UNetExchange::startReceivers() ...@@ -475,9 +475,9 @@ void UNetExchange::startReceivers()
void UNetExchange::waitSMReady() void UNetExchange::waitSMReady()
{ {
// waiting for SM is ready... // waiting for SM is ready...
int tout = uniset_conf()->getArgInt("--unet-sm-ready-timeout", "15000"); int tout = uniset_conf()->getArgInt("--unet-sm-ready-timeout", "120000");
timeout_t ready_timeout = 60000; timeout_t ready_timeout = 120000;
if( tout > 0 ) if( tout > 0 )
ready_timeout = tout; ready_timeout = tout;
...@@ -489,7 +489,7 @@ void UNetExchange::waitSMReady() ...@@ -489,7 +489,7 @@ void UNetExchange::waitSMReady()
ostringstream err; ostringstream err;
err << myname << "(waitSMReady): Не дождались готовности SharedMemory к работе в течение " << ready_timeout << " мсек"; err << myname << "(waitSMReady): Не дождались готовности SharedMemory к работе в течение " << ready_timeout << " мсек";
unetcrit << err.str() << endl; unetcrit << err.str() << endl;
throw SystemError(err.str()); std::terminate();
} }
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
...@@ -821,7 +821,7 @@ void UNetExchange::help_print( int argc, const char* argv[] ) noexcept ...@@ -821,7 +821,7 @@ void UNetExchange::help_print( int argc, const char* argv[] ) noexcept
cout << " 'evloop' - используется общий (с приёмом сообщений) event loop" << endl; cout << " 'evloop' - используется общий (с приёмом сообщений) event loop" << endl;
cout << " По умолчанию: evloop" << endl; cout << " По умолчанию: evloop" << endl;
cout << "--prefix-sm-ready-timeout msec - Время ожидание я готовности SM к работе. По умолчанию 15000" << endl; cout << "--prefix-sm-ready-timeout msec - Время ожидание я готовности SM к работе. По умолчанию 120000" << endl;
cout << "--prefix-filter-field name - Название фильтрующего поля при формировании списка датчиков посылаемых данным узлом" << endl; cout << "--prefix-filter-field name - Название фильтрующего поля при формировании списка датчиков посылаемых данным узлом" << endl;
cout << "--prefix-filter-value name - Значение фильтрующего поля при формировании списка датчиков посылаемых данным узлом" << endl; cout << "--prefix-filter-value name - Значение фильтрующего поля при формировании списка датчиков посылаемых данным узлом" << endl;
cout << endl; cout << endl;
......
...@@ -442,7 +442,8 @@ namespace uniset ...@@ -442,7 +442,8 @@ namespace uniset
<< "(readItem): OVERFLOW! MAX UDP DIGITAL DATA LIMIT! max=" << "(readItem): OVERFLOW! MAX UDP DIGITAL DATA LIMIT! max="
<< UniSetUDP::MaxDCount << endl; << UniSetUDP::MaxDCount << endl;
raise(SIGTERM); // raise(SIGTERM);
std::terminate();
return false; return false;
} }
} }
...@@ -480,7 +481,8 @@ namespace uniset ...@@ -480,7 +481,8 @@ namespace uniset
<< "(readItem): OVERFLOW! MAX UDP ANALOG DATA LIMIT! max=" << "(readItem): OVERFLOW! MAX UDP ANALOG DATA LIMIT! max="
<< UniSetUDP::MaxACount << endl; << UniSetUDP::MaxACount << endl;
raise(SIGTERM); // raise(SIGTERM);
std::terminate();
return false; return false;
} }
} }
...@@ -492,7 +494,8 @@ namespace uniset ...@@ -492,7 +494,8 @@ namespace uniset
{ {
unetcrit << myname unetcrit << myname
<< "(readItem): Sensor (" << p.id << ")" << sname << " ALREADY ADDED!! ABORT!" << endl; << "(readItem): Sensor (" << p.id << ")" << sname << " ALREADY ADDED!! ABORT!" << endl;
raise(SIGTERM); // raise(SIGTERM);
std::terminate();
return false; return false;
} }
...@@ -514,7 +517,7 @@ namespace uniset ...@@ -514,7 +517,7 @@ namespace uniset
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void UNetSender::askSensors( UniversalIO::UIOCommand cmd ) void UNetSender::askSensors( UniversalIO::UIOCommand cmd )
{ {
for( auto && it : items ) for( const auto& it : items )
shm->askSensor(it.second.id, cmd); shm->askSensor(it.second.id, cmd);
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
......
...@@ -152,7 +152,8 @@ void UniExchange::execute() ...@@ -152,7 +152,8 @@ void UniExchange::execute()
<< smReadyTimeout << " мсек"; << smReadyTimeout << " мсек";
ucrit << err.str() << endl; ucrit << err.str() << endl;
throw SystemError(err.str()); //throw SystemError(err.str());
std::terminate();
} }
PassiveTimer pt(UniSetTimer::WaitUpTime); PassiveTimer pt(UniSetTimer::WaitUpTime);
......
...@@ -142,7 +142,7 @@ namespace uniset ...@@ -142,7 +142,7 @@ namespace uniset
SList mymap; SList mymap;
size_t maxIndex = { 0 }; size_t maxIndex = { 0 };
timeout_t smReadyTimeout = { 15000 }; // msec timeout_t smReadyTimeout = { 60000 }; // msec
private: private:
}; };
......
...@@ -74,12 +74,14 @@ void SMonitor::sysCommand( const SystemMessage* sm ) ...@@ -74,12 +74,14 @@ void SMonitor::sysCommand( const SystemMessage* sm )
catch( const uniset::Exception& ex ) catch( const uniset::Exception& ex )
{ {
cerr << myname << ":(askSensor): " << ex << endl; cerr << myname << ":(askSensor): " << ex << endl;
raise(SIGTERM); // raise(SIGTERM);
std::terminate();
} }
catch(...) catch(...)
{ {
cerr << myname << ": НЕ СМОГ ЗАКАЗТЬ датчики " << endl; cerr << myname << ": НЕ СМОГ ЗАКАЗТЬ датчики " << endl;
raise(SIGTERM); // raise(SIGTERM);
std::terminate();
} }
} }
} }
......
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