poco icon indicating copy to clipboard operation
poco copied to clipboard

Bug: Segfault in ThreadPool.cpp / 1.9.0 / linux

Open a67s opened this issue 7 years ago • 3 comments

#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51                                        
#1  0x00007ffff5683f5d in __GI_abort () at abort.c:90
#2  0x00007ffff5679f17 in __assert_fail_base (fmt=<optimized out>,                                                   assertion=assertion@entry=0x7ffff5c56f52 "mutex->__data.__owner == 0",
    file=file@entry=0x7ffff5c56f35 "../nptl/pthread_mutex_lock.c", line=line@entry=81,                               function=function@entry=0x7ffff5c570c0 <__PRETTY_FUNCTION__.8399> "__pthread_mutex_lock") at assert.c:92
#3  0x00007ffff5679fc2 in __GI___assert_fail (                                                                       assertion=assertion@entry=0x7ffff5c56f52 "mutex->__data.__owner == 0",
    file=file@entry=0x7ffff5c56f35 "../nptl/pthread_mutex_lock.c", line=line@entry=81,                               function=function@entry=0x7ffff5c570c0 <__PRETTY_FUNCTION__.8399> "__pthread_mutex_lock") at assert.c:101
#4  0x00007ffff5c4c348 in __GI___pthread_mutex_lock (mutex=<optimized out>) at ../nptl/pthread_mutex_lock.c:81
#5  0x000000000076fa5c in pthread_mutex_lock ()
    at /usr/bin/../lib/gcc/x86_64-linux-gnu/7.2.0/../../../../include/c++/7.2.0/ext/new_allocator.h:125
#6  0x0000000000e916ff in Poco::MutexImpl::lockImpl (this=0x7b54000004b8) at include/Poco/Mutex_POSIX.h:59
#7  Poco::FastMutex::lock (this=0x7b54000004b8) at include/Poco/Mutex.h:238                                      
#8  Poco::ScopedLock<Poco::FastMutex>::ScopedLock (mutex=..., this=<synthetic pointer>)
    at include/Poco/ScopedLock.h:38                                                                              
#9  Poco::PooledThread::idle (this=0x7b5400000280) at src/ThreadPool.cpp:130
#10 Poco::ThreadPool::housekeep (this=this@entry=0x2e1a2a8 <TCP::Server::server_pool>)                               at src/ThreadPool.cpp:423
#11 0x0000000000e921a8 in Poco::ThreadPool::getThread (this=0x2e1a2a8 <TCP::Server::server_pool>)                    at src/ThreadPool.cpp:458
#12 0x0000000000e92541 in Poco::ThreadPool::startWithPriority (this=<optimized out>,                                 priority=Poco::Thread::PRIO_NORMAL, target=..., name="TCPServerConnection") at src/ThreadPool.cpp:371
#13 0x0000000000e548ba in Poco::Net::TCPServerDispatcher::enqueue (this=0x7b44000b1440, socket=...)                  at src/TCPServerDispatcher.cpp:150
#14 0x0000000000e4cfe1 in Poco::Net::TCPServer::run (this=0x7b44000b3250) at src/TCPServer.cpp:148               #15 0x0000000000e8bce9 in Poco::ThreadImpl::runnableEntry (pThread=0x7b44000b3278) at src/Thread_POSIX.cpp:345
#16 0x000000000075fb3e in __tsan_thread_start_func ()                                                                at /usr/bin/../lib/gcc/x86_64-linux-gnu/7.2.0/../../../../include/c++/7.2.0/ext/new_allocator.h:125
#17 0x00007ffff5c497fc in start_thread (arg=0x7fff2b12e700) at pthread_create.c:465                              
#18 0x00007ffff575fb5f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Unfortunately there is no simple snippet to reproduce, but reproducible on my machine. The impression I get is that poolThread already has been freed, but somehow still is in threadS list of ThreadPool. Though only a guess.

a67s avatar May 09 '18 10:05 a67s

probably duplicate of #2085. can you try with 1.9.1 branch?

aleks-f avatar May 09 '18 13:05 aleks-f

Thanks for message! Had a go with 1.9.1 - unfortunately still saw a crash just now in the housekeep()

    #0 pthread_mutex_lock <null> (omp_module_test+0x76f9c7)
    #1 Poco::MutexImpl::lockImpl() /Foundation/include/Poco/Mutex_POSIX.h:59 (omp_module_test+0xe91624)
    #2 Poco::FastMutex::lock() /Foundation/include/Poco/Mutex.h:238 (omp_module_test+0xe91624)
    #3 Poco::ScopedLock<Poco::FastMutex>::ScopedLock(Poco::FastMutex&) /Foundation/include/Poco/ScopedLock.h:38 (omp_module_test+0xe9
1624)
    #4 Poco::PooledThread::idle() /Foundation/src/ThreadPool.cpp:129 (omp_module_test+0xe91624)
    #5 Poco::ThreadPool::housekeep() /Foundation/src/ThreadPool.cpp:414 (omp_module_test+0xe91624)

For trial tried out commenting out the poolThread releasing code from from the housekeep - that seems to get rid of problem while stress-testing. Feels like something might be amiss with releasing threads.

a67s avatar May 09 '18 14:05 a67s

This issue is stale because it has been open for 365 days with no activity.

github-actions[bot] avatar Jul 04 '22 03:07 github-actions[bot]

This issue was closed because it has been inactive for 60 days since being marked as stale.

github-actions[bot] avatar Sep 03 '22 03:09 github-actions[bot]