[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: thread assert with 1.8.2
From: |
Ludovic Courtès |
Subject: |
Re: thread assert with 1.8.2 |
Date: |
Tue, 02 Oct 2007 18:18:55 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) |
Hi,
Greg Troxel <address@hidden> writes:
> Running threads.test
> guile: Error detected by libpthread: Unlocking unlocked mutex.
> Detected by file
> "/usr/home/gdt/NetBSD-current/src/lib/libpthread/pthread_mutex.c", line 357,
> function "pthread_mutex_unlock".
> See pthread(3) for information.
> [1] Abort trap (core dumped) ${dir}${tst}
>
> The core has several threads, nad this is the one that hit the assert:
>
> (gdb) bt
> #0 0xbb9d6bdb in kill () from /usr/lib/libc.so.12
> #1 0xbbaa3d9b in pthread__errorfunc () from /usr/lib/libpthread.so.0
> #2 0xbbaa1d49 in pthread_mutex_unlock () from /usr/lib/libpthread.so.0
> #3 0xbbb9875c in scm_leave_guile () from
> /usr/home/gdt/NetBSD-current/pkgsrc/lang/guile/work/guile-1.8.2/libguile/.libs/libguile.so.17
> #4 0xbbb99c4e in on_thread_exit () from
> /usr/home/gdt/NetBSD-current/pkgsrc/lang/guile/work/guile-1.8.2/libguile/.libs/libguile.so.17
> #5 0xbbaa0e1c in pthread__destroy_tsd () from /usr/lib/libpthread.so.0
> #6 0xbbaa5119 in pthread_exit () from /usr/lib/libpthread.so.0
> #7 0xbbaa5499 in pthread_setcancelstate () from /usr/lib/libpthread.so.0
> #8 0xbb9f9370 in swapcontext () from /usr/lib/libc.so.12
I fixed this one (thank you Greg!) and it turned out to be easier than I
expected: threads were leaving guile mode twice, once in
`scm_i_with_guile_and_parent ()' and then once in `on_thread_exit ()',
hence the above assertion failure.
But now, there's a similar issue in HEAD with `(ice-9 i18n)':
PASS: locale objects: make-locale (2 args)
PASS: locale objects: make-locale (2 args, list)
PASS: locale objects: make-locale (3 args)
guile: Error detected by libpthread: Unlocking unlocked mutex.
Detected by file "/n0/gdt/NetBSD-4/src/lib/libpthread/pthread_mutex.c", line
363, function "pthread_mutex_unlock".
Backtrace:
#0 0xbba68fff in kill () from /usr/lib/libc.so.12
#1 0xbb9dadb3 in pthread__errorfunc () from /usr/lib/libpthread.so.0
#2 0xbb9d93f8 in pthread_mutex_unlock () from /usr/lib/libpthread.so.0
#3 0xbb9cbaa0 in scm_make_locale (category_list=0x2, locale_name=0x80d6870,
base_locale=0x204) at ../../libguile/i18n.c:436
Needs further investigation...
Thanks,
Ludovic.
--- orig/ChangeLog
+++ mod/ChangeLog
@@ -1,6 +1,6 @@
2007-10-02 Ludovic Courtès <address@hidden>
- * NEWS: Mention `(ice-9 slib)' fix.
+ * NEWS: Mention `(ice-9 slib)' fix and threading fix.
2007-09-03 Ludovic Courtès <address@hidden>
--- orig/NEWS
+++ mod/NEWS
@@ -46,6 +46,7 @@
** Warnings about duplicate bindings now go to stderr
** A memory leak in `make-socket-address' was fixed
** Alignment issues (e.g., on SPARC) in network routines were fixed
+** A threading issue that showed up at least on NetBSD was fixed
** Build problems on Solaris fixed
* Implementation improvements
--- orig/libguile/ChangeLog
+++ mod/libguile/ChangeLog
@@ -1,3 +1,9 @@
+2007-10-02 Ludovic Courtès <address@hidden>
+
+ * threads.c (on_thread_exit): Don't call `scm_leave_guile ()'
+ since we're already in non-guile mode. Reported by Greg Toxel
+ for NetBSD.
+
2007-10-01 Ludovic Courtès <address@hidden>
* ports.c (flush_output_port): Expect directly a port instead of
--- orig/libguile/threads.c
+++ mod/libguile/threads.c
@@ -495,20 +495,18 @@
static void
on_thread_exit (void *v)
{
+ /* This handler is executed in non-guile mode. */
scm_i_thread *t = (scm_i_thread *)v, **tp;
scm_i_pthread_setspecific (scm_i_thread_key, v);
/* Unblocking the joining threads needs to happen in guile mode
- since the queue is a SCM data structure.
- */
+ since the queue is a SCM data structure. */
scm_with_guile (do_thread_exit, v);
/* Removing ourself from the list of all threads needs to happen in
non-guile mode since all SCM values on our stack become
- unprotected once we are no longer in the list.
- */
- scm_leave_guile ();
+ unprotected once we are no longer in the list. */
scm_i_pthread_mutex_lock (&thread_admin_mutex);
for (tp = &all_threads; *tp; tp = &(*tp)->next_thread)
if (*tp == t)
- Re: thread assert with 1.8.2,
Ludovic Courtès <=