https://bugs.kde.org/show_bug.cgi?id=409141

Roman Kagan <rvka...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rvka...@gmail.com

--- Comment #7 from Roman Kagan <rvka...@gmail.com> ---
Repro:

$ cat x.c
#include <signal.h>
#include <unistd.h>
#include <pthread.h>
#include <stdlib.h>

void *t(void *p)
{
        sleep(1000);
        return NULL;
}

int main(int argc, char **argv)
{
        pthread_t thr;

        int s = atoi(argv[1]);

        pthread_create(&thr, NULL, t, NULL);

        raise(s);
}
$ gcc -pthread -g x.c -o x
$ valgrind ./x 15
==18380== Memcheck, a memory error detector
==18380== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==18380== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==18380== Command: ./x 15
==18380==
==18380==
==18380== Process terminating with default action of signal 15 (SIGTERM)
==18380==    at 0x4881D15: raise (in /usr/lib64/libpthread-2.29.so)
==18380==    by 0x4011BC: main (x.c:20)
==18380==
==18380== HEAP SUMMARY:
==18380==     in use at exit: 272 bytes in 1 blocks
==18380==   total heap usage: 1 allocs, 0 frees, 272 bytes allocated
==18380==
==18380== LEAK SUMMARY:
==18380==    definitely lost: 0 bytes in 0 blocks
==18380==    indirectly lost: 0 bytes in 0 blocks
==18380==      possibly lost: 272 bytes in 1 blocks
==18380==    still reachable: 0 bytes in 0 blocks
==18380==         suppressed: 0 bytes in 0 blocks
==18380== Rerun with --leak-check=full to see details of leaked memory
==18380==
==18380== For lists of detected and suppressed errors, rerun with: -s
==18380== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Terminated
$ valgrind ./x 9
==18382== Memcheck, a memory error detector
==18382== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==18382== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==18382== Command: ./x 9
==18382==
...
Here it the main thread becomes zombie, the child thread sleeps until the
expiration of 1000s.  In the real-world case the child thread did a wait on a
mutex which never got released.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to