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

Invalid Sharing of AST nodes in EpbContext #5087

Closed
2 tasks
wdanilo opened this issue Feb 5, 2023 · 6 comments · Fixed by #7882
Closed
2 tasks

Invalid Sharing of AST nodes in EpbContext #5087

wdanilo opened this issue Feb 5, 2023 · 6 comments · Fixed by #7882
Assignees
Labels
--bug Type: bug -compiler p-low Low priority

Comments

@wdanilo
Copy link
Member

wdanilo commented Feb 5, 2023

This task is automatically imported from the old Task Issue Board and it was originally created by jaroslavtulach.
Original issue is here.


#183546453 enabled asserts in engine unit tests, but not in runtime-with-polyglot project. There is invalid sharing of AST nodes AssertionError which requires deeper investigation.

at com.oracle.truffle.polyglot.PolyglotSharingLayer.invalidSharingError(PolyglotSharingLayer.java:649)
at com.oracle.truffle.polyglot.PolyglotFastThreadLocals.validSharing(PolyglotFastThreadLocals.java:266)
at com.oracle.truffle.polyglot.PolyglotFastThreadLocals.getLanguageContext(PolyglotFastThreadLocals.java:236)
at com.oracle.truffle.polyglot.PolyglotFastThreadLocals$ContextReferenceImpl.get(PolyglotFastThreadLocals.java:457)
at org.enso.interpreter.epb.EpbContext.get(EpbContext.java:57)
at org.enso.interpreter.epb.node.ForeignEvalNode.getEpbContext(ForeignEvalNode.java:186)
at org.enso.interpreter.epb.node.ForeignEvalNode.parseJs(ForeignEvalNode.java:118)

This failure is caused by upgrading to GraalVM 22.2 and newer. GraalVM 22.2 introduced concept of "sharing layers" - that concept wasn't existing when EpbContext was created. Hence the new assertion error. Moreover the concept of "sharing layers" probably replaces all the work done in EpbLanguage - possibly the code isn't needed anymore.

Tasks:

  • Change the existing code to avoid the asserts
  • Investigate if we can replace Epb by "sharing layers" and if so, plan that work

Blockers:

#183546453 resolved

@Akirathan
Copy link
Member

Reproduce with

Json.parse "{'name': 'John Smith'}"

AssertionError:

Execution finished with an error: java.lang.AssertionError: Invalid sharing of AST nodes detected. The current context uses a different sharing layer than the executed node. A common cause of this are CallTargets that are reused across different contexts in an invalid way.Stack trace: 
  <<current-context>>
    <-- Sharing Layer Change: 0x1C135F63 => 0x63C4D16 -->
  <epb>.(Unknown)(ForeignEvalNode@29bd2796)
  <epb>.(Unknown)
  <enso>.Json.json_parse(Json.enso:294)
  <enso>.Json.parse<arg-1>(Json.enso:48)
  <enso>.Panic.catch(Unknown)
  <enso>.Json.parse(Json.enso:47)
  <enso>.<eval>(Unknown)
  <enso>.Debug.breakpoint(Unknown)
  <enso>.Internal_Repl_Module___.internal_repl_entry_point___(Internal_Repl_Module___:4)
  <Unknown>.org.graalvm.polyglot.Value<Function>.execute(Unknown)
        at <java> org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotSharingLayer.invalidSharingError(PolyglotSharingLayer.java:672)
        at <java> org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotFastThreadLocals.validSharing(PolyglotFastThreadLocals.java:300)
        at <java> org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotFastThreadLocals.getLanguageContext(PolyglotFastThreadLocals.java:270)
        at <java> org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotFastThreadLocals$ContextReferenceImpl.get(PolyglotFastThreadLocals.java:495)
        at <java> org.enso.interpreter.epb.EpbContext.get(EpbContext.java:106)
        at <java> org.enso.interpreter.epb.node.ForeignEvalNode.parseJs(ForeignEvalNode.java:117)
        at <java> org.enso.interpreter.epb.node.ForeignEvalNode.lockAndParse(ForeignEvalNode.java:82)
        at <java> org.enso.interpreter.epb.node.ForeignEvalNode.ensureParsed(ForeignEvalNode.java:63)
        at <java> org.enso.interpreter.epb.node.ForeignEvalNode.execute(ForeignEvalNode.java:52)
        at <epb> <epb> null(Unknown)
        at <enso> Json.json_parse(/home/pavel/dev/enso/built-distribution/enso-engine-0.0.0-dev-linux-amd64/enso-0.0.0-dev/lib/Standard/Base/0.0.0-dev/src/Data/Json.enso:294-295)
        at <enso> Json.parse<arg-1>(/home/pavel/dev/enso/built-distribution/enso-engine-0.0.0-dev-linux-amd64/enso-0.0.0-dev/lib/Standard/Base/0.0.0-dev/src/Data/Json.enso:48:22-36)
        at <enso> Panic.catch(Internal)
        at <enso> Json.parse(/home/pavel/dev/enso/built-distribution/enso-engine-0.0.0-dev-linux-amd64/enso-0.0.0-dev/lib/Standard/Base/0.0.0-dev/src/Data/Json.enso:47-49)
        at <enso> <eval>(Internal)
        at <enso> Debug.breakpoint(Internal)
        at <enso> Internal_Repl_Module___.internal_repl_entry_point___(Internal_Repl_Module___:4:32-47)

@enso-bot
Copy link

enso-bot bot commented Dec 13, 2023

Jaroslav Tulach reports a new STANDUP for yesterday (2023-12-12):

Progress: - JavaScript layer sharing & EpbValue: #7882

Next Day: Working on EPB language, meetings

Discord
Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.

@enso-bot
Copy link

enso-bot bot commented Dec 14, 2023

Jaroslav Tulach reports a new STANDUP for yesterday (2023-12-13):

Progress: - Using OtherTruffleContextObject properly: cc8df8b

Next Day: Working on EPB language

@enso-bot
Copy link

enso-bot bot commented Dec 15, 2023

Jaroslav Tulach reports a new STANDUP for yesterday (2023-12-14):

Progress: - fixing & polishing: 78d603b It should be finished by 2023-12-18.

Next Day: Integrate EPB language

@enso-bot
Copy link

enso-bot bot commented Dec 16, 2023

Jaroslav Tulach reports a new STANDUP for yesterday (2023-12-15):

Progress: - merged #7882

Next Day: Bugfix more

Discord
Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.

@enso-bot
Copy link

enso-bot bot commented Dec 18, 2023

Jaroslav Tulach reports a new STANDUP for yesterday (2023-12-17):

Progress: - investigating UnsupportedSpecialization: #8552

  • Eliminate EconomicMap from WithWarnings? It should be finished by 2023-12-18.

Next Day: Bugfix more

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
--bug Type: bug -compiler p-low Low priority
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants