App crashes always writing config value to database
Hi
I have Problem using C++ Config Lib: https://sdk.innovaphone.com/13r2/sdk/common/lib/config.htm.
App crashes always writing config value to database. the value is inserted/ updated in database but app chrashes and restart. can you tell me how can i solve this Problem.
If you need coredump, that can be sent separatly.
Regards
Iqbal
Code:
header:class AccessTokenRefresh : public ITask, public UTask
{
TestApp* instance;
TaskHttpRequest httpRequest;
std::string accessToken;
std::string refreshToken;
std::string expiresIn;
std::unique_ptr<ITask> writeAccessTokenTask;
std::unique_ptr<ITask> writeRefreshTokenTask;
std::unique_ptr<ITask> writeExpiresInTask;
std::unique_ptr<ITask> writeLastTokenRefreshAtTask;
void ParseAccessToken(char* data);
public:
AccessTokenRefresh(TestApp* instance);
void Start(class UTask* user);
void TaskComplete(class ITask* const task) override;
void TaskFailed(class ITask* const task) override;
};cpp:void AccessTokenRefresh::TaskComplete(ITask* const task)
{
LOG("AccessTokenRefresh::%s", __FUNCTION__);
if (task == &httpRequest)
{
ParseAccessToken(httpRequest.GetResponse());
writeAccessTokenTask.reset(
instance->WriteItemValue(
&instance->accessToken
, accessToken.c_str()
, false
)
);
writeAccessTokenTask->Start(this);
}
else if (task == writeAccessTokenTask.get())
{
writeRefreshTokenTask.reset(
instance->WriteItemValue(
&instance->refreshToken
, refreshToken.c_str()
, false
)
);
writeRefreshTokenTask->Start(this);
}
else if (task == writeRefreshTokenTask.get())
{
writeExpiresInTask.reset(
instance->WriteItemValue(
&instance->accessTokenRefreshIntervalInSeconds
, expiresIn.c_str()
, false
)
);
writeExpiresInTask->Start(this);
}
else if (task == writeExpiresInTask.get())
{
if (isTeamsAccessTokenRefreshFailed == false) {
writeLastTokenRefreshAtTask.reset(
instance->WriteItemValue(
&instance->lastTokenRefreshAt
, getTimeStamp()
, false
)
);
writeLastTokenRefreshAtTask->Start(this);
}
else {
TaskFailed(task);
}
}
else if (task == writeLastTokenRefreshAtTask.get())
{
instance->AccessTokenRefreshComplete(true);
}
}</pre>Logs:<pre>05-16 12:24:55.912 TestApp@TestApp.de PostgreSQLDatabase(02241040,0223f458)::ExecSQLV user:024f1550 flags:00000000 sqlCmd:INSERT INTO config (name, value, unmanaged) VALUES ('refreshToken', '0.AToA4cSaMUPnlk-NXvucmGn.......AjAlScwLt7x8XAx7m5rmdT9X6HAVSaN4', FALSE) ON CONFLICT (name) DO UPDATE SET value = '0.AToA4cSaMUPnlk-NXvucmGn.......AjAlScwLt7x8XAx7m5rmdT9X6HAVSaN4'
05-16 12:24:55.913 TestApp@TestApp.de PostgreSQLDatabase(02241040,024f1550)::DatabaseExecSQLResult dataset: 02503450
05-16 12:24:55.913 TestApp@TestApp.de TeamsAccessTokenAuthorize::TaskComplete
05-16 12:24:55.913 TestApp@TestApp.de PostgreSQLDatabase(02241040,0223f458)::ExecSQLV user:023a05f0 flags:00000000 sqlCmd:INSERT INTO config (name, value, unmanaged) VALUES ('accessTokenRefreshIntervalInSeconds', '3834', FALSE) ON CONFLICT (name) DO UPDATE SET value = '3834'
05-16 12:24:55.914 TestApp@TestApp.de PostgreSQLDatabase(02241040,023a05f0)::DatabaseExecSQLResult dataset: 02455e00
05-16 12:24:55.914 TestApp@TestApp.de TeamsAccessTokenAuthorize::TaskComplete
05-16 12:24:55.914 TestApp@TestApp.de PostgreSQLDatabase(02241040,0223f458)::ExecSQLV user:02670900 flags:00000000 sqlCmd:INSERT INTO config (name, value, unmanaged) VALUES ('lastTokenRefreshAt', '2023-05-16 12:24:55', FALSE) ON CONFLICT (name) DO UPDATE SET value = '2023-05-16 12:24:55'
05-16 12:24:55.915 TestApp@TestApp.de PostgreSQLDatabase(02241040,02670900)::DatabaseExecSQLResult dataset: 02503450
05-16 12:24:57.271 Core dumped due to a crash (current app build 130011). Take a look at the core dump backtrace files!
05-16 12:24:57.272 AppService::AppService 130001
05-16 12:24:57.301 AppService::AppStart TestApp@TestApp.de
05-16 12:24:57.301 TestApp@TestApp.de WhoisOnReplicator->createReplicator
05-16 12:24:57.301 TestApp@TestApp.de WhoisOnReplicator->AddColumns
05-16 12:24:57.301 TestApp@TestApp.de d38c60:AddColumn(guid)
05-16 12:24:57.301 TestApp@TestApp.de d38c60:AddColumn(h323)</pre>Backtrace:<pre>05-16 12:24:57.027 dumping stack trace from core dump /var/log/core_dumps/TestApp/TestApp.core.dump (current build:130011)
[New LWP 27095]
[New LWP 27108]
[New LWP 27109]
[New LWP 27110]
[New LWP 27111]
[New LWP 27116]
[New LWP 27118]
[New LWP 27119]
[New LWP 27120]
[New LWP 27121]
[New LWP 27122]
[New LWP 27123]
[New LWP 27124]
[New LWP 27125]
[New LWP 27126]
[New LWP 27127]
[New LWP 27128]
[New LWP 27129]
[New LWP 27130]
[New LWP 27131]
[New LWP 27132]
[New LWP 27133]
[New LWP 27134]
[New LWP 27135]
[New LWP 27136]
[New LWP 27137]
[New LWP 27138]
[New LWP 27143]
[New LWP 27144]
[New LWP 27145]
[New LWP 27146]
[New LWP 27147]
[New LWP 27148]
[New LWP 27149]
[New LWP 27150]
[New LWP 27151]
[New LWP 27152]
[New LWP 27153]
[New LWP 27154]
[New LWP 27155]
[New LWP 27156]
[New LWP 27157]
[New LWP 27158]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `/apps/TestApp/TestApp --manager=/var/run/manager/manager --service-id=testapp'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00007f2c9e4bf436 in ?? () from /lib64/libc.so.6
[Current thread is 1 (Thread 0x7f2c9e3e0100 (LWP 27095))]
Thread 43 (Thread 0x7f2c687e8700 (LWP 27158)):
#0 0x00007f2c9ee8d77c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1 0x0000000000513d7c in DnsThread::ThreadFunction() ()
#2 0x000000000051338a in __dns_thread_main(void*) ()
#3 0x00007f2c9ee86f3d in start_thread () from /lib64/libpthread.so.0
#4 0x00007f2c9e51d9af in clone () from /lib64/libc.so.6
Thread 42 (Thread 0x7f2c68fe9700 (LWP 27157)):
#0 0x00007f2c9ee8d77c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1 0x0000000000513d7c in DnsThread::ThreadFunction() ()
#2 0x000000000051338a in __dns_thread_main(void*) ()
#3 0x00007f2c9ee86f3d in start_thread () from /lib64/libpthread.so.0
#4 0x00007f2c9e51d9af in clone () from /lib64/libc.so.6
Thread 41 (Thread 0x7f2c697ea700 (LWP 27156)):
#0 0x00007f2c9ee8d77c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1 0x0000000000513d7c in DnsThread::ThreadFunction() ()
#2 0x000000000051338a in __dns_thread_main(void*) ()
#3 0x00007f2c9ee86f3d in start_thread () from /lib64/libpthread.so.0
#4 0x00007f2c9e51d9af in clone () from /lib64/libc.so.6
Thread 40 (Thread 0x7f2c69feb700 (LWP 27155)):
#0 0x00007f2c9ee8d77c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1 0x0000000000513d7c in DnsThread::ThreadFunction() ()
#2 0x000000000051338a in __dns_thread_main(void*) ()
#3 0x00007f2c9ee86f3d in start_thread () from /lib64/libpthread.so.0
#4 0x00007f2c9e51d9af in clone () from /lib64/libc.so.6
Thread 39 (Thread 0x7f2c6a7ec700 (LWP 27154)):
#0 0x00007f2c9ee8d77c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1 0x0000000000513d7c in DnsThread::ThreadFunction() ()
#2 0x000000000051338a in __dns_thread_main(void*) ()
#3 0x00007f2c9ee86f3d in start_thread () from /lib64/libpthread.so.0
#4 0x00007f2c9e51d9af in clone () from /lib64/libc.so.6
Thread 38 (Thread 0x7f2c6afed700 (LWP 27153)):
#0 0x00007f2c9ee8d77c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1 0x0000000000513d7c in DnsThread::ThreadFunction() ()
#2 0x000000000051338a in __dns_thread_main(void*) ()
#3 0x00007f2c9ee86f3d in start_thread () from /lib64/libpthread.so.0
#4 0x00007f2c9e51d9af in clone () from /lib64/libc.so.6
Thread 37 (Thread 0x7f2c6b7ee700 (LWP 27152)):
#0 0x00007f2c9ee8d77c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1 0x0000000000513d7c in DnsThread::ThreadFunction() ()
#2 0x000000000051338a in __dns_thread_main(void*) ()
#3 0x00007f2c9ee86f3d in start_thread () from /lib64/libpthread.so.0
#4 0x00007f2c9e51d9af in clone () from /lib64/libc.so.6
Thread 36 (Thread 0x7f2c6bfef700 (LWP 27151)):
#0 0x00007f2c9ee8d77c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1 0x0000000000513d7c in DnsThread::ThreadFunction() ()
#2 0x000000000051338a in __dns_thread_main(void*) ()
#3 0x00007f2c9ee86f3d in start_thread () from /lib64/libpthread.so.0
#4 0x00007f2c9e51d9af in clone () from /lib64/libc.so.6
Thread 35 (Thread 0x7f2c6c7f0700 (LWP 27150)):
#0 0x00007f2c9ee8d77c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1 0x0000000000513d7c in DnsThread::ThreadFunction() ()
#2 0x000000000051338a in __dns_thread_main(void*) ()
#3 0x00007f2c9ee86f3d in start_thread () from /lib64/libpthread.so.0
#4 0x00007f2c9e51d9af in clone () from /lib64/libc.so.6
Thread 34 (Thread 0x7f2c6cff1700 (LWP 27149)):
#0 0x00007f2c9ee8d77c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1 0x0000000000513d7c in DnsThread::ThreadFunction() ()
#2 0x000000000051338a in __dns_thread_main(void*) ()
#3 0x00007f2c9ee86f3d in start_thread () from /lib64/libpthread.so.0
#4 0x00007f2c9e51d9af in clone () from /lib64/libc.so.6
Thread 33 (Thread 0x7f2c6d7f2700 (LWP 27148)):
#0 0x00007f2c9ee8d77c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1 0x0000000000513d7c in DnsThread::ThreadFunction() ()
#2 0x000000000051338a in __dns_thread_main(void*) ()
#3 0x00007f2c9ee86f3d in start_thread () from /lib64/libpthread.so.0
#4 0x00007f2c9e51d9af in clone () from /lib64/libc.so.6
Thread 32 (Thread 0x7f2c6dff3700 (LWP 27147)):
#0 0x00007f2c9ee8d77c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1 0x0000000000513d7c in DnsThread::ThreadFunction() ()
#2 0x000000000051338a in __dns_thread_main(void*) ()
#3 0x00007f2c9ee86f3d in start_thread () from /lib64/libpthread.so.0
#4 0x00007f2c9e51d9af in clone () from /lib64/libc.so.6
Thread 31 (Thread 0x7f2c6e7f4700 (LWP 27146)):
#0 0x00007f2c9ee8d77c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1 0x0000000000513d7c in DnsThread::ThreadFunction() ()
#2 0x000000000051338a in __dns_thread_main(void*) ()
#3 0x00007f2c9ee86f3d in start_thread () from /lib64/libpthread.so.0
#4 0x00007f2c9e51d9af in clone () from /lib64/libc.so.6
Thread 30 (Thread 0x7f2c6eff5700 (LWP 27145)):
#0 0x00007f2c9ee8d77c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1 0x0000000000513d7c in DnsThread::ThreadFunction() ()
#2 0x000000000051338a in __dns_thread_main(void*) ()
#3 0x00007f2c9ee86f3d in start_thread () from /lib64/libpthread.so.0
#4 0x00007f2c9e51d9af in clone () from /lib64/libc.so.6
Thread 29 (Thread 0x7f2c6f7f6700 (LWP 27144)):
#0 0x00007f2c9ee8d77c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1 0x0000000000513d7c in DnsThread::ThreadFunction() ()
#2 0x000000000051338a in __dns_thread_main(void*) ()
#3 0x00007f2c9ee86f3d in start_thread () from /lib64/libpthread.so.0
#4 0x00007f2c9e51d9af in clone () from /lib64/libc.so.6
Thread 28 (Thread 0x7f2c6fff7700 (LWP 27143)):
#0 0x00007f2c9ee8d77c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1 0x0000000000513d7c in DnsThread::ThreadFunction() ()
#2 0x000000000051338a in __dns_thread_main(void*) ()
#3 0x00007f2c9ee86f3d in start_thread () from /lib64/libpthread.so.0
#4 0x00007f2c9e51d9af in clone () from /lib64/libc.so.6
Thread 27 (Thread 0x7f2c707f8700 (LWP 27138)):
#0 0x00007f2c9ee8d77c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1 0x0000000000513d7c in DnsThread::ThreadFunction() ()
#2 0x000000000051338a in __dns_thread_main(void*) ()
#3 0x00007f2c9ee86f3d in start_thread () from /lib64/libpthread.so.0
#4 0x00007f2c9e51d9af in clone () from /lib64/libc.so.6
Thread 26 (Thread 0x7f2c70ff9700 (LWP 27137)):
#0 0x00007f2c9ee8d77c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1 0x0000000000513d7c in DnsThread::ThreadFunction() ()
#2 0x000000000051338a in __dns_thread_main(void*) ()
#3 0x00007f2c9ee86f3d in start_thread () from /lib64/libpthread.so.0
#4 0x00007f2c9e51d9af in clone () from /lib64/libc.so.6
Thread 25 (Thread 0x7f2c717fa700 (LWP 27136)):
#0 0x00007f2c9ee8d77c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1 0x0000000000513d7c in DnsThread::ThreadFunction() ()
#2 0x000000000051338a in __dns_thread_main(void*) ()
#3 0x00007f2c9ee86f3d in start_thread () from /lib64/libpthread.so.0
#4 0x00007f2c9e51d9af in clone () from /lib64/libc.so.6
Thread 24 (Thread 0x7f2c71ffb700 (LWP 27135)):
#0 0x00007f2c9ee8d77c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1 0x0000000000513d7c in DnsThread::ThreadFunction() ()
#2 0x000000000051338a in __dns_thread_main(void*) ()
#3 0x00007f2c9ee86f3d in start_thread () from /lib64/libpthread.so.0
#4 0x00007f2c9e51d9af in clone () from /lib64/libc.so.6
Thread 23 (Thread 0x7f2c727fc700 (LWP 27134)):
#0 0x00007f2c9ee8d77c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1 0x0000000000513d7c in DnsThread::ThreadFunction() ()
#2 0x000000000051338a in __dns_thread_main(void*) ()
#3 0x00007f2c9ee86f3d in start_thread () from /lib64/libpthread.so.0
#4 0x00007f2c9e51d9af in clone () from /lib64/libc.so.6
Thread 22 (Thread 0x7f2c72ffd700 (LWP 27133)):
#0 0x00007f2c9ee8d77c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1 0x0000000000513d7c in DnsThread::ThreadFunction() ()
#2 0x000000000051338a in __dns_thread_main(void*) ()
05-16 12:25:04.467 dumping stack trace from core dump /var/log/core_dumps/TestApp/TestApp.core.dump (current build:130001)
[New LWP 10385]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `/apps/TestApp/TestApp --manager=/var/run/manager/manager --service-id=whois'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00000000004bddc2 in TaskWriteConfig::Start(UTask*) ()
Thread 1 (Thread 0x7fb2304ad100 (LWP 10385)):
#0 0x00000000004bddc2 in TaskWriteConfig::Start(UTask*) ()
#1 0x00000000004bbfb9 in ConfigApiContext::Message(json_io&, unsigned short, char const*, char const*) ()
#2 0x00000000004b3c43 in AppWebsocket::WebsocketRecvResult(IWebsocket*, void*, unsigned long, bool, bool) ()
#3 0x00000000004fea99 in WebserverWebsocketHandler::HandleMessage(IWebserverMessage*, void*, unsigned long) ()
#4 0x00000000004f64f9 in WebserverPlugin::SocketRecvResult(ISocket*, void*, unsigned long) ()
#5 0x00000000004d2afb in UDSocket::ReceiveData() ()
#6 0x00000000004d2c3d in UDSocket::IoExec(void*) ()
#7 0x00000000004ad6e9 in IoMux::ExecListRun() ()
#8 0x00000000004adb5c in IoMux::Run() ()
#9 0x000000000040c971 in main ()