bug-guile
[Top][All Lists]
Advanced

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

bug#14035: Bug Report: scm_with_guile inside pthread segfault


From: johnanthony
Subject: bug#14035: Bug Report: scm_with_guile inside pthread segfault
Date: Fri, 22 Mar 2013 08:15:04 -0400 (EDT)
User-agent: SquirrelMail/1.4.13

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
```







reply via email to

[Prev in Thread] Current Thread [Next in Thread]