Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.


#492 pthread_mutex_unlock abort in lxpanel

lxpanel (194)
Jeremy C. Reed

NetBSD is strict:

GLib (gthread-posix.c): Unexpected error from C library during 'pthread_mutex_unlock': Operation not permitted. Aborting.

I think isomething tries to unlock already unlocked mutexes.

gdb shows:

#0 0x00007f7ff61db90a in _lwp_kill () from /usr/lib/
#1 0x00007f7ff61db1e2 in abort () from /usr/lib/
#2 0x00007f7ff6b85d70 in g_thread_yield () from /usr/pkg/lib/
#3 0x00007f7ff7a3f94a in gtk_main () from /usr/pkg/lib/
#4 0x00000000004191bd in main ()

$ env PTHREAD_DIAGASSERT=ae lxpanel
lxpanel: can't load cpu plugin
lxpanel: Error detected by libpthread: Unlocking unlocked mutex.
Detected by file "/usr/src/lib/libpthread/pthread_mutex.c", line 423, function "pthread__mutex_unlock_slow".

So I patched glib2 to not abort on this so I can still use lxpanel.

Older glib2 doesn't abort.

I am not sure where the problem is... maybe somewhere in lxpanel there is a mutex gettig unlocked twice I think.


  • Henry Gebhardt
    Henry Gebhardt

    Please try the patch here:

    It might be that gdk_threads_enter() and gdk_threads_leave() need to be called in other places, too. But please try the patch first.

    Since I cannot reproduce this on Linux, can you narrow down the exact place of where it occurs?

    Also, which version of glib are you using?

    (Also, how do I attach a file to this bug report?)

  • Jeremy C. Reed
    Jeremy C. Reed

    Thanks. The gdk_threads_enter/leave patch works. I didn't get any mutex unlock error.

    As for narrowing it dow, I don't know how. It was in gtk_main() but I don't know how to step within it.

    The glib is glib2-2.32.3

    Thanks again.

    Sorry for my delayed response. As far as I see, no email was sent about this and I just happened to re-read my ticket and saw the comment.

  • Jeremy C. Reed
    Jeremy C. Reed

    I updated to lxpanel 0.5.10 and the problem was there again. So I tried the patch again but still had problem. Maybe the problem was not fixed before. I reinstalled glib2 2.32.3 and also 2.34.2 and had the problem. For now I patched glib2 with:

    --- glib/gthread-posix.c.orig 2012-04-01 22:08:41.000000000 -0500
    +++ glib/gthread-posix.c 2012-05-15 12:54:26.000000000 -0500
    @@ -225,7 +225,8 @@
    gint status;

    if G_UNLIKELY ((status = pthread_mutex_unlock (g_mutex_get_impl (mutex))) != 0)
    - g_thread_abort (status, "pthread_mutex_unlock");
    + g_warning ("pthread_mutex_unlock");


  • Henry Gebhardt
    Henry Gebhardt

    • status: open --> closed-fixed
  • Henry Gebhardt
    Henry Gebhardt

    The patch is in lxpanel-0.5.12. Please test with that version, and reopen if you continue having problems.