Opened 14 years ago

Closed 14 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:
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 by Adek336, 14 years ago

hrev37286, VBox 3.1, gcc4+2 hybrid

comment:2 by Adek336, 14 years ago

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

comment:3 by anevilyak, 14 years ago

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

comment:4 by Adek336, 14 years ago

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

comment:5 by bonefish, 14 years ago

Resolution: fixed
Status: newclosed

Fixed in hrev37509.

Note: See TracTickets for help on using tickets.