hpi-swa / trufflesqueak

A Squeak/Smalltalk VM and Polyglot Programming Environment for the GraalVM.
MIT License
283 stars 14 forks source link

NullPointerException on notebook restart #135

Closed fniephaus closed 3 years ago

fniephaus commented 3 years ago

Reproducer

  1. Do fresh 21.0.0 stack install
  2. Open TruffleSqueak
  3. Change PolyglotTextStyler>>style:language:

style: aText language: aLanguageID ^ aLanguageID = Polyglot languageIdSmalltalk ifTrue: [ (stStyler ifNil: [ stStyler := SHTextStylerST80 new ]) styledTextFor: aText ] ifFalse: [ aText ]

  1. Type something in a Markdown cell
  2. OK
  3. Save and Quit
  4. Open TruffleSqueak
  5. Type something in a Markdown cell
  6. Crash:

% /Applications/graalvm/graalvm-ce-java11-21.0.0/Contents/Home/languages/smalltalk/bin/trufflesqueak ; exit; [trufflesqueak] Running Squeak/Smalltalk on GraalVM CE... [trufflesqueak] Image loaded in 3148ms. ERROR: java.lang.NullPointerException org.graalvm.polyglot.PolyglotException: java.lang.NullPointerException at java.base/java.util.Objects.requireNonNull(Objects.java:221) at de.hpi.swa.trufflesqueak.nodes.context.frame.FrameStackReadNode.create(FrameStackReadNode.java:44) at de.hpi.swa.trufflesqueak.nodes.bytecodes.PushBytecodes$PushTemporaryLocationNode.executeVoid(PushBytecodes.java:581) at de.hpi.swa.trufflesqueak.nodes.ExecuteBytecodeNode.interpretBytecode(ExecuteBytecodeNode.java:134) at de.hpi.swa.trufflesqueak.nodes.ExecuteBytecodeNode.execute(ExecuteBytecodeNode.java:70) at de.hpi.swa.trufflesqueak.nodes.StartContextRootNode.execute(StartContextRootNode.java:54) at PolyglotTextStyler>>style:language:(Unknown) at PNBCodeCellEditor>>applyStyle(PNBCodeCellEditor>>applyStyle:10:213-242) at MessageSend>>value(MessageSend>>value:14:262-298) at MorphicAlarm>>value:(MorphicAlarm>>value::22:415-433) at [] in WorldState>>triggerAlarmsBefore:([] in WorldState>>triggerAlarmsBefore::3:38-56) at SequenceableCollection>>do:(SequenceableCollection>>do::14:244-263) at WorldState>>triggerAlarmsBefore:(WorldState>>triggerAlarmsBefore::32:733-749) at WorldState>>runLocalStepMethodsIn:(WorldState>>runLocalStepMethodsIn::10:246-280) at WorldState>>runStepMethodsIn:(WorldState>>runStepMethodsIn::33:717-753) at PasteUpMorph>>runStepMethods(PasteUpMorph>>runStepMethods:3:33-63) at WorldState>>doOneCycleNowFor:(WorldState>>doOneCycleNowFor::23:605-633) at CTX WorldState>>doOneCycleFor: @69ba3f4e(WorldState>>doOneCycleFor::12:264-295)

... about 240 lines of error messages.

Originally posted by @jirir in https://github.com/hpi-swa/trufflesqueak/issues/134#issuecomment-771738009

fniephaus commented 3 years ago

I can reproduce the issue. It turns out that the header of new compiled methods are not written correctly for some reason. I didn't hit this with my development image because for some reason, the preferred encoder was set to V3 and not Sista (the image was recompiled with Sista a while ago).

I will deploy a fix tomorrow...