> for starters, the LWP fileserver (if you build openafs, find it in
> src/viced/fileserver) will actually leave a core, unlike the pthreaded
> fileserver, if it dies. if as i'm guessing you have one pthread dying now
> this may help.

The LWP fileserver might drop a core, but it usually doesn't show the
stack trace of the LWP that caused the problem.

There's also this other trick for getting a multithreaded application
to dump core that I read about in some Linux newsgroup. The trick is to
register signal handlers for signals like ABRT, SEGV and BUS and have
the signal handler kill all the other threads before attempting to dump
core. This doesn't always work, but has helped me debug some Linux
problems.

int signal_handler(int num)
{
        struct sigaction new_action;

        pthread_kill_other_threads_np();
       
        sleep(1);

        /* Restore default handler for abort */        
        sigemptyset(&new_action.sa_mask);
        new_action.sa_handler = SIG_DFL;
        new_action.sa_flags = 0;
        sigaction(SIGABRT, &new_action, NULL);

        abort();
}

And in main()

int main()
{
.
.
        struct sigaction new_action;

        sigemptyset(&new_action.sa_mask);
        new_action.sa_handler = error_handler;
        new_action.sa_flags = 0;

        sigaction(SIGABRT, &new_action, NULL);
        sigaction(SIGSEGV, &new_action, NULL);
        sigaction(SIGBUS, &new_action, NULL);

        pthread_create(...        
}

Reply via email to