Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

akka http client system.shutdown() produce "Outgoing request stream error (akka.stream.AbruptTerminationException)" when using https

Hi the following code works as expected.

implicit val system = ActorSystem()
implicit val materializer = ActorMaterializer()

import system.dispatcher

val request = HttpRequest(uri = "http://www.google.com")

Http.get(system).singleRequest(request).map(_.entity.dataBytes.runWith(Sink.ignore))
  .onComplete { _ =>
    println("shutting down actor system...")
    system.terminate()
  }

However, if I change http://www.google.com to https://www.google.com like the following:

implicit val system = ActorSystem()
implicit val materializer = ActorMaterializer()

import system.dispatcher

val request = HttpRequest(uri = "https://www.google.com")

Http.get(system).singleRequest(request).map(_.entity.dataBytes.runWith(Sink.ignore))
  .onComplete { _ =>
    println("shutting down actor system...")
    system.terminate()
  }

I get the following error message:

shutting down actor system...
[ERROR] [02/11/2017 13:13:08.929] [default-akka.actor.default-dispatcher-4] [akka.actor.ActorSystemImpl(default)] Outgoing request stream error (akka.stream.AbruptTerminationException)

Anyone knows why https produces above error and how can I fix it?

like image 382
Xzer Avatar asked Feb 11 '17 21:02

Xzer


People also ask

Why is my Akka stream/Akka Io connection failing?

If the network level buffers (including the Akka Stream / Akka IO networking stack buffers) contains more data than can be transferred to the client in the given time when the server-side considers to be finished with this connection, the client may encounter a connection reset.

What is delayed restart in Akka streams?

Delayed restarts with a backoff operator Akka streams provides a RestartSource, RestartSink and RestartFlow for implementing the so-called exponential backoff supervision strategy, starting an operator again when it fails or completes, each time with a growing time delay between restarts.

What is keep alive timeout in Akka HTTP?

HTTP connections are commonly used for multiple requests, that is, they are kept alive between requests. The akka.http.host-connection-pool.keep-alive-timeout setting configures how long a pool keeps a connection alive between requests before it closes the connection (and eventually reestablishes it).

What does serviceunavailable mean in Akka HTTP response?

sourceHttpResponse(StatusCodes.ServiceUnavailable, entity = "The server was not able " + "to produce a timely response to your request. Please try again in a short while!") A default request timeout is applied globally to all routes and can be configured using the akka.http.server.request-timeout setting (which defaults to 20 seconds).


1 Answers

It is apparently a known issue, see the following tickets:

  • akka-http#497
  • akka#18747

The error seems harmless.

like image 73
blouerat Avatar answered Oct 26 '22 13:10

blouerat