GNU bug report logs - #14035
Bug Report: scm_with_guile inside pthread segfault

Previous Next

Package: guile;

Reported by: johnanthony <at> lavabit.com

Date: Fri, 22 Mar 2013 22:38:02 UTC

Severity: normal

Done: Mark H Weaver <mhw <at> netris.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: johnanthony <at> lavabit.com
Subject: bug#14035: closed (Re: bug#14035: Fixed in 2.0.7)
Date: Sun, 24 Mar 2013 01:51:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#14035: Bug Report: scm_with_guile inside pthread segfault

which was filed against the guile package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 14035 <at> debbugs.gnu.org.

-- 
14035: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=14035
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Mark H Weaver <mhw <at> netris.org>
To: johnanthony <at> lavabit.com
Cc: 14035-done <at> debbugs.gnu.org
Subject: Re: bug#14035: Fixed in 2.0.7
Date: Sat, 23 Mar 2013 21:48:06 -0400
Hi John,

johnanthony <at> lavabit.com writes:
> I grabbed 2.0.7 to see if it was fixed here and it appears to be.

Excellent, thanks for letting us know!

> Apologies if I was re-reporting an existing bug that was both known about
> and fixed.

No need to apologize.  Thanks for taking the time to file this report,
and for following up :)

     Regards,
       Mark

[Message part 3 (message/rfc822, inline)]
From: johnanthony <at> lavabit.com
To: bug-guile <at> gnu.org
Subject: Bug Report: scm_with_guile inside pthread segfault
Date: Fri, 22 Mar 2013 08:15:04 -0400 (EDT)
Hey, there. I was asked to provide this information to you by the
guilefriends in Freenode #guile. This code segfaults and I've been having
trouble figuring out why.

I'm running Ubuntu 12.10 i686 and I'm happy to help any way I can if you
need any more information. Please forgive me if I'm doing a terrible job
of this as I've never submitted a bug report before.


Version Information:
guile 2.0.5-deb+1-3
libgc 1:7.1-9


Example program:
```
#include <libguile.h>

static void*
register_functions(void* data){
    int argc = 1;
    char *argv[] = {"guile", "--listen=54491"};

    scm_shell(argc, argv);
    return NULL;
}

static void*
thread_scheme(void* data) {
    scm_with_guile(&register_functions, NULL);
    return NULL;
}

int main(void) {
    pthread_t *threads;
    pthread_attr_t pthread_custom_attr;

    threads = malloc(sizeof(pthread_t));
    pthread_attr_init(&pthread_custom_attr);
    pthread_create(&threads[0], &pthread_custom_attr, thread_scheme, NULL);

    pthread_join(threads[0], NULL);
    return 0;
}
```


Built with gcc (version 4.7.2) like so:

    gcc test-program.c -ggdb -o test `pkg-config guile-2.0 --cflags` \
        `pkg-config guile-2.0 --libs`


And here's the bt:
```
Reading symbols from /home/john/test...done.
(gdb) r
Starting program: /home/john/test
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1".
[New Thread 0xb7a24b40 (LWP 15154)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb7a24b40 (LWP 15154)]
0xb7c654ef in GC_push_all_eager () from /usr/lib/libgc.so.1
(gdb) thread apply all bt

Thread 2 (Thread 0xb7a24b40 (LWP 15154)):
#0  0xb7c654ef in GC_push_all_eager () from /usr/lib/libgc.so.1
#1  0xb7c65543 in GC_push_all_stack () from /usr/lib/libgc.so.1
#2  0xb7c6dc4b in GC_push_all_stacks () from /usr/lib/libgc.so.1
#3  0xb7c68724 in GC_default_push_other_roots () from /usr/lib/libgc.so.1
#4  0xb7c66be5 in GC_push_roots () from /usr/lib/libgc.so.1
#5  0xb7c66056 in GC_mark_some () from /usr/lib/libgc.so.1
#6  0xb7c5cf15 in GC_stopped_mark () from /usr/lib/libgc.so.1
#7  0xb7c5d61a in GC_try_to_collect_inner () from /usr/lib/libgc.so.1
#8  0xb7c67e90 in GC_init_inner () from /usr/lib/libgc.so.1
#9  0xb7c67fe4 in GC_init () from /usr/lib/libgc.so.1
#10 0xb7eb9d90 in ?? () from /usr/lib/libguile-2.0.so.22
#11 0xb7ecb5d7 in ?? () from /usr/lib/libguile-2.0.so.22
#12 0xb7f29100 in ?? () from /usr/lib/libguile-2.0.so.22
#13 0xb7f2913e in ?? () from /usr/lib/libguile-2.0.so.22
#14 0xb7c67a6e in GC_call_with_stack_base () from /usr/lib/libgc.so.1
#15 0xb7f2949f in scm_with_guile () from /usr/lib/libguile-2.0.so.22
#16 0x0804879a in thread_scheme (data=0x0) at guile-pthread-test.c:14
#17 0xb7e49d4c in start_thread (arg=0xb7a24b40) at pthread_create.c:308
#18 0xb7d86d3e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130

Thread 1 (Thread 0xb7a26b00 (LWP 15149)):
#0  0xb7fdd424 in __kernel_vsyscall ()
#1  0xb7e4ae1c in pthread_join (threadid=3080866624, thread_return=0x0) at
pthread_join.c:89
#2  0x0804880c in main () at guile-pthread-test.c:26
(gdb) q
```





This bug report was last modified 12 years and 66 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.