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

REPL locks when started with -i flag #5369

Closed
scabug opened this issue Jan 12, 2012 · 2 comments
Closed

REPL locks when started with -i flag #5369

scabug opened this issue Jan 12, 2012 · 2 comments

Comments

@scabug
Copy link

scabug commented Jan 12, 2012

The scala command line interpreter hangs when given a script to preload. This still works in 2.9.0, but neither in 2.9.1 nor in scala-2.10.0.rdev-4161-2012-01-12-g5f5029d (i used the binaries from http://www.scala-lang.org/downloads), both using MainGenericRunner and the scala executable. The easiest steps to reproduce:

  1. create a file containing: println("Hello World!"), save as script.scala
  2. execute: scala -i script.scala leads to

marty@gamma:~$ scala-2.9.1.final/bin/scala -i script.scala
Loading script.scala...

and locks afterwards.

attaching jdb to my own code (basically a dispatcher for the MainGenericRunner which includes my own code in the jar such that it can be used interactively and which shows the same behaviour) gives the following stacktrace:

main[1] where 1
[1] sun.misc.Unsafe.park (native method)
[2] java.util.concurrent.locks.LockSupport.park (LockSupport.java:186)
[3] java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await (AbstractQueuedSynchronizer.java:2,043)
[4] scala.tools.nsc.interpreter.ILoopInit$$anonfun$awaitInitialized$1.apply$mcV$sp (ILoopInit.scala:96)
[5] scala.tools.nsc.interpreter.ILoopInit$$anonfun$awaitInitialized$1.apply (ILoopInit.scala:96)
[6] scala.tools.nsc.interpreter.ILoopInit$$anonfun$awaitInitialized$1.apply (ILoopInit.scala:96)
[7] scala.tools.nsc.interpreter.ILoopInit$class.scala$tools$nsc$interpreter$ILoopInit$$withLock (ILoopInit.scala:70)
[8] scala.tools.nsc.interpreter.ILoopInit$class.awaitInitialized (ILoopInit.scala:96)
[9] scala.tools.nsc.interpreter.ILoop.awaitInitialized (ILoop.scala:34)
[10] scala.tools.nsc.interpreter.ILoop.processLine$1 (ILoop.scala:538)
[11] scala.tools.nsc.interpreter.ILoop.loop (ILoop.scala:550)
[12] scala.tools.nsc.interpreter.ILoop$$anonfun$interpretAllFrom$1.apply (ILoop.scala:563)
[13] scala.tools.nsc.interpreter.ILoop$$anonfun$interpretAllFrom$1.apply (ILoop.scala:560)
[14] scala.tools.nsc.io.Streamable$Chars$class.applyReader (Streamable.scala:99)
[15] scala.tools.nsc.io.File.applyReader (File.scala:76)
[16] scala.tools.nsc.interpreter.ILoop.interpretAllFrom (ILoop.scala:560)
[17] scala.tools.nsc.interpreter.ILoop$$anonfun$loadCommand$1.apply (ILoop.scala:604)
[18] scala.tools.nsc.interpreter.ILoop$$anonfun$loadCommand$1.apply (ILoop.scala:603)
[19] scala.tools.nsc.interpreter.ILoop.withFile (ILoop.scala:597)
[20] scala.tools.nsc.interpreter.ILoop.loadCommand (ILoop.scala:603)
[21] scala.tools.nsc.interpreter.ILoop$$anonfun$standardCommands$8.apply (ILoop.scala:222)
[22] scala.tools.nsc.interpreter.ILoop$$anonfun$standardCommands$8.apply (ILoop.scala:222)
[23] scala.tools.nsc.interpreter.LoopCommands$LineCmd.apply (LoopCommands.scala:80)
[24] scala.tools.nsc.interpreter.ILoop.command (ILoop.scala:646)
[25] scala.tools.nsc.interpreter.ILoop$$anonfun$loadFiles$1.apply (ILoop.scala:763)
[26] scala.tools.nsc.interpreter.ILoop$$anonfun$loadFiles$1.apply (ILoop.scala:761)
[27] scala.collection.LinearSeqOptimized$class.foreach (LinearSeqOptimized.scala:59)
[28] scala.collection.immutable.List.foreach (List.scala:45)
[29] scala.tools.nsc.interpreter.ILoop.loadFiles (ILoop.scala:761)
[30] scala.tools.nsc.interpreter.ILoop.process (ILoop.scala:802)
[31] scala.tools.nsc.MainGenericRunner.runTarget$1 (MainGenericRunner.scala:67)
[32] scala.tools.nsc.MainGenericRunner.process (MainGenericRunner.scala:80)
[33] scala.tools.nsc.MainGenericRunner$.main (MainGenericRunner.scala:89)
[34] at.logic.cli.CLIMain$.main (CLIMain.scala:50)
[35] at.logic.cli.CLIMain.main (null)

If it is of interest, i can provide the sources of CLIMain, but since the behaviour is the same if it does not contain my own code, this would only complicate matters.
Thanks for looking into the matter, I hope I can be of some help :)

@scabug
Copy link
Author

scabug commented Jan 12, 2012

Imported From: https://issues.scala-lang.org/browse/SI-5369?orig=1
Reporter: Martin (lambda)
Affected Versions: 2.9.1
Duplicates #4945

@scabug
Copy link
Author

scabug commented Jan 12, 2012

@dcsobral said:
I have reproduced this on 2.9.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant