Info loss in stack trace make many pain when I try to found err in my code because almost my code is called via actors. Please, fix Fantom or give me workaround.
Early I try to explain this problem but without success #1933. Now I make next try with maximum of details.
Problem of Reduced Stack Trace:
Stack trace is reduced. This make debug hard.
Reducing appears when code is called via send(msg).get.
There is two kinds of errs: good and evil. Good kind have proper stack, evil kind have reduced stack.
This problem not have revelations with disappearing of trace when code called via send without get.
Actual:
There is evil kind of err with reduced stack trace.
Expected:
All of errs have full stack trace as good kind of errs.
Code:
using concurrent
class TraceTest{
static Void main(){
try{
Complicated().methodA
}catch(Err e){
echo("standard stack for methodA (this is call without actors)")
e.trace
}
echo
try{
Complicated().methodB
}catch(Err e){
echo("standard stack for methodB (this is call without actors)")
e.trace
}
echo
try{
ComplicatedActor().methodA
}catch(Err e){
echo("reduced stack of evil err (this is call via actors)")
e.trace
}
echo
try{
ComplicatedActor().methodB
}catch(Err e){
echo("proper stack of good err (this is call via actors)")
e.trace
}
}
}
class Complicated{
Void methodA(){
methodAA
}
Void methodAA(){
methodWithNpe
}
// method with evil kind of err
Void methodWithNpe(){
Str? str
str.capitalize
}
Void methodB(){
methodBB
}
Void methodBB(){
methodWithNullErr
}
// method with good kind of err
Obj methodWithNullErr(){
Str? str
return str
}
}
const class ComplicatedActor : Actor{
new make():super(ActorPool()){
send(null)
}
override Obj? receive(Obj? msg){
if(msg==null){
Actor.locals["complicated"] = Complicated()
}else{
Complicated complicated := Actor.locals["complicated"]
if(msg=="a"){
complicated.methodA
}else if(msg=="b"){
complicated.methodB
}else{
throw Err("Unknown msg")
}
}
return null
}
Void methodA(){
send("a").get
}
Void methodB(){
send("b").get
}
}
I started looking at it this morning, but not finished investigation. Yes I agree it is a probably bug, but want to dig into it some more
brianWed 14 Nov 2012
Promoted to ticket #2054 and assigned to brian
Yes there is some problem in Err.rebase which causes the exception's original actual stack trace to be overwritten by RebaseException
AkcelistoWed 14 Nov 2012
--dancing--
brianMon 20 May 2013
Ticket resolved in 1.0.65
Was sort of a tricky problem b/w how I did exception rebase for actors and how I was storing the actual native exception for things like NPE. But think I have a new design worked out that looks like it works much better.
Akcelisto Sat 10 Nov 2012
Info loss in stack trace make many pain when I try to found err in my code because almost my code is called via actors. Please, fix Fantom or give me workaround.
Early I try to explain this problem but without success #1933. Now I make next try with maximum of details.
Problem of Reduced Stack Trace:
send(msg).get
.send
withoutget
.Actual:
Expected:
Code:
Ouput:
brian Sat 10 Nov 2012
The max depth reported defaults to 20, but you can override with options like this:
Would everyone like to increase depth? Or get rid of it?
Akcelisto Sun 11 Nov 2012
No. No. Plz, look at my examples. None of these are not exceeds max depth.
Look at this trace of evil err. This trace not contains names of methods where errs was raised.
Compare with trace of good err. This trace contains names of methods where errs was raised.
Problem in existence of good and evil errs. All errs must be good.
All errs must have proper stack with names of methods where errs was raised.
Akcelisto Mon 12 Nov 2012
I try to explain the Problem with other words.
There is bug. Look at code, actual output and expected output.
Code:
Actual output:
Expected output:
brian Mon 12 Nov 2012
I started looking at it this morning, but not finished investigation. Yes I agree it is a probably bug, but want to dig into it some more
brian Wed 14 Nov 2012
Promoted to ticket #2054 and assigned to brian
Yes there is some problem in Err.rebase which causes the exception's original actual stack trace to be overwritten by RebaseException
Akcelisto Wed 14 Nov 2012
--dancing--
brian Mon 20 May 2013
Ticket resolved in 1.0.65
Was sort of a tricky problem b/w how I did exception rebase for actors and how I was storing the actual native exception for things like NPE. But think I have a new design worked out that looks like it works much better.