Hi Nils,

On 2012-09-06, Nils Bruin <nbr...@sfu.ca> wrote:
> We've seen before that invalidated expect interfaces can interact
> unexpectedly with weakreffed stuff in entirely unrelated places.

grep weak -R sage/interfaces told me:

  sage/interfaces/expect.py: quit.expect_objects.append(weakref.ref(self))
and
  sage/interfaces/mwrank.py:    instances[options] = weakref.ref(X)

So, weak references *are* involved.

I wonder why the pexpect interfaces are referred in a weak way.

A potential debugging approach is now: Add a callback to the weak reference
that prints a message when a pexpect interface gets collected. In that way,
I should see whether a premature collection occurs.

Could there be a race condition? Like this: Some interface E is deleted,
so, E.__del__() is called, which involves E.quit(). If I am not
mistaken (correct me if I'm wrong), the weak reference to E is still valid
until E.__del__() has finished. The racing condition is: *During* execution
of E.quit() inside E.__del__(), it could happen that
sage.interfaces.quit.invalidate_all() is called. Since the weak reference
to E is still valid, another call to E.quit() would occur *before* the first
call to E.quit() is done.

And nested pexpect call will lock the interface.

Cheers,
Simon

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To post to this group, send email to sage-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-devel+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.


Reply via email to