Opened 9 years ago

Closed 9 years ago

#6315 closed bug (fixed)

[pthread] Unkillable thread

Reported by: Adek336 Owned by: axeld
Priority: normal Milestone: R1
Component: System/Kernel Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Has a Patch: no Platform: All

Description

After reducing the testcase a lot, I ended up with

#include <iostream>
#include <pthread.h>
#include <stdlib.h>
#include <unistd.h>

pthread_cond_t ptcond;
pthread_mutex_t *ptmux;

void* fun(void*)
{
    pthread_mutex_lock(ptmux);

    while (true)
        pthread_cond_wait(&ptcond,ptmux);
    for(;;) sleep(1000);
}

int
main(int argc, char *argv[])
{
    pthread_mutex_t ptm;
    pthread_mutex_init(&ptm,__null);
    pthread_cond_init(&ptcond,__null);
    ptmux = &ptm;
    pthread_t pt;
    pthread_create(&pt, 0, fun, 0);
    for(;;) sleep(100);
}

The main thread for this process is unkillable. Interestingly, sending SIGTERM, SIGINT or SIGKILL to the other thread kills the process.

Change History (5)

comment:1 Changed 9 years ago by Adek336

hrev37286, VBox 3.1, gcc4+2 hybrid

comment:2 Changed 9 years ago by Adek336

When ptm is made global, the thread is no longer unkillable.

comment:3 Changed 9 years ago by anevilyak

Component: - GeneralSystem/Kernel
Owner: changed from nobody to axeld
Version: R1/alpha2R1/Development

comment:4 Changed 9 years ago by Adek336

Reproducible in hrev36937, gcc4+2 hybrid, VBox 3.1; not reproducible in hrev36005, gcc4+2 hybrid, VBox 3.1.

comment:5 Changed 9 years ago by bonefish

Resolution: fixed
Status: newclosed

Fixed in hrev37509.

Note: See TracTickets for help on using tickets.