bugGNU Prolog for Java - Bugs: bug #31550, abolish/assertz does not work...

 
 

bug #31550: abolish/assertz does not work correctly.

Submitter:  None
Submitted:  Fri 05 Nov 2010 02:51:04 AM UTC
   
 
Category:  Standards Compliance Severity:  4 - Important
Item Group:  Test failure: inria Status:  Fixed
Privacy:  Public Assigned to:  drt24
Open/Closed:  Closed Planned Release:  0.3.0
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 02 Jan 2011 04:05:53 PM UTC, comment #5: 

I have used the files you provided to produce some unit tests to ensure that this bug does not reoccur: http://git.savannah.gnu.org/cgit/gnuprologjava.git/commit/?h=newmaster&id=d7f5854e292327af5e27e3cf1777229a89f17814
All these tests pass so I am marking this bug report as fixed.

Now though this bug is fixed in the current newmaster branch this is perhaps not particularly useful to you - do you want me to push out a point release to 0.2 with this fix in? It will probably be a little while longer before 0.3 is ready for release as there are some more API breaking changes I want to make first. Since I intend to do some fairly major refactoring to the code before 0.3 it probably isn't a good idea to run off the newmaster branch (though most of this refactoring isn't to user facing code).

(file #22336)

Daniel Thomas <drt24>
Group administrator
Sat 01 Jan 2011 11:44:16 PM UTC, comment #4: 

The bug that caused bug_abolish to fail has been fixed in:
http://git.savannah.gnu.org/cgit/gnuprologjava.git/commit/?h=newmaster&id=8e6da425f41fdf42582553ff00c54ac9fa6d2c7e

However there may be another bug which is causing bug_retract to fail (fails rather than succeeding - it doesn't run out of stack). I am currently investigating why bug_retract isn't working.

Daniel Thomas <drt24>
Group administrator
Sat 01 Jan 2011 07:05:00 PM UTC, comment #3: 

I now have failing tests for this a minimal test which illustrates this bug is:

:- dynamic(aFoo/1).
:- initialization(assertz(aFoo(1)),aFoo(1),assertz(aFoo(2)),aFoo(2)).

Daniel Thomas <drt24>
Group administrator
Fri 31 Dec 2010 05:10:53 PM UTC, comment #2: 

Sorry - I only just saw this bug report (I thought savannah was set to email me but it appears that it doesn't).
I will look into it now.

Daniel Thomas <drt24>
Group administrator
Fri 05 Nov 2010 02:53:42 AM UTC, comment #1: 

Oops.  I should have written 'bug_abolish.pl', rather than 'speed.pl'.

Anonymous
Fri 05 Nov 2010 02:51:04 AM UTC, original submission:  

While porting an interpreter for our JStar programming language from GNU Prolog to GnuPrologJava, I noticed several strange behaviours related to not finding previously asserted clauses.

In essence, one can do assertz(foo(Term)), but then later foo(Var) does not pick up Term.  Simple examples work okay, but once abolish or retract are used, they stop working.

The attached speed.pl file illustrates the bug.
The initialization of setup(2), creates two tuples: strictBefore(0,1) and strictBefore(1,2).  So the complete_transitive_closure predicate should add strictBefore(0,2) and then stop.  But on the second time around it fails to find strictBefore(0,2), so keeps on adding it an infinite number of times until some stack overflows.

[the 'added assertz' lines are from a Java print statement
that I added to Predicate_assertz, and count=N shows the size
of the 'clauses' list for that predicate].
------------- example output from bug_abolish.pl ---------
loading source file: speed
added assertz clause: strictBefore(1,2) :- true count=1
added assertz clause: strictBefore(0,1) :- true count=2
added assertz clause: transitive_closure_continue(maybe) :- true count=1
added assertz clause: strictBefore(0,2) :- true count=3
added assertz clause: transitive_closure_continue(yes) :- true count=2
added assertz clause: transitive_closure_continue(maybe) :- true count=1
added assertz clause: strictBefore(0,2) :- true count=4
added assertz clause: transitive_closure_continue(yes) :- true count=2
added assertz clause: transitive_closure_continue(maybe) :- true count=1
added assertz clause: strictBefore(0,2) :- true count=5
added assertz clause: transitive_closure_continue(yes) :- true count=2
added assertz clause: transitive_closure_continue(maybe) :- true count=1
added assertz clause: strictBefore(0,2) :- true count=6
...
---------------------------------------------------------

Interestingly, the slightly simpler bug_okay.pl works correctly, even though it is performing exactly the same operations on the strictBefore predicate.  So I conjecture that the abolish of the other predicate is somehow related to the bug.
----------- output from bug_okay.pl ------------------
loading source file: bug_okay
added assertz clause: strictBefore(1,2) :- true count=1
added assertz clause: strictBefore(0,1) :- true count=2
added assertz clause: strictBefore(0,2) :- true count=3
stopping with status 1


If I change from abolish to retract, the bug is still there.
(See bug_retract.pl).


This is a show stopper bug for the kinds of programs we're trying to get working in gnuprologjava.  I'm really keen to see it fixed, because gnuprologjava offers a nice integration of Prolog and Java, which would be ideal for our purposes.

Thanks
Mark Utting
Waikato University.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #22336:  Execute.java added by drt24 (4KiB - Updated Execute.java to work with current newmaster branch code)
file #21925:  bug_abolish.pl added by None (1007B - application/octet-stream)
file #21926:  bug_okay.pl added by None (405B - application/octet-stream)
file #21927:  bug_retract.pl added by None (1KiB - application/octet-stream)
file #21928:  Execute.java added by None (4KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

Only logged-in users can vote.

 

Follow 13 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2011-01-03 drt24 Open/ClosedOpen Closed
2011-01-02 drt24 StatusIn Progress Fixed
    Planned ReleaseNone 0.3.0
    Attached File- Added Execute.java, #22336
    Severity3 - Normal 4 - Important
2011-01-01 drt24 StatusConfirmed In Progress
2011-01-01 drt24 Item GroupNone Test failure: inria
    StatusNone Confirmed
    Assigned toNone drt24
2010-11-05 None Attached File- Added bug_abolish.pl, #21925
    Attached File- Added bug_okay.pl, #21926
    Attached File- Added bug_retract.pl, #21927
    Attached File- Added Execute.java, #21928

Back to the top

Powered by Savane 3.13-4448.
Corresponding source code