unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#15411: libguile initialization inside a pthread segfaults
@ 2013-09-18 19:36 Dale Mellor
  2013-10-13 14:06 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Dale Mellor @ 2013-09-18 19:36 UTC (permalink / raw)
  To: 15411

[-- Attachment #1: Type: text/plain, Size: 3157 bytes --]

The following program fails; it produces the session shown below.  Any
help greatly appreciated.

Dale



=PROGRAM==============================================================
#include <libguile.h>



static void *do_guile (void *)
{
  for (;;) ;

  return nullptr;
}



static void *run_thread (void *)
{
  return scm_with_guile (&do_guile, nullptr);
}



int main (int, char **)
{
  pthread_t thread;
  pthread_create (&thread, nullptr, run_thread, nullptr);

  pthread_join (thread, nullptr);

  return 0;
}

=/PROGRAM=============================================================

=SESSION==============================================================
$ cat /etc/debian_version 
7.1

$ g++-4.6 --version
g++-4.6 (Debian 4.6.3-14) 4.6.3

$ guile --version
guile (GNU Guile) 2.0.5-deb+1-3

$ g++-4.6 --std=c++0x test.cc `pkg-config --libs --cflags guile-2.0` -g

$ gdb a.out
GNU gdb (GDB) 7.4.1-debian
This GDB was configured as "i486-linux-gnu".
Reading symbols from a.out...done.
(gdb) r
Starting program: a.out 
warning: Could not load shared library symbols for linux-gate.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library
"/lib/i386-linux-gnu/i686/cmov/libthread_db.so.1".
[New Thread 0xb7916b40 (LWP 4792)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb7916b40 (LWP 4792)]
0xb7e2854f in GC_push_all_eager () from /usr/lib/libgc.so.1
(gdb) info stack
#0  0xb7e2854f in GC_push_all_eager () from /usr/lib/libgc.so.1
#1  0xb7e285a3 in GC_push_all_stack () from /usr/lib/libgc.so.1
#2  0xb7e30b9b in GC_push_all_stacks () from /usr/lib/libgc.so.1
#3  0xb7e2b6e4 in GC_default_push_other_roots ()
from /usr/lib/libgc.so.1
#4  0xb7e29c45 in GC_push_roots () from /usr/lib/libgc.so.1
#5  0xb7e290b6 in GC_mark_some () from /usr/lib/libgc.so.1
#6  0xb7e1ffb5 in GC_stopped_mark () from /usr/lib/libgc.so.1
#7  0xb7e206ba in GC_try_to_collect_inner () from /usr/lib/libgc.so.1
#8  0xb7e2ae50 in GC_init_inner () from /usr/lib/libgc.so.1
#9  0xb7e2afa4 in GC_init () from /usr/lib/libgc.so.1
#10 0xb7eba7d0 in ?? () from /usr/lib/libguile-2.0.so.22
#11 0xb7ecbebd in ?? () from /usr/lib/libguile-2.0.so.22
#12 0xb7f29750 in ?? () from /usr/lib/libguile-2.0.so.22
#13 0xb7f29790 in ?? () from /usr/lib/libguile-2.0.so.22
#14 0xb7e2aa2e in GC_call_with_stack_base () from /usr/lib/libgc.so.1
#15 0xb7f2998f in scm_with_guile () from /usr/lib/libguile-2.0.so.22
#16 0x08048663 in run_thread () at test.cc:16
#17 0xb7cb2cf1 in start_thread ()
   from /lib/i386-linux-gnu/i686/cmov/libpthread.so.0
#18 0xb7bebfee in clone () from /lib/i386-linux-gnu/i686/cmov/libc.so.6
(gdb) thr 1
[Switching to thread 1 (Thread 0xb7918700 (LWP 4789))]
#0  0xb7fde424 in __kernel_vsyscall ()
(gdb) info stack
#0  0xb7fde424 in __kernel_vsyscall ()
#1  0xb7cb3d8c in pthread_join ()
   from /lib/i386-linux-gnu/i686/cmov/libpthread.so.0
#2  0x080486a6 in main () at test.cc:26
(gdb) quit

=/SESSION=============================================================

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#15411: libguile initialization inside a pthread segfaults
  2013-09-18 19:36 bug#15411: libguile initialization inside a pthread segfaults Dale Mellor
@ 2013-10-13 14:06 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2013-10-13 14:06 UTC (permalink / raw)
  To: Dale Mellor; +Cc: 15411-done

Hi Dale,

Dale Mellor <dale@rdmp.org> skribis:

> =PROGRAM==============================================================
> #include <libguile.h>
>
>
>
> static void *do_guile (void *)
> {
>   for (;;) ;
>
>   return nullptr;
> }
>
>
>
> static void *run_thread (void *)
> {
>   return scm_with_guile (&do_guile, nullptr);
> }
>
>
>
> int main (int, char **)
> {
>   pthread_t thread;
>   pthread_create (&thread, nullptr, run_thread, nullptr);
>
>   pthread_join (thread, nullptr);
>
>   return 0;
> }
>
> =/PROGRAM=============================================================

This program is similar to this test:

  http://git.savannah.gnu.org/cgit/guile.git/tree/test-suite/standalone/test-pthread-create-secondary.c

> =SESSION==============================================================
> $ cat /etc/debian_version 
> 7.1
>
> $ g++-4.6 --version
> g++-4.6 (Debian 4.6.3-14) 4.6.3
>
> $ guile --version
> guile (GNU Guile) 2.0.5-deb+1-3

The test above appeared in 2.0.6.  As the comment notes, this bug was
fixed in libgc after version 7.2alpha5.

Thus, I would recommend upgrading libgc.

I’m closing the bug, but feel free to reopen if you think I got it wrong!

HTH,
Ludo’.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-10-13 14:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-18 19:36 bug#15411: libguile initialization inside a pthread segfaults Dale Mellor
2013-10-13 14:06 ` Ludovic Courtès

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).