emacs-bug-tracker
[Top][All Lists]
Advanced

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

[debbugs-tracker] bug#25238: closed (guile-2.2 threading bug)


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#25238: closed (guile-2.2 threading bug)
Date: Wed, 01 Mar 2017 14:43:01 +0000

Your message dated Wed, 01 Mar 2017 15:42:31 +0100
with message-id <address@hidden>
and subject line Re: bug#25238: guile-2.2 threading bug
has caused the debbugs.gnu.org bug report #25238,
regarding guile-2.2 threading bug
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
25238: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=25238
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: guile-2.2 threading bug Date: Tue, 20 Dec 2016 14:13:44 -0600
Merry Christmas!  A guile-git threading bug!

-- linas


$ cat fail.cc
//
// fail.cc
//
// This C++ program crashes, when compiled against todays (20 Dec 2016)
// guile-2.2 from git. git log says a recent commit is
//    0ce8a9a5e01d3a12d83fea85968e1abb602c9298
// but I beielve any guile-2.2 version from late 2016 will crash.
//
// I built this as:
// cc fail.cc -I /usr/local/include/guile/2.2 -lguile-2.2  -lpthread -lstdc++
//
// gdb gives the following stack trace:
/*****
Thread 7 "a.out" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff3306700 (LWP 23578)]
0x00007ffff7b03076 in is_dynamic_state (x=0x0) at ../../libguile/fluids.c:97
97  return SCM_HAS_TYP7 (x, scm_tc7_dynamic_state);
(gdb) bt
#0  0x00007ffff7b03076 in is_dynamic_state (x=0x0) at ../../libguile/fluids.c:97
#1  scm_set_current_dynamic_state (address@hidden)
    at ../../libguile/fluids.c:496
#2  0x00007ffff7b6351a in guilify_self_2 (address@hidden)
    at ../../libguile/threads.c:466
#3  0x00007ffff7b63e0c in scm_i_init_thread_for_guile (base=0x7ffff3305df0,
    dynamic_state=0x0) at ../../libguile/threads.c:595
#4  0x00007ffff7b63e59 in with_guile (address@hidden,
    address@hidden) at ../../libguile/threads.c:638
#5  0x00007ffff6c15812 in GC_call_with_stack_base (
    address@hidden <with_guile>, address@hidden)
    at misc.c:1925
#6  0x00007ffff7b641f8 in scm_i_with_guile (dynamic_state=<optimized out>,
    data=<optimized out>, func=<optimized out>) at ../../libguile/threads.c:688
#7  scm_with_guile (func=<optimized out>, data=<optimized out>)
    at ../../libguile/threads.c:694
#8  0x0000555555555064 in foo(int) ()
#9  0x0000555555556776 in void std::_Bind_simple<void
(*(int))(int)>::_M_invoke<0ul>(std::_Index_tuple<0ul>) ()
#10 0x00005555555566c9 in std::_Bind_simple<void (*(int))(int)>::operator()() ()
#11 0x00005555555566a8 in
std::thread::_State_impl<std::_Bind_simple<void (*(int))(int)>
>::_M_run() ()
#12 0x00007ffff75cccdf in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#13 0x00007ffff789b464 in start_thread (arg=0x7ffff3306700) at
pthread_create.c:333
#14 0x00007ffff70469df in clone () at
../sysdeps/unix/sysv/linux/x86_64/clone.S:105
(gdb)
 ****/


#include <libguile.h>

#include <thread>
#include <vector>

void * wrap_foo(void *p)
{
   scm_c_eval_string ("(setlocale LC_ALL \"\")");
}

static volatile bool hold = true;

void foo(int thread_id)
{
   while (hold) {} // spin
   // A long sleep here avoids the crash
   // usleep(thread_id * 100000);
   scm_with_guile(wrap_foo, nullptr);
}

main()
{
   int n_threads = 12;
   std::vector<std::thread> thread_pool;
   for (int i=0; i < n_threads; i++)
      thread_pool.push_back(std::thread(&foo, i));

   printf("Done creating %d threads\n", n_threads);
   hold = false;

   for (std::thread& t : thread_pool) t.join();
   printf("Done joining %d threads\n", n_threads);
}



--- End Message ---
--- Begin Message --- Subject: Re: bug#25238: guile-2.2 threading bug Date: Wed, 01 Mar 2017 15:42:31 +0100 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)
On Tue 20 Dec 2016 21:13, Linas Vepstas <address@hidden> writes:

> Thread 7 "a.out" received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 0x7ffff3306700 (LWP 23578)]
> 0x00007ffff7b03076 in is_dynamic_state (x=0x0) at ../../libguile/fluids.c:97
> 97  return SCM_HAS_TYP7 (x, scm_tc7_dynamic_state);
> (gdb) bt
> #0  0x00007ffff7b03076 in is_dynamic_state (x=0x0) at 
> ../../libguile/fluids.c:97
> #1  scm_set_current_dynamic_state (address@hidden)
>     at ../../libguile/fluids.c:496
> #2  0x00007ffff7b6351a in guilify_self_2 (address@hidden)
>     at ../../libguile/threads.c:466
> #3  0x00007ffff7b63e0c in scm_i_init_thread_for_guile (base=0x7ffff3305df0,
>     dynamic_state=0x0) at ../../libguile/threads.c:595
> #4  0x00007ffff7b63e59 in with_guile (address@hidden,
>     address@hidden) at ../../libguile/threads.c:638

I believe this one was fixed in 63bf6ffa0d3cdddf8151cc80ac18fe5dfb614587
which was released in 2.1.7.  Please open a new bug when you find
another one :)

Andy


--- End Message ---

reply via email to

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