Re: Exception: Optimistic invariant violated but no fallback expression

Matthias Radestock <[email protected]> Mon, 06 Nov 2006 08:30:41 +0000
Newsgroups gmane.comp.java.sisc.user
Message-ID <[email protected]>
"Ben Simon" <[email protected]> writes:

> I'm developing a web app using SISCweb.  Tonight I was working with one of
> the sisclets, and managed to encounter the following error.  I've never seen
> anything like, and it looks awfully scary. Any suggestions of what it means,
> or how I should fix it?  I'm just curious if this means anything to someone,
> if not, I'll just start debugging it like it were any other issue.
>
> sisc.nativefun.PrimRuntimeException: Optimistic invariant violated but
> no fallback expression.
> 	sisc.data.Procedure.throwPrimException(Unknown Source)
> 	sisc.exprs.fp.FixedAppExp_0.revert(Unknown Source)
> 	sisc.exprs.fp.FixedAppExp_0.forceRevert(Unknown Source)
> 	sisc.exprs.fp.FixedAppExp_0.getValue(Unknown Source)
> 	sisc.exprs.FillRibExp.eval(Unknown Source)
> 	sisc.interpreter.Interpreter.interpret(Unknown Source)
> 	sisc.interpreter.Interpreter.interpret(Unknown Source)
> 	sisc.interpreter.Interpreter.eval(Unknown Source)
> 	siscweb.web.SISCAdapterServlet$1.execute(SISCAdapterServlet.java:160)
> 	sisc.interpreter.Context.execute(Unknown Source)
> 	sisc.interpreter.Context.execute(Unknown Source)
> 	siscweb.web.SISCAdapterServlet.doGet(SISCAdapterServlet.java:154)
> 	siscweb.web.SISCAdapterServlet.doPost(SISCAdapterServlet.java:179)
> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

Simon,

I can give you some background to the error.

When the SISC compiler (to micro expressions) optimises code it
sometimes does so on the basis of conditions that hold at the time but
can later change. A typical example is inlining of calls to primitives,
which can become invalid if the primitives get re-defined as ordinary
functions. When such code is executed and the conditions have change
then the code gets unoptimised. This involves construction of a
replacement micro expression and informing the surrounding expression
(the 'host') of the change. Unoptimisation also happens when an error is
encountered, so that we can produce stack traces as if optimisation had
never occurred.

In the above example a zero-operand application, e.g. something like
(foo) is being unoptimised, either because |foo| is undefined or some
error occurred when it was called. However, the micro expression does
not have a host. That shouldn't happen. Notice that we are in the
process of evaluating a FillRibExp. That is a micro expression for
evaluating the operands of an application, i.e. we are actually in the
process of evaluating something like (bar (foo)). The host of such a
micro expression should always be the surrounding micro-expression.

This most likely is caused by a bug in the SISC compiler/optimiser, or
the unoptimiser. It must be a fairly unusual case though since we
haven't encountered it before. Another possibility is that the host
ended up being null due to some deserialisation problem. Or you had
the |hedged-inlining| dynamic parameter set to #f when the scheme code
was being compiled, which causes host references to be dropped.

The latter actually looks like the likely cause. It appears that we set
|hedged-inlining| to #f during heap build (see top of
init.{scm,sce}). That is probably safe in most cases since SISC's
environment model prevents mutation of system bindings by user
code, which is the main cause for optimisation assumptions changing
dynamically. However, we also unoptimise on error, which will break if
we don't have host references.

So as a first try I'd recommend changing the hedged-inlining setting in
init.{scm,sce}. If that doesn't fix it then I suggest you

1) find out what expression on your source code the evaluation
corresponds to,

2) determine why it is being unoptimised,

3) watch what happens to the 'host' member variable to figure out why it
ends up being null at the time of unoptimisation.


Matthias

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642