Trying consume the response entities before shut down the pool:
        entity.dataBytes.runWith(Sink.ignore).onComplete({data=>
          Http().shutdownAllConnectionPools().onComplete { _ ⇒
            System.out.println("connection pool closed")
          }
        })


On Fri, Jul 29, 2016 at 2:35 AM, Alexander Koshelev <koshele...@gmail.com>
wrote:

> Hi Johan,
>>
>
> It seems this issue can be reproduced even if
> Http.shutdownAllConnectionPools() is called before termination.
> Akka version: 2.4.8
>
> object Main extends App {
>
>
>   val uri = "https://jsonplaceholder.typicode.com/posts";
>   val request = HttpRequest(
>     method = GET,
>     uri = Uri(uri)
>   )
>   implicit val system = ActorSystem("test")
>   implicit val materializer = ActorMaterializer()
>   // needed for the future flatMap/onComplete in the end
>   implicit val executionContext = system.dispatcher
>
>
>   Http()
>     .singleRequest(request)
>     .onSuccess({
>       case HttpResponse(StatusCodes.OK, headers, entity, _) ⇒
>         System.out.println("OK Response received")
>         Http().shutdownAllConnectionPools().onComplete { _ ⇒
>           System.out.println("connection pool closed")
>           system.terminate()
>         }
>     })
> }
>
>
> Here is my output:
> [info] Loading project definition from D:\sbt-test\project
> [info] Set current project to akka-http-test (in build file:/D:/sbt-test/)
> [info] Headers created for 1 files:
> [info]   D:\sbt-test\src\main\scala\Main.scala
> [info] Formatting 1 Scala source {file:/D:/sbt-test/}sbt-test(compile) ...
> [info] Reformatted 1 Scala source {file:/D:/sbt-test/}sbt-test(compile).
> [info] Compiling 1 Scala source to D:\sbt-test\target\scala-2.11\classes
> ...
> [info] Running Main
> OK Response received
> connection pool closed
> [ERROR] [07/28/2016 11:30:54.724] [test-akka.actor.default-dispatcher-13]
> [akka.actor.ActorSystemImpl(test)] Outgoing request stream error (akka.
> stream.AbruptTerminationException)
> [success] Total time: 5 s, completed Jul 28, 2016 11:30:54 AM
>
> --
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ:
> http://doc.akka.io/docs/akka/current/additional/faq.html
> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to akka-user+unsubscr...@googlegroups.com.
> To post to this group, send email to akka-user@googlegroups.com.
> Visit this group at https://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to