NetBSD-Users archive

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

Re: Porting Corosync/Pacemaker - Help needed with gdb



Now this is really strange. I added a simple printf before the line where pthread_mutex_lock() is called:

static int ipc_thread_active (void *conn)
{   
....
        printf("Hi");
        pthread_mutex_lock (&conn_info->mutex);
...
}

This leads to the following crash:


Core was generated by `corosync'.
Program terminated with signal 11, Segmentation fault.
#0  0x00007f7ff68078e9 in pthread_mutex_lock () from /usr/lib/libpthread.so.1
(gdb) bt
#0  0x00007f7ff68078e9 in pthread_mutex_lock () from /usr/lib/libpthread.so.1
#1  0x00007f7ff60ecfe7 in __flockfile_internal () from /usr/lib/libc.so.12
#2  0x00007f7ff60d0e9a in vfprintf () from /usr/lib/libc.so.12
#3  0x00007f7ff60cbeb6 in printf () from /usr/lib/libc.so.12
#4  0x00007f7ff7002e6a in ipc_thread_active (conn=0x7f7ff7391000) at coroipcs.c:465
#5  pthread_ipc_consumer (conn=0x7f7ff7391000) at coroipcs.c:675
#6  0x00007f7ff6809d75 in ?? () from /usr/lib/libpthread.so.1
#7  0x00007f7ff60759f0 in ___lwp_park50 () from /usr/lib/libc.so.12


It seems that libc uses some kind of internal locking for printf - which also crashes in pthread_mutex_lock().

Can somebody explain that to me?


2012/12/1 Christos Zoulas <christos%astron.com@localhost>
In article <CABZpUSWKyWkJnWEsFuuHpAuj+YxuxZ3ny=kEFW2pzk6B3ZUaWQ%mail.gmail.com@localhost>,
Stephan  <stephanwib%googlemail.com@localhost> wrote:
>-=-=-=-=-=-
>
>Hi folks,
>
>some time ago I managed to get Corosync working on NetBSD - now the
>official 1.x builds can be compiled and run "out of the box". Recently, I
>made Pacemaker 1.1 and cluster_glue compile after making some cosmetic
>changes to the code.
>
>However, when I load the Pacemaker subsystem into Corosync, corosync
>crashes with SIGSEGV. It alway does in pthread_mutex_lock(), for example in
>the following code block:
>
>===========
>static int ipc_thread_active (void *conn)
>{
>        struct conn_info *conn_info = (struct conn_info *)conn;
>        int retval = 0;
>
>
>        pthread_mutex_lock
>(&conn_info->mutex);                                   <<<--- CRASH
>        if (conn_info->state == CONN_STATE_THREAD_ACTIVE) {
>                retval = 1;
>        }
>        pthread_mutex_unlock (&conn_info->mutex);
>        return (retval);
>}
>==================
>
>I am not sure how to track this down with gdb. Here are some findings:

If you compile with -g you should be able to print the contents of conn_info.

christos




Home | Main Index | Thread Index | Old Index