#2063 Exceptions withing Actor functions are not thrown / propagated / traced

tcolar Tue 20 Nov 2012

Seems that when there is an error in an actor function, it often fails silenttly.

For example given this code (dummy example):

using fwt
using concurrent
class Test
{
   Void main()
   {
      Actor(ActorPool()) |Obj? params -> Obj?|
      {
            echo("step1")
     u := (Unsafe) params
     lbl := (Int) u.val  // u.val in not an Int so fails
     echo("step2")
     return null
      }.send(Unsafe(Label{}))
    }
}

It fails because the cast to Int fails, but I get no error or trace and execution just stops where it failed (never prints step2)

I've ran into that several times and it can be quite time consuming to find the cause due to the lack of error trace.

brian Sun 25 Nov 2012

That problem has been discussed many times before - only the caller will see the exception when they try to access the Future's result. And since we don't know when/if the Future will be checked, we can't just go logging every raised exception. So I think that case, you need to wrap you message handler in a try/block and log the errors

Login or Signup to reply.