tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

NPTL linux emulation thread crash remains unnoticed


I'm facing an annoying problem with NPTL compat linux emulation. To
summarize, when a thread crash its failure remain unnoticed from all
other threads. At that time, a process can stand forever waiting for a
dead thread ... Unfortunately, i already encountered this one while
running some java apps :(

For now, i don't see a way to fix it; and would appreciate some help

Thanks in advance.

NB: The attached code illustrate that behaviour (replace the
`sleep(5)' call with an infinite loop, and this app will wait forever

Nicolas Joly

Biological Software and Databanks.
Institut Pasteur, Paris.
#include <err.h>
#include <pthread.h>
#include <signal.h>
#include <unistd.h>

static void *thr_sigsegv(void *arg) {
  char *addr = 0x0;
  *addr = 1;
  return NULL; }

static void *thr_loop(void *arg) {
  return NULL; }

int main() {
  int res;
  pthread_t thr1, thr2;

  res = pthread_create(&thr1, NULL, thr_sigsegv, NULL);
  if (res != 0)
    errx(1, "pthread_create failed");
  res = pthread_create(&thr2, NULL, thr_loop, NULL);
  if (res != 0)
    errx(1, "pthread_create failed");

  res = pthread_join(thr1, NULL);
  if (res != 0)
    errx(1, "pthread_join failed");
  res = pthread_join(thr2, NULL);
  if (res != 0)
    errx(1, "pthread_join failed");

  return 0; }

Home | Main Index | Thread Index | Old Index