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

Close

#159 XSB-Interprolog crashing in JNI interface

Performance problem
closed-out-of-date
nobody
5
2013-08-07
2007-11-13
Anonymous
No

We've been using Interprolog, with the JNI interface, and we have it
working fine. (However, it may be that we have made some changes to
it to make it work. Those changes should have been propagated back to
the most recent release of Interprolog from Declarativa, but there may
still be some problems.)
</begin> Here is my bug report for JNI crash in Interprolog--Java interface. On my computer, it crashes for parameter 462 and not 461. Either case, I am sure it will crash for 600. (Or choose a number
large enough for which it will crash). There is a bug in the Java Prolog interface of Interprolog.

C:\visual>javac -classpath grappa1_2.jar; interprolog.jar; -
Xlint:unchecked debugCrash.java

C:\visual>java -classpath grappa1_2.jar;interprolog.jar; d
ebugCrash "c:\\tools\\xsb\\3.1\\XSB\\config\\x86-pc-windows\\bin"
[xsb_configuration loaded]
[sysinitrc loaded]
[interprolog loaded]
[Compiling .\debug]
++Warning[XSB]: [Compiler] .\debug: Singleton variable Head in a clause of len/2

[debug compiled, cpu time used: 0.6100 seconds]
[debug loaded]
debug loaded okay
ended prolog thing..
#
# An unexpected error has been detected by Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6d886564, pid=5904, tid=1428
#
# Java VM: Java HotSpot(TM) Client VM (1.6.0-b105 mixed mode)
# Problematic frame:
# V [jvm.dll+0xc6564]
#
# An error report file with more information is saved as hs_err_pid5904.log
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
#

C:\work\windows\scanner\visual>

Code:

debugCrash.java

import java.io.*;

import com.declarativa.interprolog.*;
import com.xsb.interprolog .*;

public class debugCrash {

public static void main(String[] args) {

if(args.length != 1) {
System.out.println("usage java debugCrash <XsbBinPath> ");
System.exit(1);
}

String xsbDir = args[0];

PrologEngine prologEngine = new NativeEngine(xsbDir);

if( prologEngine.deterministicGoal ("consult('" + "debug" + "')") )
System.out.println("debug loaded okay");
else
System.out.println("debug not loaded");

TermModel list = (TermModel) prologEngine.
deterministicGoal("crash(Users, 462), buildTermModel(Users,Out)",
"[Out]")[0];

prologEngine.shutdown ();

System.out.println("End of code");

}

}

debug.p:

len([], 0).
len([Head|Tail], L) :-
len(Tail, TL), L is TL + 1.

gen(0, []).
gen(L, [Head|Tail]) :-
TL is L -1,
gen(TL, Tail),
Head = hostAndUser(localhost2,'S-1-1-0')
%Head = hostAndUser(l, sssss)
.

/*

Head = hostAndUser(localhost2,'S-1-1-0')

crashes for 462, not 461

*/

crash(P, Size) :-
gen(Size, P), writeln('ended prolog thing..').

Discussion

  • Michael Kifer
    Michael Kifer
    2013-08-07

    • status: open --> closed-out-of-date
    • Group: --> Performance problem