ajonat
ajonat

Reputation: 69

Akka timeouts starting event handlers

When I run my app using akka, it fails with the following exception:

Event Handler specified in config can't be loaded [com.despegar.hasp.impl.DummyLogEventHandler] due to [a06c8d75-0f07-40db-883a-16dc2914934bakka.event.Logging$LoggerInitializationException: Logger log1-DummyLogEventHandler did not respond with LoggerInitialized, sent instead [TIMEOUT]

DummyLogEventHandler is defined as:

class DummyLogEventHandler extends Actor {
   def receive = {
     case InitializeLogger(_) => sender ! LoggerInitialized
     case Error(cause, logSource, logClass, message) =>
     case Warning(logSource, logClass, message) =>
     case Info(logSource, logClass, message) =>
     case Debug(logSource, logClass, message) =>
   }

}

My configuration has the following lines:

event-handlers = ["my.app.DummyLogEventHandler"]
event-handler-startup-timeout = 15s

But I've also tried with the default logger:

event-handlers = []

and with slf4j (my app is using the logback backend and logging works ok):

event-handlers = ["akka.event.slf4j.Slf4jEventHandler"]

Neither of those event-handlers nor incrementing the timeout to 60 seconds have worked so far. Moreover, the timeout is thrown sporadically. When I ran a test suite, the exception is thrown in different tests every time.

Can you help me find a solution?

Thanks, Alex.

Upvotes: 2

Views: 3107

Answers (3)

James
James

Reputation: 560

In my case, adding the timeout setting in conf does not work, but setting system property directly like below works.

System.setProperty("akka.logger-startup-timeout", "30s")

Upvotes: 0

Nimrod007
Nimrod007

Reputation: 9913

Try to set a larger timeout for the logger initialization :

For example in the conf file :

     akka {logger-startup-timeout = 25s }

checkout the doc

http://doc.akka.io/docs/akka/snapshot/general/configuration.html

Upvotes: 3

Roland Kuhn
Roland Kuhn

Reputation: 15472

After discussion on akka-user the following was found.

This problem is a symptom of configuring the akka.actor.default-dispatcher to be of type = BalancingDispatcher, which cannot work, see the docs for that dispatcher type:

  • All the actors share a single Mailbox that they get their messages from.

  • It is assumed that all actors using the same instance of this dispatcher can process all messages that have been sent to one of the actors; i.e. the actors belong to a pool of actors, and to the client there is no guarantee about which actor instance actually processes a given message.

  • Sharability: Actors of the same type only

Upvotes: 1

Related Questions