twitter/finagle

Unable to stop CollectClosables thread

Open

#758 geöffnet am 6. Feb. 2019

Auf GitHub ansehen
 (8 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Scala (1.435 Forks)batch import
help wanted

Repository-Metriken

Stars
 (8.864 Stars)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

Hello we are using Finagle as a HttpClient - it works really good. Great job.

Unfortunately Finagle generates resource leak under standard behavior that applications are deployed and undeployed many times on JBoss AS, Tomcat etc. By resource leak I mean that if I 100 times deploy and undeploy an application that uses Finagle I'll get at least 100 threads

The problem is that finagle contains unstopable threads

Var.scala

  def flatMap[U](f: T => Var[U]): Var[U] = new Var[U] {
    def observe(depth: Int, obs: Observer[U]) = {
      val inner = new AtomicReference(Closable.nop)

and this starts

  private val collectorThread = new Thread("CollectClosables") {
    override def run(): Unit = {
      while (true) {
        try {

Contributor Guide