Error in my_thread_global_end(): 1 threads didn't exit
- Code: Select all
Listener::Listener(Poco::NotificationQueue& queue,
ushort timeout,
ushort delayMin,
ushort delayMax) :
_stop(false),
_timeout(timeout),
_requestDelayMin(delayMin),
_requestDelayMax(delayMax),
_queue(queue),
_logger(Logger::get("Notifier.Listener"))
{
}
Listener::~Listener()
{
}
void Listener::run()
{
try
{
Poco::Data::Session * session = new Session(Connector::KEY, dbConnString);
NS::DB::Task task;
while (!_stop)
{
task.clear();
(*session << "SELECT .."); // Some SQL syntax
if(task.id > 0)
{
(*session << "UPDATE...); // Some SQL syntax
}
Thread::sleep(_requestDelayMin);
}
}
catch(Poco::Exception& e)
{
std::cerr << e.displayText();
}
delete (session); session = 0;
}
void Listener::stop()
{
_stop = true;
}
I run it with valgind and got this output:
- Code: Select all
Error in my_thread_global_end(): 1 threads didn't exit
Press ENTER to quit.
==2987==
==2987== HEAP SUMMARY:
==2987== in use at exit: 2,096 bytes in 56 blocks
==2987== total heap usage: 6,893 allocs, 6,837 frees, 653,362 bytes allocated
==2987==
==2987== 128 bytes in 1 blocks are definitely lost in loss record 52 of 54
==2987== at 0x402A5E6: calloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==2987== by 0x4C2AB03: my_thread_init (in /usr/lib/i386-linux-gnu/libmysqlclient.so.18.0.0)
==2987== by 0x4C02824: mysql_server_init (in /usr/lib/i386-linux-gnu/libmysqlclient.so.18.0.0)
==2987== by 0x4C09468: mysql_init (in /usr/lib/i386-linux-gnu/libmysqlclient.so.18.0.0)
==2987== by 0x4647027: Poco::Data::MySQL::SessionHandle::init(st_mysql*) (SessionHandle.cpp:57)
==2987== by 0x4646FF4: Poco::Data::MySQL::SessionHandle::SessionHandle(st_mysql*) (SessionHandle.cpp:49)
==2987== by 0x4638FEE: Poco::Data::MySQL::SessionImpl::SessionImpl(std::string const&, unsigned int) (SessionImpl.cpp:73)
==2987== by 0x4641FD1: Poco::Data::MySQL::Connector::createSession(std::string const&, unsigned int) (Connector.cpp:70)
==2987== by 0x44AECAA: Poco::Data::SessionFactory::create(std::string const&, std::string const&, unsigned int) (SessionFactory.cpp:92)
==2987== by 0x44AE3E4: Poco::Data::Session::Session(std::string const&, std::string const&, unsigned int) (Session.cpp:60)
==2987== by 0x806E3FD: NS::DB::Listener::run() (listener.cpp:67)
==2987== by 0x41C3202: Poco::ThreadImpl::runnableEntry(void*) (Thread_POSIX.cpp:378)
==2987==
==2987== LEAK SUMMARY:
==2987== definitely lost: 128 bytes in 1 blocks
==2987== indirectly lost: 0 bytes in 0 blocks
==2987== possibly lost: 0 bytes in 0 blocks
==2987== still reachable: 1,968 bytes in 55 blocks
==2987== suppressed: 0 bytes in 0 blocks
==2987== Reachable blocks (those to which a pointer was found) are not shown.
==2987== To see them, rerun with: --leak-check=full --show-reachable=yes
==2987==
==2987== For counts of detected and suppressed errors, rerun with: -v
==2987== Use --track-origins=yes to see where uninitialised values come from
==2987== ERROR SUMMARY: 29 errors from 2 contexts (suppressed: 0 from 0)





