scala - How to fix the Dropping Close since the SSL connection is already closing error in spray -


i’m making call api, of time keep getting error: “dropping close since ssl connection closing” , “premature connection close (the server doesn't appear support request pipelining)”. 90% of time error, meaning: in rare occasions query return data supposed to.

to make sure wasn’t api’s server issue, replicate exact same query using node.js (express , request libs) , works every time. makes me sure spray bug.

here's example of code:

case class myclass(user: string, pass: string)  class myactor extends actor {   import spray.client.pipelining._   import spray.http.basichttpcredentials   import spray.http.{httprequest,httpresponse}   import scala.concurrent.future    import context.dispatcher    def receive = {     case myclass: myclass => {       val credentials: basichttpcredentials = basichttpcredentials(myclass.user, myclass.pass)       val url: string = "https://myapi?params=values"       val request: httprequest = get(url) ~> addcredentials(credentials)       val pipeline = sendreceive       val response: future[httpresponse] = pipeline(request)       val finalres: future[string] = response.map{ r =>         println(r)         r.entity.asstring       }       finalres pipeto sender     }   } // end receive } //end actor 

error detail:

04/01 10:19:05 debug[on-spray-can-akka.actor.default-dispatcher-8] a.i.tcpoutgoingconnection - attempting connection ... 04/01 10:19:05 debug[on-spray-can-akka.actor.default-dispatcher-6] a.i.tcpoutgoingconnection - connection established ... 04/01 10:19:05 debug[on-spray-can-akka.actor.default-dispatcher-6] s.c.c.httpclientconnection - connected ... 04/01 10:19:05 debug[on-spray-can-akka.actor.default-dispatcher-9] s.c.c.httphostconnectionslot - connection ... established, dispatching 1 pending requests 04/01 10:19:05 debug[on-spray-can-akka.actor.default-dispatcher-3] s.c.c.httpclientconnection - monitoring actor[akka://on-spray-can/system/io-tcp/selectors/$a/5] 04/01 10:19:05 debug[on-spray-can-akka.actor.default-dispatcher-6] s.c.c.httphostconnectionslot - dispatching request /api?params=values across connection actor[akka://on-spray-can/user/io-http/group-0/4] 04/01 10:19:05 debug[on-spray-can-akka.actor.default-dispatcher-6] s.c.c.httphostconnectionslot - monitoring actor[akka://on-spray-can/user/io-http/group-0/4] 04/01 10:19:06 debug[on-spray-can-akka.actor.default-dispatcher-3] s.c.c.httpclientconnection - dropping close since ssl connection closing 04/01 10:19:06 debug[on-spray-can-akka.actor.default-dispatcher-3] s.c.c.httpclientconnection - connection peerclosed, awaiting tcpconnection termination... 04/01 10:19:06 debug[on-spray-can-akka.actor.default-dispatcher-3] a.i.tcpoutgoingconnection - stopped 04/01 10:19:06 debug[on-spray-can-akka.actor.default-dispatcher-3] s.c.c.httpclientconnection - tcpconnection terminated, stopping 04/01 10:19:06 warn [on-spray-can-akka.actor.default-dispatcher-3] s.c.c.httphostconnectionslot - premature connection close (the server doesn't appear support request pipelining) in response request /myapi?params=values 1 retries left, retrying... 04/01 10:19:06 debug[on-spray-can-akka.actor.default-dispatcher-3] s.c.c.httpclientconnection - stopped 

and able reproduce error in of these versions:

spray 1.0.1; akka 2.0.5; scala 2.9.3 spray 1.2.1; akka 2.2.4; scala 2.10.1 spray 1.3.1; akka 2.3.0; scala 2.10.3 spray 1.3.2; akka 2.3.6; scala 2.11.4 spray 1.3.3; akka 2.3.9; scala 2.11.6 


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -