enso-org / enso

Hybrid visual and textual functional programming.
https://ensoanalytics.com
Apache License 2.0
7.36k stars 323 forks source link

Polyglot import in an Enso project fails in the GUI with a generic error, when more detailed errors are available if run via CLI. #8811

Open Cassandra-Clark opened 9 months ago

Cassandra-Clark commented 9 months ago

Discord username

Cass

What type of issue is this?

Transient – Occurring only once

Is this issue blocking you from using Enso?

Is this a regression?

What issue are you facing?

Attempting to use polyglot to import from a jar without all dependencies installed causes an unspecified error in the GUI, but more detailed errors exist in the logs.

Expected behaviour

Importing via polyglot works and any errors that occur during execution are surfaced to the user

How we can reproduce it?

  1. Create a new project
  2. Create a polyglot/java folder inside the project structure, and add a jar (in this reproduction, google-analytics-data-0.44.0.jar)
  3. Open code and enter polyglot import com.google.analytics.data.v1beta.BetaAnalyticsDataClient
  4. "Execution failed. Please try restarting" error exists
  5. Run project via enso.exe
  6. More detailed errors mentioning import issues are produced

Screenshots or screencasts

image image

Logs

Reproduce polyglot error.txt

Enso Version

enso-win-2024.1.1-nightly.2024.1.4

Browser or standalone distribution

Standalone distribution (local project)

Browser Version or standalone distribution

standalone

Operating System

Windows

Operating System Version

Windows 11

Hardware you are using

No response

somebody1234 commented 9 months ago

Are you able to provide a project download including the polyglot jar (you should be able to right click -> download in the drive view)

Cassandra-Clark commented 9 months ago

Polyglot repro.zip

Included as a zip as .enso-project files aren't supported in GitHub

JaroslavTulach commented 9 months ago

Processing Polyglot repro.zip was a challenge. How do you use that file @Cassandra-Clark? I can:

$ unzip Polyglot repro.zip
$ tar fxvz 'Polyglot repro.enso-project'

and then the project is extracted into current(!) directory. But when I do:

sbt:enso> runEngineDistribution --run /path/to/the/project/dir
[WARN] [2024-01-22T07:29:05+01:00] [org.enso.editions.updater.EditionUpdater] Failed to fetch editions from [http://localhost:1273/editions/]: {}
com.typesafe.config.ConfigException$Missing: merge of String: 1,reference.conf @ jar:file:///home/devel/NetBeansProjects/enso/enso/built-distribution/enso-engine-0.0.0-dev-linux-amd64/enso-0.0.0-dev/bin/../component/runtime.jar!/reference.conf: 11,version.conf @ jar:file:///home/devel/NetBeansProjects/enso/enso/built-distribution/enso-engine-0.0.0-dev-linux-amd64/enso-0.0.0-dev/bin/../component/runtime.jar!/version.conf: 1: No configuration setting found for key 'akka.http'
        at org.enso.runtime/com.typesafe.config.impl.SimpleConfig.findKeyOrNull(SimpleConfig.java:157)
        at org.enso.runtime/com.typesafe.config.impl.SimpleConfig.findOrNull(SimpleConfig.java:175)
        at org.enso.runtime/com.typesafe.config.impl.SimpleConfig.findOrNull(SimpleConfig.java:181)

Caused by: org.graalvm.polyglot.PolyglotException: org.enso.editions.EditionResolutionError$CannotLoadEdition: Cannot load edition [2024.1.1-nightly.2024.1.4]: The edition was not found.
        at org.enso.runtime/org.enso.editions.EditionResolver.$anonfun$resolveParent$1(EditionResolver.scala:157)
        at org.enso.runtime/scala.util.Either$LeftProjection.map(Either.scala:614)
        at org.enso.runtime/org.enso.editions.EditionResolver.resolveParent(EditionResolver.scala:157)
        at org.enso.runtime/org.enso.editions.EditionResolver.resolveEdition(EditionResolver.scala:39)
        at org.enso.runtime/org.enso.editions.EditionResolver.resolve(EditionResolver.scala:29)
        at org.enso.runtime/org.enso.editions.updater.EditionManager.resolveEdition(EditionManager.scala:26)
        at org.enso.runtime/org.enso.interpreter.runtime.DefaultPackageRepository$.initializeRepository(DefaultPackageRepository.scala:652)
        at org.enso.runtime/org.enso.interpreter.runtime.DefaultPackageRepository.initializeRepository(DefaultPackageRepository.scala)
        at org.enso.runtime/org.enso.interpreter.runtime.EnsoContext.initialize(EnsoContext.java:183)```

removing edition: definition in package.yaml fixes my problem. However, that shall not be the case, right @hubertp? We are supposed to not download any editions. Looks like there is a lot of work done by EditionManager which shall be avoided! Possibly related to #8692

hubertp commented 9 months ago

The full list of transitive dependencies can be easily inferred using sbt's underlying resolver, coursier:

>cs resolve com.google.analytics:google-analytics-data:0.44.0
https://repo1.maven.org/maven2/com/google/analytics/google-analytics-data/0.44.0/google-analytics-data-0.44.0.pom
  100.0% [##########] 38.5 KiB (128.7 KiB / s)
https://repo1.maven.org/maven2/com/google/api/gax-httpjson/2.39.0/gax-httpjson-2.39.0.pom
  100.0% [##########] 3.5 KiB (59.9 KiB / s)
...
com.google.analytics:google-analytics-data:0.44.0:default
com.google.android:annotations:4.1.1.4:default
com.google.api:api-common:2.22.0:default
com.google.api:gax:2.39.0:default
com.google.api:gax-grpc:2.39.0:default
com.google.api:gax-httpjson:2.39.0:default
com.google.api.grpc:proto-google-analytics-data-v1alpha:0.44.0:default
com.google.api.grpc:proto-google-analytics-data-v1beta:0.44.0:default
com.google.api.grpc:proto-google-common-protos:2.30.0:default
com.google.auth:google-auth-library-credentials:1.21.0:default
com.google.auth:google-auth-library-oauth2-http:1.21.0:default
com.google.auto.value:auto-value-annotations:1.10.4:default
com.google.code.findbugs:jsr305:3.0.2:default
com.google.code.gson:gson:2.10.1:default
com.google.errorprone:error_prone_annotations:2.23.0:default
com.google.guava:failureaccess:1.0.1:default
com.google.guava:guava:32.1.3-jre:default
com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava:default
com.google.http-client:google-http-client:1.43.3:default
com.google.http-client:google-http-client-gson:1.43.3:default
com.google.j2objc:j2objc-annotations:2.8:default
com.google.protobuf:protobuf-java:3.25.1:default
com.google.protobuf:protobuf-java-util:3.25.1:default
com.google.re2j:re2j:1.7:default
commons-codec:commons-codec:1.16.0:default
commons-logging:commons-logging:1.2:default
io.grpc:grpc-alts:1.60.0:default
io.grpc:grpc-api:1.60.0:default
io.grpc:grpc-auth:1.60.0:default
io.grpc:grpc-context:1.60.0:default
io.grpc:grpc-core:1.60.0:default
io.grpc:grpc-googleapis:1.60.0:default
io.grpc:grpc-grpclb:1.60.0:default
io.grpc:grpc-inprocess:1.60.0:default
io.grpc:grpc-netty-shaded:1.60.0:default
io.grpc:grpc-protobuf:1.60.0:default
io.grpc:grpc-protobuf-lite:1.60.0:default
io.grpc:grpc-services:1.60.0:default
io.grpc:grpc-stub:1.60.0:default
io.grpc:grpc-util:1.60.0:default
io.grpc:grpc-xds:1.60.0:default
io.opencensus:opencensus-api:0.31.1:default
io.opencensus:opencensus-contrib-http-util:0.31.1:default
io.opencensus:opencensus-proto:0.2.0:default
io.perfmark:perfmark-api:0.26.0:default
javax.annotation:javax.annotation-api:1.3.2:default
org.apache.httpcomponents:httpclient:4.5.14:default
org.apache.httpcomponents:httpcore:4.4.16:default
org.checkerframework:checker-qual:3.40.0:default
org.codehaus.mojo:animal-sniffer-annotations:1.23:default
org.conscrypt:conscrypt-openjdk-uber:2.5.2:default
org.threeten:threetenbp:1.6.8:default
JaroslavTulach commented 8 months ago

Tutorial has been written

to make it simple(r) to download necessary libraries next time.