Getting "dead letters encountered" using spray client

512 views Asked by At

I'm writing simple spray client code:

 // ActorSystem("main-actor-system") initialized earlier in code
implicit val system = actorSystem 
implicit val execctx: scala.concurrent.ExecutionContext = system.dispatcher
implicit val timeout = Timeout(10.seconds)

val pipeline: Future[pipelining.WithTransformerConcatenation[HttpRequest, Future[String]]] = 
for ( Http.HostConnectorInfo(connector, _) <-
     IO(Http) ? Http.HostConnectorSetup("myservicehost", port = 80)  
) yield sendReceive(connector) ~> unmarshal[String]

Await.ready(pipeline, 10 seconds)

// this is quite brute forse, what is better way?
val pl = pipeline.value.get.get

val response: Future[String] = pl { Get("/status")}
private val result: String = Await.result(response, 10 seconds)
response.foreach(r => println("result" + result))

Each time I'm running this code I'm getting

[INFO] [02/17/2016 15:31:15.596] [main-actor-system-akka.actor.default-dispatcher-3] [akka://main-actor-system/system/IO-TCP/selectors/$a/0] Message [akka.io.Tcp$Close$] from Actor[akka://main-actor-system/user/IO-HTTP/group-0/0#-1771046370] to Actor[akka://main-actor-system/system/IO-TCP/selectors/$a/0#1352725834] 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'.

What should I do to fix that?

1

There are 1 answers

1
expert On

It's not necessarily a problem. Here is snippet from documentation.

By default messages sent to dead letters are logged at info level. Existence of dead letters does not necessarily indicate a problem, but it might be, and therefore they are logged by default. After a few messages this logging is turned off, to avoid flooding the logs. You can disable this logging completely or adjust how many dead letters that are logged. During system shutdown it is likely that you see dead letters, since pending messages in the actor mailboxes are sent to dead letters. You can also disable logging of dead letters during shutdown.

I ignore them on startup of my server.