Poco::Runnable threading cleanup issue #140

mikoro opened this Issue Mar 28, 2013 · 6 comments


None yet
2 participants

mikoro commented Mar 28, 2013

Program is running fine on 1.5.1. I updated poco to latest develop branch and when closing the program I started to get aborted. I'm running on linux (Arch), using clang 3.2 to compile the program (poco was compiled with gcc 4.7.2). Application is based on ServerApplication.


Invalid read of size 4
at 0x4055C97: pthread_detach (in /usr/lib/libpthread-2.17.so)
by 0x8095059: foo::bar::~bar() (bar.h:19)

I get this with three different classes that derive from Runnable and all of them have that same error in valgrind.


aleks-f commented Mar 28, 2013

Could be related to this:


Can you see if reverting that change makes your problem go away?

NB: I strongly suggest double-checking to make sure you are not running stale binaries somewhere on the system.

EDIT: I did run new tests on Linux and Mac after this change and all passed. We're getting ready to release and I'd really like to know if anyone else is experiencing problems with this code.

aleks-f was assigned Mar 28, 2013

mikoro commented Mar 29, 2013

I can confirm that reverting #79 will fix the issue.

I get the error everytime the destructor of a runnable class is executed.

I ran the ThreadTest suite and did not get any errors.

mikoro commented Mar 29, 2013

This gives me a segfault:

#include "Poco/Thread.h"

class TestClass
    Poco::Thread testThread;

int main()
    TestClass tc;

I compile it with

g++ -I xxx/include PocoTest.cpp -o poco-test -L xxx/lib -lpthread -lPocoFoundation

Poco is linked statically.

edit: I just tested and 1.5.1 works fine with this test program.


aleks-f commented Mar 29, 2013

Can you please check now? I successfully ran all Threading tests on following platforms/compilers:


~/poco$ uname -a
Linux ubuntu 3.2.0-35-generic #55-Ubuntu SMP Wed Dec 5 17:42:16 UTC 2012 x86_64 x86_64 x86_64 
~/poco$ g++ --version
g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3


MacBook-Pro:testsuite alex$ uname -a
MacBook-Pro.local 12.2.0 Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64
MacBook-Pro:testsuite alex$ clang --version
Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin12.2.0
Thread model: posix

EDIT: also ran all Threading tests on Windows 8, VS 2012, debug and release builds - all pass

mikoro commented Mar 29, 2013

I can confirm that 6719d34 fixed the segfaultting.


aleks-f commented Mar 30, 2013

great, thanks for reporting and helping with this

aleks-f closed this Mar 30, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment