scalacenter/scastie

Rerun code produces a different result (from cache?)

devlaam opened this issue · 1 comments

Describe the bug

A piece of code which is run for the first time produces the correct result. After a second run (with or without minor changes) only a partial result is presented.

Scastie snippet link

https://scastie.scala-lang.org/0Hq775PDQ9OPpmjpmUwVJw

To Reproduce

  1. Compare https://scastie.scala-lang.org/0Hq775PDQ9OPpmjpmUwVJw with https://scastie.scala-lang.org/98m8172hTW60djK9j65hdw, which are runs on exactly the same code.
  2. Mark the (cached) output (which is correct):
Actor Test started.
Received: Hello World!.
Demo Complete.
  1. Click on 'Run' (maybe twice, if the cache has been deleted in the mean time), get the output:
Actor Test started.
Demo Complete.
  1. One line of output is missing.
  2. The Scastie cache links themselves seem constant, so this is not the source of the trouble.

Expected behavior

Equal results in equal circumstances, first run:
First Run (Correct)

It looks like the second run:
Second Run (Incorrect)
is relying on some cached output, but misses one output stream. The application seems not to be complete restarted?

As long as the logs below are displayed, the results are correct:

[info] welcome to sbt 1.8.2 (Alpine Java 17.0.6)
[info] loading settings for project scastie4824172637242059690-build from plugins.sbt ...
[info] loading settings for project scastie4824172637242059690 from build.sbt ...

When not, it is incorrect, and the runtime is also to low for a correct result to be generated.

Screenshot ( Optional )

No response

Version

Scastie website

What browsers are you seeing the problem on?

Safari

Relevant log output

No response

I quickly took a look at this issue, the problem is in our SBT plugin which is added to every Scastie snippet. I'll investigate it further in a near future.