[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-bug: [Bug 909358] Re: race condition in libgeda



Okay.  The problem is in the smob free function used to destroy objects
created from Scheme code.

When an object is created by Scheme code, we need to make sure that it
is destroyed when it goes out of scope. To do this, we need to use the
Guile garbage collector to tell us when it's safe to destroy the object
by calling the smob_free() function in libgeda/src/scheme_smob.c.

To destroy the object, we need to call s_delete_object(). But
s_delete_object() requires a TOPLEVEL as the first argument. But to get
a pointer to a TOPLEVEL, we need to inspect the Guile fluid that
contains the current TOPLEVEL for this thread, using
edascm_c_current_toplevel().  Unfortunately, edascm_c_current_toplevel()
indirectly calls scm_fluid_ref(), which is not permitted to be called
from a smob free function, and can cause a deadlock.

I'm not sure how the testsuite failed to pick this up, and it's very
unclear what can be done about it. One option could be to make the gEDA
smob into a double smob, and when creating the smob to pack a TOPLEVEL
pointer into the second word.

Thoughts, anybody?

** Changed in: geda
   Importance: Undecided => High

** Changed in: geda
       Status: New => Confirmed

** Changed in: geda
       Status: Confirmed => Triaged

-- 
You received this bug notification because you are a member of gEDA Bug
Team, which is subscribed to gEDA.
https://bugs.launchpad.net/bugs/909358

Title:
  race condition in libgeda

Status in GPL Electronic Design Automation tools:
  Triaged

Bug description:
  I think i found a race condition in gschem.
  I cannot say how to replicate this, at now, but i notice this happens after using 'er' keys combination on a bunch of pins. 
  I think, also, the race condition happens when the guile garbage collector runs.
  I attach a file containing the stack frame from the freeze of gschem  to the main call. 
  I hope this can help.

  Regards,
  Luigi

To manage notifications about this bug go to:
https://bugs.launchpad.net/geda/+bug/909358/+subscriptions


_______________________________________________
geda-bug mailing list
geda-bug@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-bug