Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactorings in BindingsMap lead to illegal state #8186

Closed
hubertp opened this issue Oct 30, 2023 · 4 comments · Fixed by #8190
Closed

Refactorings in BindingsMap lead to illegal state #8186

hubertp opened this issue Oct 30, 2023 · 4 comments · Fixed by #8190
Assignees
Labels

Comments

@hubertp
Copy link
Collaborator

hubertp commented Oct 30, 2023

Reported by @GregoryTravis internally:

[ERROR] [2023-10-30T11:48:54-04:00] [enso] Error executing org.enso.interpreter.instrument.job.EnsureCompiledJob@36f96ec4
org.enso.compiler.core.CompilerError: Compiler Internal Error: Empty cache preference metadata local.Task_List.Main
	at org.enso.compiler.core.ir.MetadataStorage.$anonfun$getUnsafe$1(MetadataStorage.scala:80)
	at scala.Option.getOrElse(Option.scala:201)
	at org.enso.compiler.core.ir.MetadataStorage.getUnsafe(MetadataStorage.scala:80)
	at org.enso.compiler.core.Implicits$AsMetadata.unsafeGetMetadata(Implicits.scala:110)
	at org.enso.interpreter.instrument.job.EnsureCompiledJob.$anonfun$getCacheMetadata$2(EnsureCompiledJob.scala:490)
	at scala.Option.map(Option.scala:242)
	at org.enso.interpreter.instrument.job.EnsureCompiledJob.$anonfun$getCacheMetadata$1(EnsureCompiledJob.scala:486)
	at scala.Option.flatMap(Option.scala:283)
	at org.enso.interpreter.instrument.job.EnsureCompiledJob.getCacheMetadata(EnsureCompiledJob.scala:483)
	at org.enso.interpreter.instrument.job.EnsureCompiledJob.$anonfun$setCacheWeights$1(EnsureCompiledJob.scala:461)
	at org.enso.interpreter.instrument.job.EnsureCompiledJob.$anonfun$setCacheWeights$1$adapted(EnsureCompiledJob.scala:460)
	at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:576)
	at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:574)
	at scala.collection.AbstractIterable.foreach(Iterable.scala:933)
	at org.enso.interpreter.instrument.job.EnsureCompiledJob.setCacheWeights(EnsureCompiledJob.scala:460)
	at org.enso.interpreter.instrument.job.EnsureCompiledJob.run(EnsureCompiledJob.scala:59)
	at org.enso.interpreter.instrument.job.EnsureCompiledJob.run(EnsureCompiledJob.scala:41)
	at org.enso.interpreter.instrument.execution.JobExecutionEngine.$anonfun$runInternal$1(JobExecutionEngine.scala:124)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)
	at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotThread.access$001(PolyglotThread.java:53)
	at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotThread$1.execute(PolyglotThread.java:100)
	at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotThread$ThreadSpawnRootNode.executeImpl(PolyglotThread.java:134)
	at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotThread$ThreadSpawnRootNode.execute(PolyglotThread.java:125)
	at jdk.internal.vm.compiler/org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.executeRootNode(OptimizedCallTarget.java:718)
	at jdk.internal.vm.compiler/org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.profiledPERoot(OptimizedCallTarget.java:641)
	at jdk.internal.vm.compiler/org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:574)
	at jdk.internal.vm.compiler/org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:558)
	at jdk.internal.vm.compiler/org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callIndirect(OptimizedCallTarget.java:486)
	at jdk.internal.vm.compiler/org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.call(OptimizedCallTarget.java:467)
	at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotThread.run(PolyglotThread.java:96)
[ERROR] [2023-10-30T11:48:54-04:00] [enso] Error executing org.enso.interpreter.instrument.job.EnsureCompiledJob@623f6d04
org.enso.compiler.core.CompilerError: Compiler Internal Error: Empty dataflow analysis metadata during changeset calculation.
	at org.enso.compiler.core.ir.MetadataStorage.$anonfun$getUnsafe$1(MetadataStorage.scala:80)
	at scala.Option.getOrElse(Option.scala:201)
	at org.enso.compiler.core.ir.MetadataStorage.getUnsafe(MetadataStorage.scala:80)
	at org.enso.compiler.core.Implicits$AsMetadata.unsafeGetMetadata(Implicits.scala:110)
	at org.enso.compiler.context.ChangesetBuilder.compute(ChangesetBuilder.scala:133)
	at org.enso.compiler.context.ChangesetBuilder.build(ChangesetBuilder.scala:118)
	at org.enso.interpreter.instrument.job.EnsureCompiledJob.applyEdits(EnsureCompiledJob.scala:275)
	at org.enso.interpreter.instrument.job.EnsureCompiledJob.ensureCompiledModule(EnsureCompiledJob.scala:103)
	at org.enso.interpreter.instrument.job.EnsureCompiledJob.$anonfun$ensureCompiledFiles$2(EnsureCompiledJob.scala:82)
	at scala.collection.StrictOptimizedIterableOps.map(StrictOptimizedIterableOps.scala:100)
	at scala.collection.StrictOptimizedIterableOps.map$(StrictOptimizedIterableOps.scala:87)
	at scala.collection.mutable.ArrayDeque.map(ArrayDeque.scala:39)
	at org.enso.interpreter.instrument.job.EnsureCompiledJob.ensureCompiledFiles(EnsureCompiledJob.scala:82)
	at org.enso.interpreter.instrument.job.EnsureCompiledJob.run(EnsureCompiledJob.scala:58)
	at org.enso.interpreter.instrument.job.EnsureCompiledJob.run(EnsureCompiledJob.scala:41)
	at org.enso.interpreter.instrument.execution.JobExecutionEngine.$anonfun$runInternal$1(JobExecutionEngine.scala:124)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)
	at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotThread.access$001(PolyglotThread.java:53)
	at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotThread$1.execute(PolyglotThread.java:100)
	at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotThread$ThreadSpawnRootNode.executeImpl(PolyglotThread.java:134)
	at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotThread$ThreadSpawnRootNode.execute(PolyglotThread.java:125)
	at jdk.internal.vm.compiler/org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.executeRootNode(OptimizedCallTarget.java:718)
	at jdk.internal.vm.compiler/org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.profiledPERoot(OptimizedCallTarget.java:641)
	at jdk.internal.vm.compiler/org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:574)
	at jdk.internal.vm.compiler/org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:558)
	at jdk.internal.vm.compiler/org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callIndirect(OptimizedCallTarget.java:486)
	at jdk.internal.vm.compiler/org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.call(OptimizedCallTarget.java:467)
	at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotThread.run(PolyglotThread.java:96)
[TRACE] [2023-10-30T11:48:54-04:00] [enso] Run program 813889f6-3915-45a6-9af3-d2218e87310a
[WARN] [2023-10-30T11:48:54-04:00] [enso] Execution of function main failed (Reassigining bindings to CompilerContext.Module{module=Module[Standard.Visualization.Preprocessor]}).
java.lang.IllegalStateException: Reassigining bindings to CompilerContext.Module{module=Module[Standard.Visualization.Preprocessor]}
	at org.enso.interpreter.runtime.TruffleCompilerContext$ModuleUpdater.close(TruffleCompilerContext.java:307)
	at org.enso.interpreter.runtime.TruffleCompilerContext.updateModule(TruffleCompilerContext.java:169)
	at org.enso.compiler.phase.ImportResolver.$anonfun$mapImports$7(ImportResolver.scala:114)
	at scala.Option.map(Option.scala:242)
	at org.enso.compiler.phase.ImportResolver.go$1(ImportResolver.scala:111)
	at org.enso.compiler.phase.ImportResolver.mapImports(ImportResolver.scala:149)
	at org.enso.compiler.Compiler.liftedTree1$1(Compiler.scala:477)
	at org.enso.compiler.Compiler.runImportsAndExportsResolution(Compiler.scala:476)
	at org.enso.compiler.Compiler.$anonfun$runCompilerPipeline$2(Compiler.scala:267)
	at scala.collection.immutable.List.flatMap(List.scala:293)
	at org.enso.compiler.Compiler.runCompilerPipeline(Compiler.scala:266)
	at org.enso.compiler.Compiler.go$1(Compiler.scala:231)
	at org.enso.compiler.Compiler.runInternal(Compiler.scala:238)
	at org.enso.compiler.Compiler.run(Compiler.scala:134)
	at org.enso.interpreter.runtime.Module.compile(Module.java:387)
	at org.enso.interpreter.runtime.Module.compileScope(Module.java:314)
	at org.enso.interpreter.service.ExecutionService.prepareFunctionCall(ExecutionService.java:128)
	at org.enso.interpreter.service.ExecutionService.execute(ExecutionService.java:236)
	at org.enso.interpreter.instrument.job.ProgramExecutionSupport$.executeProgram(ProgramExecutionSupport.scala:105)
	at org.enso.interpreter.instrument.job.ProgramExecutionSupport$.$anonfun$runProgram$3(ProgramExecutionSupport.scala:213)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
	at cats.syntax.EitherObjectOps$.catchNonFatal$extension(either.scala:391)
	at org.enso.interpreter.instrument.job.ProgramExecutionSupport$.$anonfun$runProgram$2(ProgramExecutionSupport.scala:213)
	at scala.util.Either.flatMap(Either.scala:352)
	at org.enso.interpreter.instrument.job.ProgramExecutionSupport$.runProgram(ProgramExecutionSupport.scala:207)
	at org.enso.interpreter.instrument.job.ExecuteJob.run(ExecuteJob.scala:43)
	at org.enso.interpreter.instrument.job.ExecuteJob.run(ExecuteJob.scala:18)
	at org.enso.interpreter.instrument.execution.JobExecutionEngine.$anonfun$runInternal$1(JobExecutionEngine.scala:124)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)
	at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotThread.access$001(PolyglotThread.java:53)
	at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotThread$1.execute(PolyglotThread.java:100)
	at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotThread$ThreadSpawnRootNode.executeImpl(PolyglotThread.java:134)
	at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotThread$ThreadSpawnRootNode.execute(PolyglotThread.java:125)
	at jdk.internal.vm.compiler/org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.executeRootNode(OptimizedCallTarget.java:718)
	at jdk.internal.vm.compiler/org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.profiledPERoot(OptimizedCallTarget.java:641)
	at jdk.internal.vm.compiler/org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:574)
	at jdk.internal.vm.compiler/org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:558)
	at jdk.internal.vm.compiler/org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callIndirect(OptimizedCallTarget.java:486)
	at jdk.internal.vm.compiler/org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.call(OptimizedCallTarget.java:467)
	at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotThread.run(PolyglotThread.java:96)
[TRACE] [2023-10-30T11:48:54-04:00] [enso] Execution finished: Left(Failure(Execution of function main failed (Reassigining bindings to CompilerContext.Module{module=Module[Standard.Visualization.Preprocessor]}).,None))
[TRACE] [2023-10-30T11:48:56-04:00] [org.enso.languageserver.runtime.RuntimeConnector] received handled MessageFromRuntime(Response(None,ExecutionFailed(813889f6-3915-45a6-9af3-d2218e87310a,Failure(Execution of function main failed (Reassigining bindings to CompilerContext.Module{module=Module[Standard.Visualization.Preprocessor]}).,None)))) from Actor[akka://language-server/deadLetters]
DEBUG] [2023-10-30T11:48:56-04:00] [enso] Job ExecuteJob(contextId=813889f6-3915-45a6-9af3-d2218e87310a) finished in 23624 ms.
[TRACE] [2023-10-30T11:48:56-04:00] [org.enso.languageserver.runtime.ContextRegistry] received handled ExecutionFailed(813889f6-3915-45a6-9af3-d2218e87310a,Failure(Execution of function main failed (Reassigining bindings to CompilerContext.Module{module=Module[Standard.Visualization.Preprocessor]}).,None)) from Actor[akka://language-server/deadLetters]
[TRACE] [2023-10-30T11:48:56-04:00] [org.enso.languageserver.protocol.json.JsonConnectionController] received handled ExecutionFailedNotification(813889f6-3915-45a6-9af3-d2218e87310a,ExecutionFailure(Execution of function main failed (Reassigining bindings to CompilerContext.Module{module=Module[Standard.Visualization.Preprocessor]}).,None)) from Actor[akka://language-server/user/session-router#-510935006]
[WARN] [2023-10-30T11:48:56-04:00] [enso] Attempt to serialize the module [local.Task_List.Main] at stage [AFTER_IMPORT_RESOLUTION].
[TRACE] [2023-10-30T11:48:56-04:00] [org.enso.jsonrpc.JsonRpcServer] Sent text message {"jsonrpc":"2.0","method":"executionContext/executionFailed","params":{"contextId":"813889f6-3915-45a6-9af3-d2218e87310a","message":"Execution of function main failed (Reassigining bindings to CompilerContext.Module{module=Module[Standard.Visualization.Preprocessor]}).","path":null}}.
@JaroslavTulach
Copy link
Member

What are the steps to reproduce?

@GregoryTravis
Copy link
Contributor

Just open the attached project.
Task_List.tgz

@JaroslavTulach JaroslavTulach moved this from ❓New to ⚙️ Design in Issues Board Oct 31, 2023
@JaroslavTulach
Copy link
Member

enso$ git log | head -n1
commit 3d23c6a8d0741c37af736df0c3e002cc4b58edd9
enso$ tar fxz Task_List.tgz
enso$ sbt clean
enso$ sbt runEngineDistribution --run Task_List
[WARN] [2023-10-31T06:37:13+01:00] [enso.org.enso.librarymanager.local.DefaultLocalLibraryProvider] Local library search path [***/libraries] does not exist.
/home/devel/NetBeansProjects/enso/enso.ide/Task_List/src/Main.enso:25:5: warning: Unused variable operator22.
   25 |     operator22 = operator21.field_names
      |     ^~~~~~~~~~
/home/devel/NetBeansProjects/enso/enso.ide/Task_List/src/Main.enso:33:5: warning: Unused variable operator31.
   33 |     operator31 = operator16.use_first_row_as_names
      |     ^~~~~~~~~~
/home/devel/NetBeansProjects/enso/enso.ide/Task_List/src/Main.enso:44:5: warning: Unused variable operator20.
   44 |     operator20 = operator30.order_by ['order', 'date']
      |     ^~~~~~~~~~
/home/devel/NetBeansProjects/enso/enso.ide/Task_List/src/Main.enso:47:5: warning: Unused variable operator27.
   47 |     operator27 = operator33.write "/Users/gmt/dev/enso/enso/meeting.csv"
      |     ^~~~~~~~~~
/home/devel/NetBeansProjects/enso/enso.ide/Task_List/src/Main.enso:52:5: warning: Unused variable operator35.
   52 |     operator35 = operator40.write "/Users/gmt/dev/enso/enso/meeting.txt"
      |     ^~~~~~~~~~
[success] Total time: 14 s

e.g. no problem when running from CLI.

@JaroslavTulach
Copy link
Member

When opened in the IDE I can see the problem. Thank you for your bug report, @GregoryTravis.

@JaroslavTulach JaroslavTulach moved this from ⚙️ Design to 👁️ Code review in Issues Board Oct 31, 2023
@mergify mergify bot closed this as completed in #8190 Oct 31, 2023
mergify bot pushed a commit that referenced this issue Oct 31, 2023
Fixes #8186 by turning `IllegalStateException` into log message. Re-assigning of `BindingsMap` can happen in the IDE where evaluation of modules is repeated again and again. In addition to that avoid dropping errors in compiler without them being noticed.
@github-project-automation github-project-automation bot moved this from 👁️ Code review to 🟢 Accepted in Issues Board Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants