Re: [akka-user] Monitoring Akka Streaming

2016-03-10 Thread Richard Rodseth
You can also use alsoTo to send stream elements to an actor or special
purpose Sink.

On Thu, Mar 10, 2016 at 10:49 AM, Filippo De Luca 
wrote:

> Hi,
> I suppose you can use map and call a external service for each message at
> defined stage.
>
> Even better you can build your own stage.
>
> On 10 March 2016 at 17:28, Arun Sethia  wrote:
>
>> Hi,
>>
>> I have a requirement where we would like to know how many incoming
>> messages are processed by flow. We can use Materializer with AtomicLong
>> with Flow to do the same.
>>
>> Any other alternative or in-built functionality in akka-stream API?
>>
>> Thanks
>> Arun
>>
>> --
>> >> 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.
>>
>
>
>
> --
>
>
> [image: --]
> Filippo De Luca
> [image: http://]about.me/FilippoDeLuca
> 
>
>
> --
> >> 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.


[akka-user] Shutdown HttpServer

2016-03-10 Thread Richard Rodseth
I'm working on a command-line tool which will expose a REST API while it is
running, but should terminate. I see that ServerBinding has an unbind()
method. Am I correct that one would put the code below in a message handler
of an actor, and pipe the result to an actor var, perhaps as an Option.
Then implement a stop message that calls unbind() ?

val bindingFuture: Future[Http.ServerBinding] =

  serverSource.to(Sink.foreach { connection =>

println("Accepted new connection from " + connection.remoteAddress)



connection handleWithSyncHandler requestHandler

// this is equivalent to

// connection handleWith { Flow[HttpRequest] map requestHandler }

  }).run()

-- 
>>  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.


Re: [akka-user] Re: Http Client with Source.tick

2016-03-10 Thread Viktor Klang
Cool, happy hAkking!

-- 
Cheers,
√
On Mar 11, 2016 12:11 AM, "Arun Sethia"  wrote:

> Super ... you guys are awesome ... more I am learning, it is becoming more
> and more interesting.
>
> I used recover, It worked well. Thanks a lot.
>
>
> On Thursday, March 10, 2016 at 4:52:30 PM UTC-6, √ wrote:
>>
>>
>> http://doc.akka.io/api/akka/2.4.2/?_ga=1.176202021.1085570125.1455222020#akka.stream.scaladsl.FlowOps
>>
>> --
>> Cheers,
>> √
>> On Mar 10, 2016 11:43 PM, "Arun Sethia"  wrote:
>>
>>> Thanks.
>>>
>>> please can you provide the link where I can see how to deal with such
>>> errors.
>>>
>>> On Thursday, March 10, 2016 at 4:22:35 PM UTC-6, √ wrote:

 For each only deals with elements, not errors.
 Please consult the documentation for combinators that let you observe
 and manipulate errors.

 --
 Cheers,
 √
 On Mar 10, 2016 11:04 PM, "Arun Sethia"  wrote:

> httpSourceGraph1 is httpSourceGraph , but still same issue
>
>
> val response= httpSourceGraph.via(httpConnFlow()).runForeach(println)
>
>
> we can test same with any external internet URL also, the result remain 
> same.
>
>
> On Thursday, March 10, 2016 at 3:55:22 PM UTC-6, Arun Sethia wrote:
>>
>> Hi,
>>
>> I am trying to connect http client to a http service exposed by
>> server, the source should send request every 1 second for that I have
>> crated following partial graphs:
>>
>>
>> def httpSourceGraph() = {
>>   Source.fromGraph(GraphDSL.create() { implicit builder =>
>> val sourceOutLet = builder.add(Source.tick(FiniteDuration(0, 
>> TimeUnit.SECONDS), FiniteDuration(1,
>>   TimeUnit.SECONDS),
>>   HttpRequest(uri ="/test", method = HttpMethods.GET))).out
>> // expose outlet
>> SourceShape(sourceOutLet)
>>   })
>> }
>>
>>
>> def httpConnFlow() = {
>>   Flow.fromGraph(GraphDSL.create() { implicit builder =>
>>
>> val httpSourceFlow = 
>> builder.add(Http(system).outgoingConnection(host = "localhost", port = 
>> 8080))
>>
>> FlowShape(httpSourceFlow.in, httpSourceFlow.out)
>>   })
>> }
>>
>>
>> the graph is composed as
>>
>>
>> val response= httpSourceGraph1.via(httpConnFlow()).runForeach(println)
>>
>>
>> if the http server (localhost:8080/test) is up and running, everything 
>> works fine, every 1 second I can see the response coming back from the 
>> server. I am not able to any response in case of  either server is down 
>> or it goes down later.
>>
>>
>> *I think it should give me following error:*
>>
>>
>> akka.stream.StreamTcpException: Tcp command 
>> [Connect(localhost/127.0.0.1:8080,None,List(),Some(10 seconds),true)] 
>> failed
>>
>>
>> Thanks for the help.
>>
>> -Arun
>>
>>
>>
>>
>> --
> >> 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+...@googlegroups.com.
> To post to this group, send email to akka...@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+...@googlegroups.com.
>>> To post to this group, send email to akka...@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.
>

-- 
>>  Read the do

Re: [akka-user] Re: Http Client with Source.tick

2016-03-10 Thread Arun Sethia
Super ... you guys are awesome ... more I am learning, it is becoming more 
and more interesting.

I used recover, It worked well. Thanks a lot.


On Thursday, March 10, 2016 at 4:52:30 PM UTC-6, √ wrote:
>
>
> http://doc.akka.io/api/akka/2.4.2/?_ga=1.176202021.1085570125.1455222020#akka.stream.scaladsl.FlowOps
>
> -- 
> Cheers,
> √
> On Mar 10, 2016 11:43 PM, "Arun Sethia" > 
> wrote:
>
>> Thanks.
>>
>> please can you provide the link where I can see how to deal with such 
>> errors.
>>
>> On Thursday, March 10, 2016 at 4:22:35 PM UTC-6, √ wrote:
>>>
>>> For each only deals with elements, not errors.
>>> Please consult the documentation for combinators that let you observe 
>>> and manipulate errors.
>>>
>>> -- 
>>> Cheers,
>>> √
>>> On Mar 10, 2016 11:04 PM, "Arun Sethia"  wrote:
>>>
 httpSourceGraph1 is httpSourceGraph , but still same issue 


 val response= httpSourceGraph.via(httpConnFlow()).runForeach(println)


 we can test same with any external internet URL also, the result remain 
 same. 


 On Thursday, March 10, 2016 at 3:55:22 PM UTC-6, Arun Sethia wrote:
>
> Hi,
>
> I am trying to connect http client to a http service exposed by 
> server, the source should send request every 1 second for that I have 
> crated following partial graphs:
>
>
> def httpSourceGraph() = {
>   Source.fromGraph(GraphDSL.create() { implicit builder =>
> val sourceOutLet = builder.add(Source.tick(FiniteDuration(0, 
> TimeUnit.SECONDS), FiniteDuration(1,
>   TimeUnit.SECONDS),
>   HttpRequest(uri ="/test", method = HttpMethods.GET))).out
> // expose outlet
> SourceShape(sourceOutLet)
>   })
> }
>
>
> def httpConnFlow() = {
>   Flow.fromGraph(GraphDSL.create() { implicit builder =>
>
> val httpSourceFlow = builder.add(Http(system).outgoingConnection(host 
> = "localhost", port = 8080))
>
> FlowShape(httpSourceFlow.in, httpSourceFlow.out)
>   })
> }
>
>
> the graph is composed as
>
>
> val response= httpSourceGraph1.via(httpConnFlow()).runForeach(println)
>
>
> if the http server (localhost:8080/test) is up and running, everything 
> works fine, every 1 second I can see the response coming back from the 
> server. I am not able to any response in case of  either server is down 
> or it goes down later.
>
>
> *I think it should give me following error:*
>
>
> akka.stream.StreamTcpException: Tcp command 
> [Connect(localhost/127.0.0.1:8080,None,List(),Some(10 seconds),true)] 
> failed
>
>
> Thanks for the help.
>
> -Arun
>
>
>
>
> -- 
 >> 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+...@googlegroups.com.
 To post to this group, send email to akka...@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+...@googlegroups.com .
>> To post to this group, send email to akka...@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.


[akka-user] Re: [akka-http-2.4.2] connection timeouts under load

2016-03-10 Thread Giovanni Alberto Caporaletti
I get this in my tests if i enable logging:

[DEBUG] [03/10/2016 23:43:36.674] 
[default-akka.actor.default-dispatcher-10] 
[akka://default/system/IO-TCP/selectors/$a/0] Unbinding endpoint 
/127.0.0.1:1234
[DEBUG] [03/10/2016 23:43:36.677] 
[default-akka.actor.default-dispatcher-10] 
[akka://default/system/IO-TCP/selectors/$a/0] Unbound endpoint 
/127.0.0.1:1234, stopping listener


On Thursday, 10 March 2016 18:48:56 UTC+1, Brian wrote:
>
> I'm seeing (what looks to be) the same issue under load test, where 
> connection timeouts cause the application to become non-responsive to http 
> requests.  I also eventually get an OOM due to GC overhead limit exceeded, 
> although that may be a symptom of a cascading failure.  Load test runs 
> without connection timeouts are clean, but as soon as I start to see 
> timeouts, it's crash and burn.  Similar to Giovanni's case with Finch 
> above, when the same business layer is used behind liftweb, there are no 
> such issues.
>
> Thread dumps show a lot of busy threads in deep stacks, but not much 
> obvious in the akka-http layer.  It is interesting that during lock-up I 
> need to use the -F option with jstack to even get a thread dump.
>
> I do have logback configured, so hopefully can add a bit more information 
> around the issue.  Some of the interesting error messages that happen as 
> things are going south include:
>
> // Several of these indicates issue is imminent
> ERROR a.a.RepointableActorRef - Error in stage [recover]: No elements 
> passed in the last 1 minute.
> akka.http.impl.engine.HttpConnectionTimeoutException: No elements passed 
> in the last 1 minute.
>
> // Not sure if this is Metallica related, only one set of these seen
> ERROR a.a.ActorSystemImpl - exception on LARS’ timer thread
>
> INFO  a.a.ActorSystemImpl - starting new LARS thread
>
> // These tend to be the last errors to happen before JVM crash, and there 
> are many:
>
> ERROR a.a.RepointableActorRef - Error in stage [akka.http.impl.engine.
> server.HttpServerBluePrint$RequestTimeoutSupport@xxx]: requirement 
> failed: Cannot push port (responseOut) twice
>
>
> Hope this helps, i'll keep an eye on #19996.
>
> On Thursday, March 10, 2016 at 9:44:44 AM UTC-5, Kyrylo Stokoz wrote:
>>
>> I think i have related issue but on client side (i.e making request using 
>> akka http) and issue with reproducer is: 
>> https://github.com/akka/akka/issues/19953
>>
>> On Thursday, March 10, 2016 at 3:27:04 AM UTC-6, Giovanni Alberto 
>> Caporaletti wrote:
>>>
>>> I opened an issue with a simple reproducer: 
>>> https://github.com/akka/akka/issues/19996
>>>
>>>
>>>
>>>
>>> On Thursday, 10 March 2016 10:21:26 UTC+1, lisp pm wrote:

 My use case is similar to yours. After downgrading from 2.4.2 to 2.0.3, 
 the error has gone and everything seems working fine.


 On Saturday, March 5, 2016 at 8:25:25 AM UTC-5, Kyrylo Stokoz wrote:
>
> Hi,
>
> I have similar observations after a while server keep accepting 
> requests but they all timeout and nothing gets returned in response.
> I`m using akka http 2.4.2 and streams to create a simple server which 
> handle requests and return files from S3.
>
> In my case i don`t need to do even high load, doing request one after 
> another is enough to hang the server. I played with max connections 
> parameter and increasing it makes app process more requests but 
> eventually 
> it stuck anyway.
>
> From my observation issue is in http connections pool that are not 
> properly releasing connections and when new request comes in runnable 
> graph 
> is created but sinks and sources are not properly connected to start the 
> flow.
>
> During my tests i see (not sure this is related though):
>
> ERROR [datastore-rest-api-akka.actor.default-dispatcher-5] - Error in 
> stage [One2OneBidi]: Inner stream finished before inputs completed. 
> Outputs 
> might have been truncated.
> akka.http.impl.util.One2OneBidiFlow$OutputTruncationException$: Inner 
> stream finished before inputs completed. Outputs might have been 
> truncated.
> ERROR [datastore-rest-api-akka.actor.default-dispatcher-5] - Error in 
> stage [One2OneBidi]: Inner stream finished before inputs completed. 
> Outputs 
> might have been truncated.
> akka.http.impl.util.One2OneBidiFlow$OutputTruncationException$: Inner 
> stream finished before inputs completed. Outputs might have been 
> truncated.
> ERROR [datastore-rest-api-akka.actor.default-dispatcher-5] - Error in 
> stage [One2OneBidi]: Inner stream finished before inputs completed. 
> Outputs 
> might have been truncated.
> akka.http.impl.util.One2OneBidiFlow$OutputTruncationException$: Inner 
> stream finished before inputs completed. Outputs might have been 
> truncated.
> ERROR [datastore-rest-api-akka.actor.default-dispatcher-5] - Error in 
> st

Re: [akka-user] Re: Http Client with Source.tick

2016-03-10 Thread Viktor Klang
http://doc.akka.io/api/akka/2.4.2/?_ga=1.176202021.1085570125.1455222020#akka.stream.scaladsl.FlowOps

-- 
Cheers,
√
On Mar 10, 2016 11:43 PM, "Arun Sethia"  wrote:

> Thanks.
>
> please can you provide the link where I can see how to deal with such
> errors.
>
> On Thursday, March 10, 2016 at 4:22:35 PM UTC-6, √ wrote:
>>
>> For each only deals with elements, not errors.
>> Please consult the documentation for combinators that let you observe and
>> manipulate errors.
>>
>> --
>> Cheers,
>> √
>> On Mar 10, 2016 11:04 PM, "Arun Sethia"  wrote:
>>
>>> httpSourceGraph1 is httpSourceGraph , but still same issue
>>>
>>>
>>> val response= httpSourceGraph.via(httpConnFlow()).runForeach(println)
>>>
>>>
>>> we can test same with any external internet URL also, the result remain 
>>> same.
>>>
>>>
>>> On Thursday, March 10, 2016 at 3:55:22 PM UTC-6, Arun Sethia wrote:

 Hi,

 I am trying to connect http client to a http service exposed by server,
 the source should send request every 1 second for that I have crated
 following partial graphs:


 def httpSourceGraph() = {
   Source.fromGraph(GraphDSL.create() { implicit builder =>
 val sourceOutLet = builder.add(Source.tick(FiniteDuration(0, 
 TimeUnit.SECONDS), FiniteDuration(1,
   TimeUnit.SECONDS),
   HttpRequest(uri ="/test", method = HttpMethods.GET))).out
 // expose outlet
 SourceShape(sourceOutLet)
   })
 }


 def httpConnFlow() = {
   Flow.fromGraph(GraphDSL.create() { implicit builder =>

 val httpSourceFlow = builder.add(Http(system).outgoingConnection(host 
 = "localhost", port = 8080))

 FlowShape(httpSourceFlow.in, httpSourceFlow.out)
   })
 }


 the graph is composed as


 val response= httpSourceGraph1.via(httpConnFlow()).runForeach(println)


 if the http server (localhost:8080/test) is up and running, everything 
 works fine, every 1 second I can see the response coming back from the 
 server. I am not able to any response in case of  either server is down or 
 it goes down later.


 *I think it should give me following error:*


 akka.stream.StreamTcpException: Tcp command 
 [Connect(localhost/127.0.0.1:8080,None,List(),Some(10 seconds),true)] 
 failed


 Thanks for the help.

 -Arun




 --
>>> >> 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+...@googlegroups.com.
>>> To post to this group, send email to akka...@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.
>

-- 
>>  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.


Re: [akka-user] Re: Http Client with Source.tick

2016-03-10 Thread Arun Sethia
Thanks.

please can you provide the link where I can see how to deal with such 
errors.

On Thursday, March 10, 2016 at 4:22:35 PM UTC-6, √ wrote:
>
> For each only deals with elements, not errors.
> Please consult the documentation for combinators that let you observe and 
> manipulate errors.
>
> -- 
> Cheers,
> √
> On Mar 10, 2016 11:04 PM, "Arun Sethia" > 
> wrote:
>
>> httpSourceGraph1 is httpSourceGraph , but still same issue 
>>
>>
>> val response= httpSourceGraph.via(httpConnFlow()).runForeach(println)
>>
>>
>> we can test same with any external internet URL also, the result remain 
>> same. 
>>
>>
>> On Thursday, March 10, 2016 at 3:55:22 PM UTC-6, Arun Sethia wrote:
>>>
>>> Hi,
>>>
>>> I am trying to connect http client to a http service exposed by server, 
>>> the source should send request every 1 second for that I have crated 
>>> following partial graphs:
>>>
>>>
>>> def httpSourceGraph() = {
>>>   Source.fromGraph(GraphDSL.create() { implicit builder =>
>>> val sourceOutLet = builder.add(Source.tick(FiniteDuration(0, 
>>> TimeUnit.SECONDS), FiniteDuration(1,
>>>   TimeUnit.SECONDS),
>>>   HttpRequest(uri ="/test", method = HttpMethods.GET))).out
>>> // expose outlet
>>> SourceShape(sourceOutLet)
>>>   })
>>> }
>>>
>>>
>>> def httpConnFlow() = {
>>>   Flow.fromGraph(GraphDSL.create() { implicit builder =>
>>>
>>> val httpSourceFlow = builder.add(Http(system).outgoingConnection(host = 
>>> "localhost", port = 8080))
>>>
>>> FlowShape(httpSourceFlow.in, httpSourceFlow.out)
>>>   })
>>> }
>>>
>>>
>>> the graph is composed as
>>>
>>>
>>> val response= httpSourceGraph1.via(httpConnFlow()).runForeach(println)
>>>
>>>
>>> if the http server (localhost:8080/test) is up and running, everything 
>>> works fine, every 1 second I can see the response coming back from the 
>>> server. I am not able to any response in case of  either server is down or 
>>> it goes down later.
>>>
>>>
>>> *I think it should give me following error:*
>>>
>>>
>>> akka.stream.StreamTcpException: Tcp command 
>>> [Connect(localhost/127.0.0.1:8080,None,List(),Some(10 seconds),true)] failed
>>>
>>>
>>> Thanks for the help.
>>>
>>> -Arun
>>>
>>>
>>>
>>>
>>> -- 
>> >> 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+...@googlegroups.com .
>> To post to this group, send email to akka...@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.


Re: [akka-user] Re: Http Client with Source.tick

2016-03-10 Thread Viktor Klang
For each only deals with elements, not errors.
Please consult the documentation for combinators that let you observe and
manipulate errors.

-- 
Cheers,
√
On Mar 10, 2016 11:04 PM, "Arun Sethia"  wrote:

> httpSourceGraph1 is httpSourceGraph , but still same issue
>
>
> val response= httpSourceGraph.via(httpConnFlow()).runForeach(println)
>
>
> we can test same with any external internet URL also, the result remain same.
>
>
> On Thursday, March 10, 2016 at 3:55:22 PM UTC-6, Arun Sethia wrote:
>>
>> Hi,
>>
>> I am trying to connect http client to a http service exposed by server,
>> the source should send request every 1 second for that I have crated
>> following partial graphs:
>>
>>
>> def httpSourceGraph() = {
>>   Source.fromGraph(GraphDSL.create() { implicit builder =>
>> val sourceOutLet = builder.add(Source.tick(FiniteDuration(0, 
>> TimeUnit.SECONDS), FiniteDuration(1,
>>   TimeUnit.SECONDS),
>>   HttpRequest(uri ="/test", method = HttpMethods.GET))).out
>> // expose outlet
>> SourceShape(sourceOutLet)
>>   })
>> }
>>
>>
>> def httpConnFlow() = {
>>   Flow.fromGraph(GraphDSL.create() { implicit builder =>
>>
>> val httpSourceFlow = builder.add(Http(system).outgoingConnection(host = 
>> "localhost", port = 8080))
>>
>> FlowShape(httpSourceFlow.in, httpSourceFlow.out)
>>   })
>> }
>>
>>
>> the graph is composed as
>>
>>
>> val response= httpSourceGraph1.via(httpConnFlow()).runForeach(println)
>>
>>
>> if the http server (localhost:8080/test) is up and running, everything works 
>> fine, every 1 second I can see the response coming back from the server. I 
>> am not able to any response in case of  either server is down or it goes 
>> down later.
>>
>>
>> *I think it should give me following error:*
>>
>>
>> akka.stream.StreamTcpException: Tcp command 
>> [Connect(localhost/127.0.0.1:8080,None,List(),Some(10 seconds),true)] failed
>>
>>
>> Thanks for the help.
>>
>> -Arun
>>
>>
>>
>>
>> --
> >> 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.


[akka-user] Re: Http Client with Source.tick

2016-03-10 Thread Arun Sethia


httpSourceGraph1 is httpSourceGraph , but still same issue 


val response= httpSourceGraph.via(httpConnFlow()).runForeach(println)


we can test same with any external internet URL also, the result remain same. 


On Thursday, March 10, 2016 at 3:55:22 PM UTC-6, Arun Sethia wrote:
>
> Hi,
>
> I am trying to connect http client to a http service exposed by server, 
> the source should send request every 1 second for that I have crated 
> following partial graphs:
>
>
> def httpSourceGraph() = {
>   Source.fromGraph(GraphDSL.create() { implicit builder =>
> val sourceOutLet = builder.add(Source.tick(FiniteDuration(0, 
> TimeUnit.SECONDS), FiniteDuration(1,
>   TimeUnit.SECONDS),
>   HttpRequest(uri ="/test", method = HttpMethods.GET))).out
> // expose outlet
> SourceShape(sourceOutLet)
>   })
> }
>
>
> def httpConnFlow() = {
>   Flow.fromGraph(GraphDSL.create() { implicit builder =>
>
> val httpSourceFlow = builder.add(Http(system).outgoingConnection(host = 
> "localhost", port = 8080))
>
> FlowShape(httpSourceFlow.in, httpSourceFlow.out)
>   })
> }
>
>
> the graph is composed as
>
>
> val response= httpSourceGraph1.via(httpConnFlow()).runForeach(println)
>
>
> if the http server (localhost:8080/test) is up and running, everything works 
> fine, every 1 second I can see the response coming back from the server. I am 
> not able to any response in case of  either server is down or it goes down 
> later.
>
>
> *I think it should give me following error:*
>
>
> akka.stream.StreamTcpException: Tcp command 
> [Connect(localhost/127.0.0.1:8080,None,List(),Some(10 seconds),true)] failed
>
>
> Thanks for the help.
>
> -Arun
>
>
>
>
>

-- 
>>  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.


[akka-user] Http Client with Source.tick

2016-03-10 Thread Arun Sethia
Hi,

I am trying to connect http client to a http service exposed by server, the 
source should send request every 1 second for that I have crated following 
partial graphs:


def httpSourceGraph() = {
  Source.fromGraph(GraphDSL.create() { implicit builder =>
val sourceOutLet = builder.add(Source.tick(FiniteDuration(0, 
TimeUnit.SECONDS), FiniteDuration(1,
  TimeUnit.SECONDS),
  HttpRequest(uri ="/test", method = HttpMethods.GET))).out
// expose outlet
SourceShape(sourceOutLet)
  })
}


def httpConnFlow() = {
  Flow.fromGraph(GraphDSL.create() { implicit builder =>

val httpSourceFlow = builder.add(Http(system).outgoingConnection(host = 
"localhost", port = 8080))

FlowShape(httpSourceFlow.in, httpSourceFlow.out)
  })
}


the graph is composed as


val response= httpSourceGraph1.via(httpConnFlow()).runForeach(println)


if the http server (localhost:8080/test) is up and running, everything works 
fine, every 1 second I can see the response coming back from the server. I am 
not able to any response in case of  either server is down or it goes down 
later.


*I think it should give me following error:*


akka.stream.StreamTcpException: Tcp command 
[Connect(localhost/127.0.0.1:8080,None,List(),Some(10 seconds),true)] failed


Thanks for the help.

-Arun




-- 
>>  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.


Re: [akka-user] Monitoring Akka Streaming

2016-03-10 Thread Filippo De Luca
Hi,
I suppose you can use map and call a external service for each message at
defined stage.

Even better you can build your own stage.

On 10 March 2016 at 17:28, Arun Sethia  wrote:

> Hi,
>
> I have a requirement where we would like to know how many incoming
> messages are processed by flow. We can use Materializer with AtomicLong
> with Flow to do the same.
>
> Any other alternative or in-built functionality in akka-stream API?
>
> Thanks
> Arun
>
> --
> >> 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.
>



-- 


[image: --]
Filippo De Luca
[image: http://]about.me/FilippoDeLuca


-- 
>>  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.


Re: [akka-user] Re: Using ActorPublisher without ActorSubscriber

2016-03-10 Thread Simão Mata
Hello,

This cannot be due to too many values because I am basically pushing values 
one by one manually, I insert a line in a database and wait for something 
to happen, so not a lot of traffic for sure.

I tried adding logging to Receive in the receive method but nothing 
happens, it seems the actor never receives that message.

Thank you.

On Thursday, March 10, 2016 at 6:59:07 PM UTC+1, Samuel Tardieu wrote:
>
> Simão,
>
> you might be trying to push too many values downstream, I think you should 
> replace your Math.max by Math.min for a start. Are you sure your 
> subscription isn’t canceled rapidly because of this force-feeding? Also, 
> have you tried logging your Request branch in receive and display 
> totalDemand then?
>
>
>   Sam
> ​
>
> Le jeu. 10 mars 2016 à 08:53, Simão Mata > 
> a écrit :
>
>> Here is the code for my actor: 
>> https://gist.github.com/simao/3003ee256751cfb7b2f7
>>
>> If i put a log message on `deliverBuf` then I see that this method gets 
>> called for each event, but totalDemand is always 0.
>>
>> Thank you for your help.
>>
>> Simao
>>
>>
>>
>>
>> On Wednesday, March 9, 2016 at 10:41:13 PM UTC+1, Rafał Krzewski wrote:
>>>
>>> Your actor is supposed to receive ActorPublisherMessage.Request message 
>>> after the stream is materialized. At this point totalDemand should be > 
>>> 0 and you are allowed to call onNext
>>>
>>> Can you show the code of your publisher actor?
>>>
>>> Cheers,
>>> Rafał
>>>
>>> W dniu środa, 9 marca 2016 13:48:27 UTC+1 użytkownik Simão Mata napisał:

 Hello,

 I think I misunderstand the usage of ActorPublisher. I read the 
 documentation (
 http://doc.akka.io/docs/akka-stream-and-http-experimental/2.0.3/scala/stream-integrations.html#ActorPublisher)
  
 but I cannot seem to understand how to use it.

 I am creating an ActorPublisher actor and creating a Source like this:

 val source = Source.actorPublisher(publisherProps)

 I then connect this source to a sink and run it: 
 source.runWith(Sink.ignore). But debugging the actor I can see that 
 totalDemand is always 0, so the actor never calls `onNext`. So what should 
 update the demand on the actor? Do I always have to connect an 
 ActorPublisher to an ActorSubscriber so that demand in ActorPublisher is 
 updated properly?

 Thank you.

>>> -- 
>> >> 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+...@googlegroups.com .
>> To post to this group, send email to akka...@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.


Re: [akka-user] Re: Using ActorPublisher without ActorSubscriber

2016-03-10 Thread Samuel Tardieu
Simão,

you might be trying to push too many values downstream, I think you should
replace your Math.max by Math.min for a start. Are you sure your
subscription isn’t canceled rapidly because of this force-feeding? Also,
have you tried logging your Request branch in receive and display
totalDemand then?


  Sam
​

Le jeu. 10 mars 2016 à 08:53, Simão Mata  a écrit :

> Here is the code for my actor:
> https://gist.github.com/simao/3003ee256751cfb7b2f7
>
> If i put a log message on `deliverBuf` then I see that this method gets
> called for each event, but totalDemand is always 0.
>
> Thank you for your help.
>
> Simao
>
>
>
>
> On Wednesday, March 9, 2016 at 10:41:13 PM UTC+1, Rafał Krzewski wrote:
>>
>> Your actor is supposed to receive ActorPublisherMessage.Request message
>> after the stream is materialized. At this point totalDemand should be >
>> 0 and you are allowed to call onNext
>>
>> Can you show the code of your publisher actor?
>>
>> Cheers,
>> Rafał
>>
>> W dniu środa, 9 marca 2016 13:48:27 UTC+1 użytkownik Simão Mata napisał:
>>>
>>> Hello,
>>>
>>> I think I misunderstand the usage of ActorPublisher. I read the
>>> documentation (
>>> http://doc.akka.io/docs/akka-stream-and-http-experimental/2.0.3/scala/stream-integrations.html#ActorPublisher)
>>> but I cannot seem to understand how to use it.
>>>
>>> I am creating an ActorPublisher actor and creating a Source like this:
>>>
>>> val source = Source.actorPublisher(publisherProps)
>>>
>>> I then connect this source to a sink and run it:
>>> source.runWith(Sink.ignore). But debugging the actor I can see that
>>> totalDemand is always 0, so the actor never calls `onNext`. So what should
>>> update the demand on the actor? Do I always have to connect an
>>> ActorPublisher to an ActorSubscriber so that demand in ActorPublisher is
>>> updated properly?
>>>
>>> Thank you.
>>>
>> --
> >> 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.


[akka-user] Re: [akka-http-2.4.2] connection timeouts under load

2016-03-10 Thread Brian
I'm seeing (what looks to be) the same issue under load test, where 
connection timeouts cause the application to become non-responsive to http 
requests.  I also eventually get an OOM due to GC overhead limit exceeded, 
although that may be a symptom of a cascading failure.  Load test runs 
without connection timeouts are clean, but as soon as I start to see 
timeouts, it's crash and burn.  Similar to Giovanni's case with Finch 
above, when the same business layer is used behind liftweb, there are no 
such issues.

Thread dumps show a lot of busy threads in deep stacks, but not much 
obvious in the akka-http layer.  It is interesting that during lock-up I 
need to use the -F option with jstack to even get a thread dump.

I do have logback configured, so hopefully can add a bit more information 
around the issue.  Some of the interesting error messages that happen as 
things are going south include:

// Several of these indicates issue is imminent
ERROR a.a.RepointableActorRef - Error in stage [recover]: No elements 
passed in the last 1 minute.
akka.http.impl.engine.HttpConnectionTimeoutException: No elements passed in 
the last 1 minute.

// Not sure if this is Metallica related, only one set of these seen
ERROR a.a.ActorSystemImpl - exception on LARS’ timer thread

INFO  a.a.ActorSystemImpl - starting new LARS thread

// These tend to be the last errors to happen before JVM crash, and there 
are many:

ERROR a.a.RepointableActorRef - Error in stage [akka.http.impl.engine.server
.HttpServerBluePrint$RequestTimeoutSupport@xxx]: requirement failed: 
Cannot push port (responseOut) twice


Hope this helps, i'll keep an eye on #19996.

On Thursday, March 10, 2016 at 9:44:44 AM UTC-5, Kyrylo Stokoz wrote:
>
> I think i have related issue but on client side (i.e making request using 
> akka http) and issue with reproducer is: 
> https://github.com/akka/akka/issues/19953
>
> On Thursday, March 10, 2016 at 3:27:04 AM UTC-6, Giovanni Alberto 
> Caporaletti wrote:
>>
>> I opened an issue with a simple reproducer: 
>> https://github.com/akka/akka/issues/19996
>>
>>
>>
>>
>> On Thursday, 10 March 2016 10:21:26 UTC+1, lisp pm wrote:
>>>
>>> My use case is similar to yours. After downgrading from 2.4.2 to 2.0.3, 
>>> the error has gone and everything seems working fine.
>>>
>>>
>>> On Saturday, March 5, 2016 at 8:25:25 AM UTC-5, Kyrylo Stokoz wrote:

 Hi,

 I have similar observations after a while server keep accepting 
 requests but they all timeout and nothing gets returned in response.
 I`m using akka http 2.4.2 and streams to create a simple server which 
 handle requests and return files from S3.

 In my case i don`t need to do even high load, doing request one after 
 another is enough to hang the server. I played with max connections 
 parameter and increasing it makes app process more requests but eventually 
 it stuck anyway.

 From my observation issue is in http connections pool that are not 
 properly releasing connections and when new request comes in runnable 
 graph 
 is created but sinks and sources are not properly connected to start the 
 flow.

 During my tests i see (not sure this is related though):

 ERROR [datastore-rest-api-akka.actor.default-dispatcher-5] - Error in 
 stage [One2OneBidi]: Inner stream finished before inputs completed. 
 Outputs 
 might have been truncated.
 akka.http.impl.util.One2OneBidiFlow$OutputTruncationException$: Inner 
 stream finished before inputs completed. Outputs might have been truncated.
 ERROR [datastore-rest-api-akka.actor.default-dispatcher-5] - Error in 
 stage [One2OneBidi]: Inner stream finished before inputs completed. 
 Outputs 
 might have been truncated.
 akka.http.impl.util.One2OneBidiFlow$OutputTruncationException$: Inner 
 stream finished before inputs completed. Outputs might have been truncated.
 ERROR [datastore-rest-api-akka.actor.default-dispatcher-5] - Error in 
 stage [One2OneBidi]: Inner stream finished before inputs completed. 
 Outputs 
 might have been truncated.
 akka.http.impl.util.One2OneBidiFlow$OutputTruncationException$: Inner 
 stream finished before inputs completed. Outputs might have been truncated.
 ERROR [datastore-rest-api-akka.actor.default-dispatcher-5] - Error in 
 stage [One2OneBidi]: Inner stream finished before inputs completed. 
 Outputs 
 might have been truncated.
 akka.http.impl.util.One2OneBidiFlow$OutputTruncationException$: Inner 
 stream finished before inputs completed. Outputs might have been truncated.
  INFO [datastore-rest-api-akka.actor.default-dispatcher-5] - Message 
 [akka.io.Tcp$ResumeReading$] from 
 Actor[akka://datastore-rest-api/user/StreamSupervisor-0/$$a#1262265379] to 
 Actor[akka://datastore-rest-api/system/IO-TCP/selectors/$a/3#-1262857800] 
 was not delivered. [1] dead letters encountered. Th

[akka-user] Monitoring Akka Streaming

2016-03-10 Thread Arun Sethia
Hi,

I have a requirement where we would like to know how many incoming messages 
are processed by flow. We can use Materializer with AtomicLong with Flow to 
do the same.

Any other alternative or in-built functionality in akka-stream API?

Thanks 
Arun 

-- 
>>  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.


Re: [akka-user] zipWithIndex

2016-03-10 Thread Richard Rodseth
Thanks! Always good to learn about new methods :)

On Thu, Mar 10, 2016 at 6:50 AM, Viktor Klang 
wrote:

> There's also: someSource.zip(Source.fromIterator(() => Iterator.from(0)))
>
> On Thu, Mar 10, 2016 at 3:42 PM, Akka Team 
> wrote:
>
>> Hi Richard,
>>
>> I would say in general being able to achieve what you want by composition
>> rather than a multitude of special stages is what we strive for with akka
>> streams. There is also a big difference between the regular collections and
>> the streams that streams might be infinite, parallell, cyclic etc, and in
>> those cases a zipWithIndex might not make sense.
>>
>> You could also achieve what you describe with a single stage using
>> statefulMapConcat like this:
>>
>> import scala.collection.immutable.Iterable
>> val flow: Flow[String, (String, Long), NotUsed] = 
>> Flow[String].statefulMapConcat { () =>
>>   var index = 0L
>>   def next = {
>> index += 1
>> index
>>   }
>>
>>   (string) => Iterable((string, next))
>> }
>>
>>
>> --
>> Johan Andrén
>> Akka Team, Lightbend Inc.
>>
>> --
>> >> 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.
>>
>
>
>
> --
> Cheers,
> √
>
> --
> >> 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.


Re: [akka-user] zipWithIndex

2016-03-10 Thread Viktor Klang
There's also: someSource.zip(Source.fromIterator(() => Iterator.from(0)))

On Thu, Mar 10, 2016 at 3:42 PM, Akka Team  wrote:

> Hi Richard,
>
> I would say in general being able to achieve what you want by composition
> rather than a multitude of special stages is what we strive for with akka
> streams. There is also a big difference between the regular collections and
> the streams that streams might be infinite, parallell, cyclic etc, and in
> those cases a zipWithIndex might not make sense.
>
> You could also achieve what you describe with a single stage using
> statefulMapConcat like this:
>
> import scala.collection.immutable.Iterable
> val flow: Flow[String, (String, Long), NotUsed] = 
> Flow[String].statefulMapConcat { () =>
>   var index = 0L
>   def next = {
> index += 1
> index
>   }
>
>   (string) => Iterable((string, next))
> }
>
>
> --
> Johan Andrén
> Akka Team, Lightbend Inc.
>
> --
> >> 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.
>



-- 
Cheers,
√

-- 
>>  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.


Re: [akka-user] Re: Question about kaka-http websocket client

2016-03-10 Thread Akka Team
After looking closer at this, the reason is that when the Source completes,
the socket gets closed and this is because websockets do not really support
half-closed mode, where only one direction is still open. The more or less
exact six second before closing is caused by two of the hardcoded 3-second
timeouts inside of the websocket protocol stack in Akka HTTP.

We are discussing if we can provide a nice API to hide this, but have not
arrived on a decision yet. To avoid this you can make sure the source does
not complete until you want it to, for example by using Source.maybe like
this:


val outgoing = 
Source.single(TextMessage("out")).concatMat(Source.maybe)(Keep.right)


This will materialize into a promise that you can complete or fail whenever
you want to kill the connection from the client side.

--
Johan Andrén
Akka Team, Lightbend Inc.

-- 
>>  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.


Re: [akka-user] zipWithIndex

2016-03-10 Thread Akka Team
Hi Richard,

I would say in general being able to achieve what you want by composition
rather than a multitude of special stages is what we strive for with akka
streams. There is also a big difference between the regular collections and
the streams that streams might be infinite, parallell, cyclic etc, and in
those cases a zipWithIndex might not make sense.

You could also achieve what you describe with a single stage using
statefulMapConcat like this:

import scala.collection.immutable.Iterable
val flow: Flow[String, (String, Long), NotUsed] =
Flow[String].statefulMapConcat { () =>
  var index = 0L
  def next = {
index += 1
index
  }

  (string) => Iterable((string, next))
}


-- 
Johan Andrén
Akka Team, Lightbend Inc.

-- 
>>  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.


[akka-user] Re: [akka-http-2.4.2] connection timeouts under load

2016-03-10 Thread Kyrylo Stokoz
I think i have related issue but on client side (i.e making request using 
akka http) and issue with reproducer 
is: https://github.com/akka/akka/issues/19953

On Thursday, March 10, 2016 at 3:27:04 AM UTC-6, Giovanni Alberto 
Caporaletti wrote:
>
> I opened an issue with a simple reproducer: 
> https://github.com/akka/akka/issues/19996
>
>
>
>
> On Thursday, 10 March 2016 10:21:26 UTC+1, lisp pm wrote:
>>
>> My use case is similar to yours. After downgrading from 2.4.2 to 2.0.3, 
>> the error has gone and everything seems working fine.
>>
>>
>> On Saturday, March 5, 2016 at 8:25:25 AM UTC-5, Kyrylo Stokoz wrote:
>>>
>>> Hi,
>>>
>>> I have similar observations after a while server keep accepting requests 
>>> but they all timeout and nothing gets returned in response.
>>> I`m using akka http 2.4.2 and streams to create a simple server which 
>>> handle requests and return files from S3.
>>>
>>> In my case i don`t need to do even high load, doing request one after 
>>> another is enough to hang the server. I played with max connections 
>>> parameter and increasing it makes app process more requests but eventually 
>>> it stuck anyway.
>>>
>>> From my observation issue is in http connections pool that are not 
>>> properly releasing connections and when new request comes in runnable graph 
>>> is created but sinks and sources are not properly connected to start the 
>>> flow.
>>>
>>> During my tests i see (not sure this is related though):
>>>
>>> ERROR [datastore-rest-api-akka.actor.default-dispatcher-5] - Error in 
>>> stage [One2OneBidi]: Inner stream finished before inputs completed. Outputs 
>>> might have been truncated.
>>> akka.http.impl.util.One2OneBidiFlow$OutputTruncationException$: Inner 
>>> stream finished before inputs completed. Outputs might have been truncated.
>>> ERROR [datastore-rest-api-akka.actor.default-dispatcher-5] - Error in 
>>> stage [One2OneBidi]: Inner stream finished before inputs completed. Outputs 
>>> might have been truncated.
>>> akka.http.impl.util.One2OneBidiFlow$OutputTruncationException$: Inner 
>>> stream finished before inputs completed. Outputs might have been truncated.
>>> ERROR [datastore-rest-api-akka.actor.default-dispatcher-5] - Error in 
>>> stage [One2OneBidi]: Inner stream finished before inputs completed. Outputs 
>>> might have been truncated.
>>> akka.http.impl.util.One2OneBidiFlow$OutputTruncationException$: Inner 
>>> stream finished before inputs completed. Outputs might have been truncated.
>>> ERROR [datastore-rest-api-akka.actor.default-dispatcher-5] - Error in 
>>> stage [One2OneBidi]: Inner stream finished before inputs completed. Outputs 
>>> might have been truncated.
>>> akka.http.impl.util.One2OneBidiFlow$OutputTruncationException$: Inner 
>>> stream finished before inputs completed. Outputs might have been truncated.
>>>  INFO [datastore-rest-api-akka.actor.default-dispatcher-5] - Message 
>>> [akka.io.Tcp$ResumeReading$] from 
>>> Actor[akka://datastore-rest-api/user/StreamSupervisor-0/$$a#1262265379] to 
>>> Actor[akka://datastore-rest-api/system/IO-TCP/selectors/$a/3#-1262857800] 
>>> was not delivered. [1] dead letters encountered. This logging can be turned 
>>> off or adjusted with configuration settings 'akka.log-dead-letters' and 
>>> 'akka.log-dead-letters-during-shutdown'.
>>>  INFO [datastore-rest-api-akka.actor.default-dispatcher-5] - Message 
>>> [akka.io.Tcp$ResumeReading$] from 
>>> Actor[akka://datastore-rest-api/user/StreamSupervisor-0/$$e#585879533] to 
>>> Actor[akka://datastore-rest-api/system/IO-TCP/selectors/$a/7#1750981790] 
>>> was not delivered. [2] dead letters encountered. This logging can be turned 
>>> off or adjusted with configuration settings 'akka.log-dead-letters' and 
>>> 'akka.log-dead-letters-during-shutdown'.
>>>
>>>   
>>>
>>>
>>> On Saturday, March 5, 2016 at 6:03:57 AM UTC-6, Giovanni Alberto 
>>> Caporaletti wrote:

 Hi,
 I'll try to explain what I'm experiencing in my akka-http app.
 (I found this issue but it's not been updated for almost a year and I'm 
 not sure it's relevant: https://github.com/akka/akka/issues/17395)

 I noticed that under load a lot of connections (~1-2%) were dropped or 
 timed out. I started investigating, tuning os and akka params and trimming 
 down my sample app until I got this:


 //N.B.: this is a test

 implicit val system = ActorSystem()
 implicit val mat: ActorMaterializer = ActorMaterializer()
 implicit val ec = system.dispatcher

 val binding: Future[ServerBinding] = Http().bind("0.0.0.0", 1104).map { 
 conn ⇒
 val promise = Promise[Unit]()
 // I don't even wait for the end of the flow
 val handler = Flow[HttpRequest].map { _ ⇒ promise.success(()); 
 HttpResponse() }

 // to be sure it's not a mapAsync(1) problem I use map and block here, 
 same result
 val t0 = System.currentTimeMillis()
 println(s"${Thread.currentThread().getN

Re: [akka-user] circuit breaker sync vs async

2016-03-10 Thread Akka Team
Hi Lucian,

You should separate mail sending from response generation and other HTTP
concerns, a function sending mail has no business knowing that the code
invoking it is a HTTP route. If you instead let the mail method return a
Future[Done] or something like it you can discern between different
failures on the route side and map those to appropriate http responses.

Validating the entity is also a HTTP concern that could lead to a direct
BadRequest response if it is invalid.

The circuit breaker is meant to protect a separate service from being
overloaded with requests when it is already having problems, you would not
want to wrap request validation in a circuitbreaker, since an invalid
request then might open the breaker stopping other perfectly valid requests
from being accepted during the reset timeout.

I hope this helps.
-- 
Johan Andrén
Akka Team, Lightbend Inc.

-- 
>>  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.


[akka-user] Re: [akka-http-2.4.2] connection timeouts under load

2016-03-10 Thread Giovanni Alberto Caporaletti
I opened an issue with a simple reproducer: 
https://github.com/akka/akka/issues/19996




On Thursday, 10 March 2016 10:21:26 UTC+1, lisp pm wrote:
>
> My use case is similar to yours. After downgrading from 2.4.2 to 2.0.3, 
> the error has gone and everything seems working fine.
>
>
> On Saturday, March 5, 2016 at 8:25:25 AM UTC-5, Kyrylo Stokoz wrote:
>>
>> Hi,
>>
>> I have similar observations after a while server keep accepting requests 
>> but they all timeout and nothing gets returned in response.
>> I`m using akka http 2.4.2 and streams to create a simple server which 
>> handle requests and return files from S3.
>>
>> In my case i don`t need to do even high load, doing request one after 
>> another is enough to hang the server. I played with max connections 
>> parameter and increasing it makes app process more requests but eventually 
>> it stuck anyway.
>>
>> From my observation issue is in http connections pool that are not 
>> properly releasing connections and when new request comes in runnable graph 
>> is created but sinks and sources are not properly connected to start the 
>> flow.
>>
>> During my tests i see (not sure this is related though):
>>
>> ERROR [datastore-rest-api-akka.actor.default-dispatcher-5] - Error in 
>> stage [One2OneBidi]: Inner stream finished before inputs completed. Outputs 
>> might have been truncated.
>> akka.http.impl.util.One2OneBidiFlow$OutputTruncationException$: Inner 
>> stream finished before inputs completed. Outputs might have been truncated.
>> ERROR [datastore-rest-api-akka.actor.default-dispatcher-5] - Error in 
>> stage [One2OneBidi]: Inner stream finished before inputs completed. Outputs 
>> might have been truncated.
>> akka.http.impl.util.One2OneBidiFlow$OutputTruncationException$: Inner 
>> stream finished before inputs completed. Outputs might have been truncated.
>> ERROR [datastore-rest-api-akka.actor.default-dispatcher-5] - Error in 
>> stage [One2OneBidi]: Inner stream finished before inputs completed. Outputs 
>> might have been truncated.
>> akka.http.impl.util.One2OneBidiFlow$OutputTruncationException$: Inner 
>> stream finished before inputs completed. Outputs might have been truncated.
>> ERROR [datastore-rest-api-akka.actor.default-dispatcher-5] - Error in 
>> stage [One2OneBidi]: Inner stream finished before inputs completed. Outputs 
>> might have been truncated.
>> akka.http.impl.util.One2OneBidiFlow$OutputTruncationException$: Inner 
>> stream finished before inputs completed. Outputs might have been truncated.
>>  INFO [datastore-rest-api-akka.actor.default-dispatcher-5] - Message 
>> [akka.io.Tcp$ResumeReading$] from 
>> Actor[akka://datastore-rest-api/user/StreamSupervisor-0/$$a#1262265379] to 
>> Actor[akka://datastore-rest-api/system/IO-TCP/selectors/$a/3#-1262857800] 
>> was not delivered. [1] dead letters encountered. This logging can be turned 
>> off or adjusted with configuration settings 'akka.log-dead-letters' and 
>> 'akka.log-dead-letters-during-shutdown'.
>>  INFO [datastore-rest-api-akka.actor.default-dispatcher-5] - Message 
>> [akka.io.Tcp$ResumeReading$] from 
>> Actor[akka://datastore-rest-api/user/StreamSupervisor-0/$$e#585879533] to 
>> Actor[akka://datastore-rest-api/system/IO-TCP/selectors/$a/7#1750981790] 
>> was not delivered. [2] dead letters encountered. This logging can be turned 
>> off or adjusted with configuration settings 'akka.log-dead-letters' and 
>> 'akka.log-dead-letters-during-shutdown'.
>>
>>   
>>
>>
>> On Saturday, March 5, 2016 at 6:03:57 AM UTC-6, Giovanni Alberto 
>> Caporaletti wrote:
>>>
>>> Hi,
>>> I'll try to explain what I'm experiencing in my akka-http app.
>>> (I found this issue but it's not been updated for almost a year and I'm 
>>> not sure it's relevant: https://github.com/akka/akka/issues/17395)
>>>
>>> I noticed that under load a lot of connections (~1-2%) were dropped or 
>>> timed out. I started investigating, tuning os and akka params and trimming 
>>> down my sample app until I got this:
>>>
>>>
>>> //N.B.: this is a test
>>>
>>> implicit val system = ActorSystem()
>>> implicit val mat: ActorMaterializer = ActorMaterializer()
>>> implicit val ec = system.dispatcher
>>>
>>> val binding: Future[ServerBinding] = Http().bind("0.0.0.0", 1104).map { 
>>> conn ⇒
>>> val promise = Promise[Unit]()
>>> // I don't even wait for the end of the flow
>>> val handler = Flow[HttpRequest].map { _ ⇒ promise.success(()); 
>>> HttpResponse() }
>>>
>>> // to be sure it's not a mapAsync(1) problem I use map and block here, 
>>> same result
>>> val t0 = System.currentTimeMillis()
>>> println(s"${Thread.currentThread().getName} start")
>>>
>>> conn handleWith handler
>>>
>>> Await.result(promise.future, 10.seconds)
>>> println(s"${Thread.currentThread().getName} end 
>>> ${System.currentTimeMillis() - t0}ms");
>>>   }.to(Sink.ignore).run()
>>>
>>> Await.result(binding, 10.seconds)
>>>
>>>
>>>
>>> When I run a small test using ab with something like "-c 1000

[akka-user] akka.actor.PreRestartException Happening whenever there is restart

2016-03-10 Thread Biniam Asnake
Hello,

I always get this exception whenever the actor restarts and send the 
message again to the actor.

Why does it happen and how do I solve it?

Thanks.

akka.actor.PreRestartException: exception in preRestart(class 
com.google.api.ads.adwords.axis.v201509.cm.ApiException, None)
at 
akka.actor.dungeon.FaultHandling$$anonfun$1.apply(FaultHandling.scala:69)
at 
akka.actor.dungeon.FaultHandling$$anonfun$1.apply(FaultHandling.scala:68)
at 
akka.actor.dungeon.FaultHandling$$anonfun$handleNonFatalOrInterruptedException$1.applyOrElse(FaultHandling.scala:302)
at 
akka.actor.dungeon.FaultHandling$$anonfun$handleNonFatalOrInterruptedException$1.applyOrElse(FaultHandling.scala:297)
at 
scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:36)
at 
akka.actor.dungeon.FaultHandling$class.faultRecreate(FaultHandling.scala:68)
at akka.actor.ActorCell.faultRecreate(ActorCell.scala:369)
at akka.actor.ActorCell.invokeAll$1_aroundBody2(ActorCell.scala:459)
at akka.actor.ActorCell$AjcClosure3.run(ActorCell.scala:1)
at 
org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
at 
akka.kamon.instrumentation.ActorSystemMessageInstrumentation$$anonfun$aroundSystemMessageInvoke$1.apply(ActorSystemMessageInstrumentation.scala:34)
at kamon.trace.Tracer$.withContext(TracerModule.scala:57)
at 
akka.kamon.instrumentation.ActorSystemMessageInstrumentation.aroundSystemMessageInvoke(ActorSystemMessageInstrumentation.scala:34)
at akka.actor.ActorCell.invokeAll$1(ActorCell.scala:1)
at akka.actor.ActorCell.systemInvoke(ActorCell.scala:478)
at akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:279)
at akka.dispatch.Mailbox.run(Mailbox.scala:220)
at akka.dispatch.Mailbox.exec(Mailbox.scala:231)
at 
scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at 
scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.pollAndExecAll(ForkJoinPool.java:1253)
at 
scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1346)
at 
scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at 
scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Caused by: java.util.NoSuchElementException: None.get
at scala.None$.get(Option.scala:347)
at 
com.bonial.megan.execution.actors.AbstractActor.preRestart(AbstractActor.groovy:52)
at akka.actor.Actor$class.aroundPreRestart(Actor.scala:480)
at akka.actor.UntypedActor.aroundPreRestart(UntypedActor.scala:97)  
at 
akka.actor.dungeon.FaultHandling$class.faultRecreate(FaultHandling.scala:67)
... 17 more
2016-03-07 15:05:42,886 
[AdwordsJobExecutor-akka.actor.default-dispatcher-99] ERROR

com.bonial.megan.execution.actors.bulkCpcChange.mutate.BulkCpcBidChangeActor.apply$mcV$sp([...])
 
at Line 66
None.get



-- 
>>  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.


[akka-user] Re: Open-Source Monitoring Tool - Akka 2.4.2

2016-03-10 Thread Biniam Asnake
In addition to Konrad's answer, you can use StatsD and then stream the data 
to any open source visual monitoring tool like Kibana 
.

I use DataDog  for monitoring (commercial tool) 
which is not 'officially' supported by Typesafe by streaming the StatsD 
data.

On Wednesday, March 9, 2016 at 10:05:37 AM UTC+1, gilad e wrote:
>
> Hey,
> Our team is working with Akka v2.4.2, and I couldn't find any monitoring 
> tool that supports this version.
>
> Is there such a thing already or is it too early?
>
> Thanks,
> Gilad
>

-- 
>>  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.


[akka-user] Re: [akka-http-2.4.2] connection timeouts under load

2016-03-10 Thread lisp pm
My use case is similar to yours. After downgrading from 2.4.2 to 2.0.3, the 
error has gone and everything seems working fine.


On Saturday, March 5, 2016 at 8:25:25 AM UTC-5, Kyrylo Stokoz wrote:
>
> Hi,
>
> I have similar observations after a while server keep accepting requests 
> but they all timeout and nothing gets returned in response.
> I`m using akka http 2.4.2 and streams to create a simple server which 
> handle requests and return files from S3.
>
> In my case i don`t need to do even high load, doing request one after 
> another is enough to hang the server. I played with max connections 
> parameter and increasing it makes app process more requests but eventually 
> it stuck anyway.
>
> From my observation issue is in http connections pool that are not 
> properly releasing connections and when new request comes in runnable graph 
> is created but sinks and sources are not properly connected to start the 
> flow.
>
> During my tests i see (not sure this is related though):
>
> ERROR [datastore-rest-api-akka.actor.default-dispatcher-5] - Error in 
> stage [One2OneBidi]: Inner stream finished before inputs completed. Outputs 
> might have been truncated.
> akka.http.impl.util.One2OneBidiFlow$OutputTruncationException$: Inner 
> stream finished before inputs completed. Outputs might have been truncated.
> ERROR [datastore-rest-api-akka.actor.default-dispatcher-5] - Error in 
> stage [One2OneBidi]: Inner stream finished before inputs completed. Outputs 
> might have been truncated.
> akka.http.impl.util.One2OneBidiFlow$OutputTruncationException$: Inner 
> stream finished before inputs completed. Outputs might have been truncated.
> ERROR [datastore-rest-api-akka.actor.default-dispatcher-5] - Error in 
> stage [One2OneBidi]: Inner stream finished before inputs completed. Outputs 
> might have been truncated.
> akka.http.impl.util.One2OneBidiFlow$OutputTruncationException$: Inner 
> stream finished before inputs completed. Outputs might have been truncated.
> ERROR [datastore-rest-api-akka.actor.default-dispatcher-5] - Error in 
> stage [One2OneBidi]: Inner stream finished before inputs completed. Outputs 
> might have been truncated.
> akka.http.impl.util.One2OneBidiFlow$OutputTruncationException$: Inner 
> stream finished before inputs completed. Outputs might have been truncated.
>  INFO [datastore-rest-api-akka.actor.default-dispatcher-5] - Message 
> [akka.io.Tcp$ResumeReading$] from 
> Actor[akka://datastore-rest-api/user/StreamSupervisor-0/$$a#1262265379] to 
> Actor[akka://datastore-rest-api/system/IO-TCP/selectors/$a/3#-1262857800] 
> was not delivered. [1] dead letters encountered. This logging can be turned 
> off or adjusted with configuration settings 'akka.log-dead-letters' and 
> 'akka.log-dead-letters-during-shutdown'.
>  INFO [datastore-rest-api-akka.actor.default-dispatcher-5] - Message 
> [akka.io.Tcp$ResumeReading$] from 
> Actor[akka://datastore-rest-api/user/StreamSupervisor-0/$$e#585879533] to 
> Actor[akka://datastore-rest-api/system/IO-TCP/selectors/$a/7#1750981790] 
> was not delivered. [2] dead letters encountered. This logging can be turned 
> off or adjusted with configuration settings 'akka.log-dead-letters' and 
> 'akka.log-dead-letters-during-shutdown'.
>
>   
>
>
> On Saturday, March 5, 2016 at 6:03:57 AM UTC-6, Giovanni Alberto 
> Caporaletti wrote:
>>
>> Hi,
>> I'll try to explain what I'm experiencing in my akka-http app.
>> (I found this issue but it's not been updated for almost a year and I'm 
>> not sure it's relevant: https://github.com/akka/akka/issues/17395)
>>
>> I noticed that under load a lot of connections (~1-2%) were dropped or 
>> timed out. I started investigating, tuning os and akka params and trimming 
>> down my sample app until I got this:
>>
>>
>> //N.B.: this is a test
>>
>> implicit val system = ActorSystem()
>> implicit val mat: ActorMaterializer = ActorMaterializer()
>> implicit val ec = system.dispatcher
>>
>> val binding: Future[ServerBinding] = Http().bind("0.0.0.0", 1104).map { conn 
>> ⇒
>> val promise = Promise[Unit]()
>> // I don't even wait for the end of the flow
>> val handler = Flow[HttpRequest].map { _ ⇒ promise.success(()); 
>> HttpResponse() }
>>
>> // to be sure it's not a mapAsync(1) problem I use map and block here, 
>> same result
>> val t0 = System.currentTimeMillis()
>> println(s"${Thread.currentThread().getName} start")
>>
>> conn handleWith handler
>>
>> Await.result(promise.future, 10.seconds)
>> println(s"${Thread.currentThread().getName} end 
>> ${System.currentTimeMillis() - t0}ms");
>>   }.to(Sink.ignore).run()
>>
>> Await.result(binding, 10.seconds)
>>
>>
>>
>> When I run a small test using ab with something like "-c 1000" concurrent 
>> connections or more (even if I'm handling one at a time here), some of the 
>> requests immediately start getting unusual delays:
>>
>> default-akka.actor.default-dispatcher-3 start
>> default-akka.actor.default-dispatcher-3 end 2015ms -> gets