Errors thrown out of actors are not printed until a "get". We have talked about this before but a solution to this will save time when debugging such code. maybe a flag on startup? Here's a simplified version
using concurrent
class ActorTest{
Void main(){
Actor(ActorPool()){
throw Err()
}.send(null)
Actor.sleep(5sec)
}
}
brianSat 30 Jun 2012
A flag on startup for debug might be useful, but I don't think it would work in practice. In a real system, you might have 100s of exceptions getting thrown often as just normal flow of behavior. In most cases they are getting caught by client and handled. If you logged everyone one of those even with a flag I think it would be too noisy. The trick would be to figure out a way to log only those messages that don't get accessed by a Future.
SlimerDudeSat 30 Jun 2012
Okay, an admission of guilt - all my Actors extend the following:
const class AfActor : Actor {
private const static Log log := Log.get("AfActor")
new make(ActorPool pool, Str stashName) : super(pool) { }
Obj? get(|Obj?->Obj?| f) {
return send(f).get
}
override Obj? receive(Obj? msg) {
func := (msg as |Obj?->Obj?|)
try {
return func.call(this)
} catch (Err e) {
// if the func has a return type, then an the Err is rethrown on assignment
// else we log the Err so the Thread doesn't fail silently
if (func.returns == Void#)
log.err("AfActor receive()", e)
throw e
}
}
}
so I can send / run / return code within the global thread space. But note my receive function logs errors if the calling function doesn't have a return value.
Steve.
AkcelistoSun 1 Jul 2012
No. I writed not about err stack is printed only if get is called.
Look at my example code. I call get and stack is printed. But stack is reduced.
Akcelisto Fri 29 Jun 2012
Why actors do not print stack trace? This lead to redundant code.
Akcelisto Fri 29 Jun 2012
Oops. Stack is printed. But there is case when not printed:
kaushik Sat 30 Jun 2012
Errors thrown out of actors are not printed until a "get". We have talked about this before but a solution to this will save time when debugging such code. maybe a flag on startup? Here's a simplified version
brian Sat 30 Jun 2012
A flag on startup for debug might be useful, but I don't think it would work in practice. In a real system, you might have 100s of exceptions getting thrown often as just normal flow of behavior. In most cases they are getting caught by client and handled. If you logged everyone one of those even with a flag I think it would be too noisy. The trick would be to figure out a way to log only those messages that don't get accessed by a Future.
SlimerDude Sat 30 Jun 2012
Okay, an admission of guilt - all my Actors extend the following:
meaning my Actors look like:
so I can send / run / return code within the global thread space. But note my
receive
function logs errors if the calling function doesn't have a return value.Steve.
Akcelisto Sun 1 Jul 2012
No. I writed not about err stack is printed only if
get
is called.Look at my example code. I call
get
and stack is printed. But stack is reduced.This depend on which type exception is throwed.