apalache icon indicating copy to clipboard operation
apalache copied to clipboard

[BUG] Unroller produces stack overflow due to a bug in SANY

Open konnov opened this issue 4 years ago • 8 comments

Following #67, we tried to run the unstable version against the light client spec as follows:

apalache-mc check --config=MC3-PrecisionInv.cfg MC2nodes3blocks.tla

Blockchain.tla contains a recursive operator PowerOfSet, which we did not have produce annotations for. The tool should have complained about missing annotations. Instead, it throws a stack overflow:

PASS #1: ConfigurationPass                                        I@11:30:37.199
  > Loading TLC configuration from MC2nodes3blocks.tla            I@11:30:37.201
  > Could not parse TLC configuration in MC2nodes3blocks.tla: unexpected character E@11:30:37.238
PASS #2: UnrollPass                                               I@11:30:37.297
  > Unroller                                                      I@11:30:37.299
PASS #3: InlinePass                                               I@11:30:37.325
  > InlinerOfUserOper                                             I@11:30:37.327
(Please report an issue at: [https://github.com/konnov/apalache/issues],java.lang.StackOverflowError)
Unhandled exception                                               E@11:30:37.576
java.lang.StackOverflowError: null
	at scala.collection.immutable.HashMap.get(HashMap.scala:53)
	at at.forsyte.apalache.tla.lir.transformations.standard.InlinerOfUserOper.$anonfun$transform$1(InlinerOfUserOper.scala:34)

konnov avatar Apr 20 '20 09:04 konnov

The issue is not with Unroller but with INSTANCE-imported recursive operators not being marked recursive (i.e. having .isRecursive = false). See attached minimal example.

Kukovec avatar Apr 20 '20 11:04 Kukovec

test.txt

Kukovec avatar Apr 20 '20 11:04 Kukovec

@Kukovec do you know whether this has been fixed?

konnov avatar Aug 25 '20 13:08 konnov

This is still an issue. For the moment, we will introduce a workaround. This should have been fixed in SANY, but we have to check that.

konnov avatar Oct 30 '20 18:10 konnov

Redirecting this to @konnov, since it's not an Unroller issue.

Kukovec avatar Dec 11 '20 12:12 Kukovec

We should reproduce it again and submit to tlaplus, if the bug is still there.

konnov avatar Dec 11 '20 12:12 konnov

We are going to stop supporting recursive operators and functions. The users should use folds instead. Closing this issue.

konnov avatar Dec 03 '21 10:12 konnov

Reopening, there's still clean-up notes for this:

https://github.com/informalsystems/apalache/blob/91ad7b4edff727f1e8579ca5b2fac1ac2c41bb15/tla-io/src/main/scala/at/forsyte/apalache/tla/imp/ModuleTranslator.scala#L89-L91

https://github.com/informalsystems/apalache/blob/91ad7b4edff727f1e8579ca5b2fac1ac2c41bb15/tla-io/src/test/scala/at/forsyte/apalache/tla/imp/TestSanyImporterInstances.scala#L351-L353

thpani avatar Mar 13 '23 09:03 thpani