Skip to content

Processor actor terminated abruptly on HTTPs connections (akka 2.4.12, akka-http 2.4.11) #497

@samidalouche

Description

@samidalouche

I posted on akka-user, but since I believe it might be a bug, I am opening an issue for that.

The problem seems to be that when performing HTTPS queries using a connection pool, shutting down the actor system raises the following error:

ERROR akka.actor.ActorSystemImpl - Outgoing request stream error
akka.stream.AbruptTerminationException: Processor actor [Actor[akka://default/user/StreamSupervisor-1/flow-0-0-unknown-operation#-901476425]] terminated abruptly

An example of simple code that reproduces the problem (replace the https prefix by http in the uri field to make the problem disappear)

object HttpsWithConnectionPoolIssue extends App {

  implicit val system = ActorSystem()
  implicit val materializer = ActorMaterializer()
  implicit val timeout = Timeout(10.seconds)
  import system.dispatcher

  val request = HttpRequest(
    uri = "https://httpstatuses.com/200"
  )

  val future = Http(system)
    .singleRequest(request)
    .map(_.discardEntityBytes())

  val systemTerminatedFuture = future.flatMap { _ =>
    Http().shutdownAllConnectionPools().flatMap { _ =>
      materializer.shutdown()
      system.terminate()
    }
  }

  Await.result(systemTerminatedFuture, Duration.Inf)
}

An example of code that does not exhibit the problem (no connection pool)

object HTTPsConnectionNotExhibitingProblem extends App {

  implicit val system = ActorSystem()
  implicit val materializer = ActorMaterializer()
  implicit val timeout = Timeout(10.seconds)
  import system.dispatcher

  val request = HttpRequest(
    uri = "/200"
  )

  val flow = Http(system).outgoingConnectionHttps("httpstatuses.com")

  val source = Source.single(request)
    .via(flow)
    .map(_.discardEntityBytes())

  val sourceProcessed = source.runWith(Sink.ignore)

  val systemTerminatedFuture = sourceProcessed.flatMap { _ =>
    Http().shutdownAllConnectionPools().flatMap { _ =>
      materializer.shutdown()
      system.terminate()
    }
  }

  Await.result(systemTerminatedFuture, Duration.Inf)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    1 - triagedTickets that are safe to pick up for contributing in terms of likeliness of being acceptedbugt:coreIssues related to the akka-http-core modulet:stream

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions