Skip to content

Commit

Permalink
fixes compiler error, fixes timeout while shutting down execution ser…
Browse files Browse the repository at this point in the history
…vice
  • Loading branch information
ArquintL committed May 20, 2021
1 parent 12ec4ec commit 35bfb36
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/main/scala/viper/server/ViperServerRunner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ object ViperServerRunner {
var viperServerHttp: ViperHttpServer = _

def main(args: Array[String]): Unit = {
val config = new ViperConfig(args)
val config = new ViperConfig(args.toIndexedSeq)
val executor = new DefaultVerificationExecutionContext(threadPoolSize = Some(config.nThreads()))
if (config.serverMode() == config.SERVER_MODE_LSP) {
runLspServer(config)(executor)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class DefaultVerificationExecutionContext(actorSystemName: String = "Actor_Syste
protected lazy val nThreads: Int = threadPoolSize.getOrElse(
Math.max(DefaultVerificationExecutionContext.minNumberOfThreads, Runtime.getRuntime.availableProcessors()))
protected lazy val threadStackSize: Long = 128L * 1024L * 1024L // 128M seems to consistently be recommended by Silicon and Carbon
override def executorService: ExecutorService = Executors.newFixedThreadPool(
private lazy val service: ExecutorService = Executors.newFixedThreadPool(
nThreads, new ThreadFactory {

import java.util.concurrent.atomic.AtomicInteger
Expand All @@ -60,6 +60,7 @@ class DefaultVerificationExecutionContext(actorSystemName: String = "Actor_Syste
new Thread(null, runnable, threadName, threadStackSize)
}
})
override def executorService: ExecutorService = service

private lazy val context: ExecutionContextExecutorService = ExecutionContext.fromExecutorService(executorService)

Expand Down
5 changes: 3 additions & 2 deletions src/test/scala/viper/server/core/CoreServerSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import org.scalatest.exceptions.TestFailedException
import org.scalatest.matchers.should.Matchers
import org.scalatest.{Assertion, Outcome, Succeeded}
import org.scalatest.wordspec.AnyWordSpec
import viper.server.ViperConfig
import viper.server.utility.AstGenerator
import viper.server.vsi.{JobNotFoundException, VerJobId}
import viper.silver.ast.{HasLineColumn, Program}
Expand Down Expand Up @@ -91,8 +92,8 @@ class CoreServerSpec extends AnyWordSpec with Matchers {
val logFile = Paths.get("logs", s"viperserver_journal_${System.currentTimeMillis()}.log").toFile
logFile.getParentFile.mkdirs
logFile.createNewFile()
val server_args: Array[String] = Array("--logLevel", "TRACE", "--logFile", logFile.getAbsolutePath)
val core = new ViperCoreServer(server_args)(verificationContext)
val config = new ViperConfig(Array("--logLevel", "TRACE", "--logFile", logFile.getAbsolutePath))
val core = new ViperCoreServer(config)(verificationContext)
core.start()

val testName = currentTestName match {
Expand Down

0 comments on commit 35bfb36

Please sign in to comment.