How do I turn off the Scala Fast Compilation server's (FSC) timeout?
Asked Answered
G

2

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.

Grater answered 13/12, 2010 at 7:1 Comment(4)
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?Typesetter
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.Grater
This question should contain the keyword FSC (Fast Scala Compiler) so that it's easier to Google it out.Voltmer
@Jakub Holý: My score at StackOverflow is too low to create a new tag.Grater
F
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.

Fluoride answered 21/3, 2011 at 15:3 Comment(0)
A
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

Accept answered 13/12, 2010 at 14:37 Comment(2)
Thanks. A hardcoded timeout that cannot be overridden, hmm. Not really best practice. I will open a feature request.Grater
The timeout will be configurable in the next version of FSC as mentioned in a blog comment.Voltmer
F
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.

Fluoride answered 21/3, 2011 at 15:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.