- 
                Notifications
    You must be signed in to change notification settings 
- Fork 149
Closed
Labels
BloopIssues tied with Bloop integration.Issues tied with Bloop integration.bugSomething isn't workingSomething isn't workingscriptingIssues tied to *.sc script inputs.Issues tied to *.sc script inputs.
Milestone
Description
Version(s)
1.0.0-RC1 and 0.2.1, under both Linux and Mac OS X
Describe the bug
When spawning more than one scala-cli process in parallel, some of the processes fail with:
Error: java.lang.ArrayIndexOutOfBoundsException: Index 6 out of bounds for length 0
To Reproduce
Given any scala-cli script, e.g:
$ cat printargs.sc
println(args.mkString(" "))
And the following bash script which spawns the first process in the background:
$ cat run
#!/usr/bin/env bash
scala-cli printargs.sc -- First run in background &
scala-cli printargs.sc -- Second run in parallel
It frequently exits with the following error:
$ ./run
Deduplicating compilation of project_103be31561-9b85cc8ba0 from bsp client 'scala-cli 1.0.0-RC1' (since 0.071s)
Error: java.lang.ArrayIndexOutOfBoundsException: Index 6 out of bounds for length 0
For more details, please see '/home/andreas/tmp/scala-cli/.scala-build/stacktraces/1681305420-14395538719813530497.log'
The error is more likely to occur if you spawn more background processes.
Full stack trace:
java.lang.ArrayIndexOutOfBoundsException: Index 6 out of bounds for length 0
  org.objectweb.asm.ClassReader.readShort(ClassReader.java:3608)
  org.objectweb.asm.ClassReader.<init>(ClassReader.java:197)
  org.objectweb.asm.ClassReader.<init>(ClassReader.java:180)
  org.objectweb.asm.ClassReader.<init>(ClassReader.java:166)
  org.objectweb.asm.ClassReader.<init>(ClassReader.java:287)
  scala.build.postprocessing.AsmPositionUpdater$.postProcess$$anonfun$3(AsmPositionUpdater.scala:59)
  scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
  scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
  scala.collection.IterableOnceOps.foreach(IterableOnce.scala:575)
  scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:573)
  scala.collection.AbstractIterator.foreach(Iterator.scala:1300)
  scala.build.postprocessing.AsmPositionUpdater$.postProcess(AsmPositionUpdater.scala:70)
  scala.build.postprocessing.ByteCodePostProcessor$.postProcess(ByteCodePostProcessor.scala:15)
  scala.build.Build$.$anonfun$63(Build.scala:1139)
  scala.collection.immutable.List.flatMap(List.scala:293)
  scala.collection.immutable.List.flatMap(List.scala:79)
  scala.build.Build$.postProcess(Build.scala:1140)
  scala.build.Build$.doPostProcess$1$$anonfun$2(Build.scala:252)
  scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
  scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
  scala.Option.foreach(Option.scala:437)
  scala.build.Build$.doPostProcess$1(Build.scala:253)
  scala.build.Build$.doBuild$1$$anonfun$1(Build.scala:362)
  scala.build.EitherCps$Helper.apply(EitherCps.scala:19)
  scala.build.Build$.doBuild$1(Build.scala:369)
  scala.build.Build$.buildScopes$1$$anonfun$1(Build.scala:373)
  scala.build.EitherCps$Helper.apply(EitherCps.scala:19)
  scala.build.Build$.buildScopes$1(Build.scala:400)
  scala.build.Build$.build$$anonfun$1(Build.scala:402)
  scala.build.EitherCps$Helper.apply(EitherCps.scala:19)
  scala.build.Build$.build(Build.scala:414)
  scala.build.Build$.build$$anonfun$3(Build.scala:575)
  scala.build.compiler.ScalaCompilerMaker.withCompiler(ScalaCompilerMaker.scala:31)
  scala.build.compiler.ScalaCompilerMaker.withCompiler$(ScalaCompilerMaker.scala:7)
  scala.build.compiler.BloopCompilerMaker.withCompiler(BloopCompilerMaker.scala:11)
  scala.build.Build$.build(Build.scala:597)
  scala.cli.commands.run.Run$.runCommand(Run.scala:294)
  scala.cli.commands.default.Default.runCommand(Default.scala:69)
  scala.cli.commands.default.Default.runCommand(Default.scala:48)
  scala.cli.commands.ScalaCommand.run(ScalaCommand.scala:365)
  scala.cli.commands.ScalaCommand.run(ScalaCommand.scala:352)
  caseapp.core.app.CaseApp.main(CaseApp.scala:150)
  scala.cli.commands.ScalaCommand.main(ScalaCommand.scala:337)
  caseapp.core.app.CommandsEntryPoint.main(CommandsEntryPoint.scala:120)
  scala.cli.ScalaCliCommands.main(ScalaCliCommands.scala:124)
  scala.cli.ScalaCli$.main0(ScalaCli.scala:203)
  scala.cli.ScalaCli$.main(ScalaCli.scala:107)
  scala.cli.ScalaCli.main(ScalaCli.scala)
Expected behaviour
Multiple concurrent scala-cli processes should reliably and successfully execute independently of other running processes.
Metadata
Metadata
Assignees
Labels
BloopIssues tied with Bloop integration.Issues tied with Bloop integration.bugSomething isn't workingSomething isn't workingscriptingIssues tied to *.sc script inputs.Issues tied to *.sc script inputs.
Type
Projects
Status
Done