14

I am using a Scala compilation server. This is probably not related to my IDE IntelliJ IDEA, but I will just inform you that I start the Scala compilation server through a special run configuration in that IDE.

After some time that goes by without compiling anything, the compilation server terminates, without any message. Usually, I only notice this when I try to compile something and compilation fails. Then, I need to start the compilation server again, and of course the next compilation takes a long time, because it's once more the first compilation since starting the compilation server.

How do I turn off that timeout? I looked at the manpage for scalac, and there seems to be no option for it. I can add VM options for that run configuration.

Daniel C. Sobral
  • 295,120
  • 86
  • 501
  • 681
Madoc
  • 5,841
  • 4
  • 25
  • 38
  • I think your problem has to do with the fact that the compiler server doesn't automatically restart itself the next time you need it. Is that correct? – Ken Bloom Dec 13 '10 at 18:39
  • 1
    It would be great if the compilation server would (re-)start automatically when needed. If you know how I can do that, please tell me. However, it would still be better if it wouldn't stop by itself after some time. – Madoc Dec 14 '10 at 08:51
  • 1
    This question should contain the keyword [FSC (Fast Scala Compiler)](http://www.scala-lang.org/docu/files/tools/fsc.html) so that it's easier to Google it out. – Jakub Holý Feb 25 '11 at 08:47
  • 1
    @Jakub Holý: My score at StackOverflow is too low to create a new tag. – Madoc Feb 26 '11 at 09:05

2 Answers2

6

I don't think you can. Here is a code snippet from the compilation server:

object SocketServer
{
  // After 30 idle minutes, politely exit.
  // Should the port file disappear, and the clients
  // therefore unable to contact this server instance,
  // the process will just eventually terminate by itself.
  val IdleTimeout = 1800000
  val BufferSize  = 10240

  def bufferedReader(s: Socket) = new BufferedReader(new InputStreamReader(s.getInputStream()))
  def bufferedOutput(s: Socket) = new BufferedOutputStream(s.getOutputStream, BufferSize)
}

I think you should open a feature request in scala-lang.org

IttayD
  • 28,271
  • 28
  • 124
  • 178
  • Thanks. A hardcoded timeout that cannot be overridden, hmm. Not really best practice. I will open a feature request. – Madoc Dec 14 '10 at 08:53
  • 2
    The [timeout will be configurable](http://alarmingdevelopment.org/?p=562#comment-58925) in the next version of FSC as mentioned in a blog comment. – Jakub Holý Feb 25 '11 at 08:45
6

Pass -max-idle 0 as parameter. It will work on a very (very!) recent nightly, and it should be available on Scala 2.9.0 when it comes out. However, there's no guarantee the name won't change until then.

Daniel C. Sobral
  • 295,120
  • 86
  • 501
  • 681