Hi all,

It has been a few years since this was discovered and the warning is still 
present [1] in the docs. Is this advise still the case, and/or are there 
ways to test with optimisation on that we can use to check for this "weird 
behaviour"?

Cheers,
Alessandro

On Friday, April 12, 2013 at 12:20:22 PM UTC-7, Jamie Allen wrote:
>
> I noticed I wasn't getting output to the console when an actor had an 
> exception, and couldn't figure out why.  It turned out I was specifying the 
> "-optimize" scalac flag in my build.sbt.  As a simple example of how to 
> reproduce this, here is a simple build.sbt file:
>  
>
> scalaVersion := "2.9.1"
>
> name := "Akka Logging Test"
>
> scalacOptions += "-optimize"
>
> libraryDependencies +=  "com.typesafe.akka" % "akka-actor" % "2.0.3"
>
>
> And here is some simple code to reproduce:
>
> import akka.actor.OneForOneStrategy
> import akka.actor.SupervisorStrategy._
> import akka.actor.ActorSystem
> import akka.actor.Actor
> import akka.util.duration._
> import akka.actor.Props
> case object Start
> case object MakeCrash
> // Create a supervisor and an actor that dies 5 times in 1 minute, check 
> output in logs
> class MySupervisor extends Actor {
>   override val supervisorStrategy = OneForOneStrategy(maxNrOfRetries = 5, 
> withinTimeRange = 1 minute) {
>     case ae: ArithmeticException => Restart
>   }
>   def child = context.actorOf(Props[MyChild])
>   def receive = {
>     case Start => child ! MakeCrash
>   }
> }
> class MyChild extends Actor {
>   def receive = {
>     case MakeCrash => 1 / 0
>   }
> }
> object TestBootstrap extends App {
>   val system = ActorSystem()
>   val supervisor = system.actorOf(Props[MySupervisor])
>   supervisor ! Start
>   Thread.sleep(2000)
>   supervisor ! Start
>   Thread.sleep(2000)
>   supervisor ! Start
>   Thread.sleep(2000)
>   supervisor ! Start
>   Thread.sleep(2000)
>   supervisor ! Start
>   Thread.sleep(2000)
>   // Should be dead now
>   supervisor ! Start
>   Thread.sleep(2000)
>   system.shutdown
> }
>
> To fix the problem, just remove the scalacOptions from the build.sbt file.
>
>

-- 
>>>>>>>>>>      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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to