Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo


#31 CLIPS garbage collection may cause segmentation fault

Annoyances (7)
Francesco Garosi

Due to the particular behaviour of CLIPS while garbage
collecting items, there are some situations where
inspection of entities that have been garbage-collected
can cause an access violation. In fact, CLIPS does not
retain the memory associated to slots in facts that
meet the following conditions:

- the fact has been created using a template
- the fact has not yet been asserted

In PyCLIPS versions up to 1.0.4, CLIPS garbage
collection locking is disabled by default, and this may
cause segmentation faults (or other annoyances, such as
strange characters while retrieving strings) when using
functions that inquire such items.

Although this bug is unlikely to be triggered, it would
be desirable to have PyCLIPS answer with an exception
instead of an abnormal program termination.


  • Logged In: YES

    Actually the version present in the SVN repository highly
    reduces the problem impact, by forcing CLIPS GC lock (for
    each environment separately) whenever there are still such
    facts around. GC is automatically re-enabled when either all
    facts have been asserted, or [Env]Clear() is invoked.

    However there is still one case that produces an access
    violation - although even more unlikely to happen:

    >>> import clips
    >>> clips.Reset()
    >>> t = clips.BuildTemplate("t", "(slot s0)")
    >>> f = t.BuildFact()
    >>> f.Slots['s0'] = clips.Symbol("SYM0")
    >>> clips.Clear()
    >>> print f.PPForm()

    This is just an example, other inquiries may still produce
    the same result after a call to Clear().

  • Logged In: YES
    Originator: YES

    The recently implemented changes allow to report with an exception most of the times that CLIPS GC would compromise a Python object. Not all situations are prevented, however the new structure should work in most cases. The bug will still be considered open until a final solution has been found.

  • Logged In: YES
    Originator: YES

    The fix for bug 1886693 does also solve this bug. Will be uploaded to SVN ASAP.

  • Logged In: YES
    Originator: YES

    The fixes for this bug or request have been accepted and
    committed to current RCS tree: next release will include these
    fixes, possibly among other enhancements.

  • Logged In: YES
    Originator: YES

    svn297 implements changes that fix this bug and another one.

    • status: open --> closed