If you are using GitLab outside of the ILL, then you will need to use HTTPS and not SSH for clone/push/pull operations. SSH will work normally if you are using the VPN.

Commit ed801620 authored by Tobias WEBER's avatar Tobias WEBER

further debugging

parent 6021a4eb
......@@ -50,7 +50,7 @@ endif()
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
set(CMAKE_CXX_STANDARD 11)
add_definitions(-std=c++11 -D_GLIBCXX_USE_CXX11_ABI)
#add_definitions(-rdynamic -fPIC)
#add_definitions(-fPIC)
if(BUILD_FOR_MINGW)
......@@ -276,7 +276,7 @@ if(USE_GENTAB)
target_link_libraries(gentab
${Clipper_LIBRARIES}
Qt5::Core Qt5::Gui Qt5::Widgets
Boost::program_options Boost::iostreams Boost::filesystem Boost::system
Boost::iostreams Boost::system Boost::filesystem Boost::program_options
${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES}
)
......@@ -353,7 +353,7 @@ target_link_libraries(takin
${LIBS_3D}
${PNG_LIBRARIES}
${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES}
Boost::program_options Boost::iostreams Boost::filesystem Boost::system
Boost::iostreams Boost::system Boost::filesystem Boost::program_options
Threads::Threads ${Mp_LIBRARIES} ${Rt_LIBRARIES} ${Dl_LIBRARIES}
)
......@@ -446,7 +446,7 @@ set_target_properties(convofit PROPERTIES COMPILE_FLAGS "-DNO_QT")
target_link_libraries(convofit
${LIBS_FIT} ${SOCK2}
Threads::Threads ${Mp_LIBRARIES} ${Rt_LIBRARIES} ${Dl_LIBRARIES}
Boost::program_options Boost::iostreams Boost::filesystem Boost::system
Boost::iostreams Boost::system Boost::filesystem Boost::program_options
${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES}
)
......@@ -469,7 +469,7 @@ add_executable(convoseries
set_target_properties(convoseries PROPERTIES COMPILE_FLAGS "-DNO_QT")
target_link_libraries(convoseries
Boost::program_options Boost::iostreams Boost::filesystem Boost::system
Boost::iostreams Boost::system Boost::filesystem Boost::program_options
${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES}
)
......
......@@ -323,6 +323,8 @@ static inline std::string find_program_binary(const std::string& strExe)
g_strApp + "/" + strExe + ".exe",
g_strApp + "/externals/" + strExe + ".exe",
g_strApp + "/../externals/" + strExe + ".exe",
"/usr/local/bin/" + strExe,
"/usr/bin/" + strExe,
};
for(const std::string& strPath : vecPaths)
......
......@@ -13,6 +13,7 @@
#include "tlibs/log/log.h"
#include "tlibs/math/rand.h"
#include <signal.h>
#include <boost/interprocess/managed_shared_memory.hpp>
#include <boost/interprocess/allocators/allocator.hpp>
#include <boost/interprocess/containers/string.hpp>
......@@ -221,8 +222,8 @@ static ProcMsg msg_recv(ipr::message_queue& msgqueue)
ProcMsg msg;
try
{
std::size_t iSize;
unsigned int iPrio;
std::size_t iSize = 0;
unsigned int iPrio = 0;
msgqueue.receive(&msg, sizeof(msg), iSize, iPrio);
if(iSize != sizeof(msg))
......@@ -240,7 +241,6 @@ static ProcMsg msg_recv(ipr::message_queue& msgqueue)
// ----------------------------------------------------------------------------
// child process
// ----------------------------------------------------------------------------
template<class t_sqw>
......@@ -302,9 +302,8 @@ static void child_proc(ipr::message_queue& msgToParent, ipr::message_queue& msgF
}
case ProcMsgTypes::QUIT:
{
tl::log_debug("Exiting child process");
exit(0);
break;
tl::log_debug("Child process ", getpid(), " received quit request.");
return;
}
default:
{
......@@ -315,8 +314,10 @@ static void child_proc(ipr::message_queue& msgToParent, ipr::message_queue& msgF
}
// ----------------------------------------------------------------------------
// parent process
// ----------------------------------------------------------------------------
template<class t_sqw>
SqwProc<t_sqw>::SqwProc()
......@@ -360,14 +361,15 @@ SqwProc<t_sqw>::SqwProc(const char* pcCfg)
{
child_proc<t_sqw>(*m_pmsgIn, *m_pmsgOut, pcCfg);
exit(0);
return;
}
tl::log_debug("Waiting for client to become ready...");
tl::log_debug("Waiting for client ", m_pidChild, " to become ready...");
ProcMsg msgReady = msg_recv(*m_pmsgIn);
if(!msgReady.bRet)
tl::log_err("Client reports failure.");
tl::log_err("Client ", m_pidChild, " reports failure.");
else
tl::log_debug("Client is ready.");
tl::log_debug("Client ", m_pidChild, " is ready.");
m_bOk = msgReady.bRet;
}
......@@ -390,6 +392,13 @@ SqwProc<t_sqw>::SqwProc(const std::string& strCfg) : SqwProc<t_sqw>::SqwProc(str
template<class t_sqw>
SqwProc<t_sqw>::~SqwProc()
{
// we're in a child process
if(m_pidChild == 0)
{
tl::log_debug("Child process ", getpid(), " ending.");
return;
}
// make sure that this instance is the last
if(m_pMem.use_count() > 1)
return;
......@@ -401,22 +410,27 @@ SqwProc<t_sqw>::~SqwProc()
ProcMsg msg;
msg.ty = ProcMsgTypes::QUIT;
msg_send(*m_pmsgOut, msg);
//kill(m_pidChild, SIGABRT);
}
if(--m_iRefCnt == 0)
{
// give clients time to end before removing the shared memory
std::this_thread::sleep_for(std::chrono::milliseconds{200});
ipr::message_queue::remove(("takin_sqw_proc_in_" + m_strProcName).c_str());
ipr::message_queue::remove(("takin_sqw_proc_out_" + m_strProcName).c_str());
ipr::shared_memory_object::remove(("takin_sqw_proc_mem_" + m_strProcName).c_str());
m_pMem->destroy<t_sh_str>(("takin_sqw_proc_params_" + m_strProcName).c_str());
tl::log_debug("Removed process memory \"", "takin_sqw_proc_*_", m_strProcName, "\".");
tl::log_debug("Removed process memory \"", "takin_sqw_proc_*_", m_strProcName, "\" for client ", m_pidChild, ".");
}
}
catch(const std::exception& ex)
{
tl::log_debug("Process unloading exception: ", ex.what());
tl::log_debug("Client process ", m_pidChild, " unloading exception: ", ex.what());
}
}
......
......@@ -189,7 +189,6 @@ void unload_sqw_plugins()
pMod->unload();
pMod.reset();
tl::log_debug("Unloaded plugin.");
}
g_vecMods.clear();
......@@ -215,7 +214,7 @@ void load_sqw_plugins()
// TODO: libjulia.so needs rtld_global, but cannot be used here as the takin_sqw_info functions are named the same in all so files...
std::shared_ptr<so::shared_library> pmod =
std::make_shared<so::shared_library>(strPlugin,
so::load_mode::rtld_lazy /*| so::load_mode::rtld_global*/);
so::load_mode::rtld_lazy | so::load_mode::rtld_local);
if(!pmod)
continue;
......
......@@ -39,6 +39,9 @@
#include <QSplashScreen>
#include <QStyleFactory>
#include <unistd.h>
namespace chr = std::chrono;
namespace asio = boost::asio;
namespace sys = boost::system;
......@@ -154,6 +157,7 @@ int main(int argc, char** argv)
{
try
{
pid_t pidMain = getpid();
std::ios_base::sync_with_stdio(0);
#ifdef NO_TERM_CMDS
......@@ -163,8 +167,16 @@ int main(int argc, char** argv)
// install exit signal handlers
asio::io_service ioSrv;
asio::signal_set sigInt(ioSrv, SIGABRT, SIGTERM, SIGINT);
sigInt.async_wait([&ioSrv](const sys::error_code& err, int iSig)
sigInt.async_wait([&ioSrv, pidMain](const sys::error_code& err, int iSig)
{
pid_t pid = getpid();
if(pid != pidMain)
{
tl::log_warn("Child process exit requested via signal.", pid, ".");
ioSrv.stop();
exit(-1);
}
tl::log_warn("Hard exit requested via signal ", iSig, ". This may cause a fault.");
if(err) tl::log_err("Error: ", err.message(), ", error category: ", err.category().name(), ".");
ioSrv.stop();
......
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