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

Abandon Terminating Language Server #1463

Merged
merged 6 commits into from
Feb 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ class LanguageServerController(
case ServerDied =>
log.error(s"Language server died [$connectionInfo]")
context.stop(self)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This empty line seems unnecessary.

}

private def removeClient(
Expand Down Expand Up @@ -278,8 +279,9 @@ class LanguageServerController(
maybeRequester.foreach(_ ! ServerShutdownTimedOut)
stop()

case StartServer(_, _, _, _) =>
sender() ! PreviousInstanceNotShutDown
case m: StartServer =>
// This instance has not yet been shut down. Retry
context.parent.forward(Retry(m))
}

private def waitingForChildren(): Receive = { case Terminated(_) =>
Expand Down Expand Up @@ -349,18 +351,17 @@ object LanguageServerController {

case object ShutDownServer

/** Signals boot timeout.
*/
/** Signals boot timeout. */
case object BootTimeout

/** Boot command.
*/
/** Boot command. */
case object Boot

/** Signals shutdown timeout.
*/
/** Signals shutdown timeout. */
case object ShutdownTimeout

case object ServerDied

case class Retry(message: Any)

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import org.enso.projectmanager.boot.configuration.{
SupervisionConfig,
TimeoutConfig
}
import org.enso.projectmanager.infrastructure.languageserver.LanguageServerController.Retry
import org.enso.projectmanager.infrastructure.languageserver.LanguageServerProtocol.{
CheckIfServerIsRunning,
KillThemAll,
Expand All @@ -23,6 +24,8 @@ import org.enso.projectmanager.service.LoggingServiceDescriptor
import org.enso.projectmanager.util.UnhandledLogging
import org.enso.projectmanager.versionmanagement.DistributionConfiguration

import scala.concurrent.duration._

/** An actor that routes request regarding lang. server lifecycle to the
* right controller that manages the server.
* It creates a controller actor, if a server doesn't exist.
Expand Down Expand Up @@ -112,6 +115,11 @@ class LanguageServerRegistry(
case CheckIfServerIsRunning(projectId) =>
sender() ! serverControllers.contains(projectId)

case Retry(message) =>
context.system.scheduler.scheduleOnce(200.millis, self, message)(
context.dispatcher,
context.sender()
)
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ import org.enso.runtimeversionmanager.distribution.{
DistributionManager,
TemporaryDirectoryManager
}
import org.enso.runtimeversionmanager.locking.{FileLockManager, ResourceManager}
import org.enso.runtimeversionmanager.locking.{
ResourceManager,
ThreadSafeFileLockManager
}
import org.enso.runtimeversionmanager.releases.ReleaseProvider
import org.enso.runtimeversionmanager.releases.engine.{
EngineRelease,
Expand All @@ -38,7 +41,9 @@ object DefaultDistributionConfiguration
lazy val distributionManager = new DistributionManager(environment)

/** @inheritdoc */
lazy val lockManager = new FileLockManager(distributionManager.paths.locks)
lazy val lockManager = new ThreadSafeFileLockManager(
distributionManager.paths.locks
)

/** @inheritdoc */
lazy val resourceManager = new ResourceManager(lockManager)
Expand Down