unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: johnanthony@lavabit.com
To: 14035@debbugs.gnu.org
Subject: bug#14035: Bug Report: scm_with_guile inside pthread segfault
Date: Fri, 22 Mar 2013 08:15:04 -0400 (EDT)	[thread overview]
Message-ID: <8629.90.244.59.36.1363954504.squirrel@lavabit.com> (raw)

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	other threads:[~2013-03-22 12:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-22 12:15 johnanthony [this message]
2013-03-23 13:56 ` bug#14035: Fixed in 2.0.7 johnanthony
2013-03-24  1:48   ` Mark H Weaver

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8629.90.244.59.36.1363954504.squirrel@lavabit.com \
    --to=johnanthony@lavabit.com \
    --cc=14035@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).