Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ShimCall error handling is full of dragons #3548

Closed
Kubuxu opened this issue Sep 4, 2020 · 6 comments
Closed

ShimCall error handling is full of dragons #3548

Kubuxu opened this issue Sep 4, 2020 · 6 comments
Assignees

Comments

@Kubuxu
Copy link
Contributor

Kubuxu commented Sep 4, 2020

We should not be using numerical exit codes there

lotus/chain/vm/runtime.go

Lines 111 to 148 in a081dc7

func (rt *Runtime) shimCall(f func() interface{}) (rval []byte, aerr aerrors.ActorError) {
defer func() {
if r := recover(); r != nil {
if ar, ok := r.(aerrors.ActorError); ok {
log.Warnf("VM.Call failure: %+v", ar)
aerr = ar
return
}
//log.Desugar().WithOptions(zap.AddStacktrace(zapcore.ErrorLevel)).
//Sugar().Errorf("spec actors failure: %s", r)
log.Errorf("spec actors failure: %s", r)
aerr = aerrors.Newf(1, "spec actors failure: %s", r)
}
}()
ret := f()
if !rt.callerValidated {
rt.Abortf(exitcode.SysErrorIllegalActor, "Caller MUST be validated during method execution")
}
switch ret := ret.(type) {
case []byte:
return ret, nil
case *adt.EmptyValue:
return nil, nil
case cbg.CBORMarshaler:
buf := new(bytes.Buffer)
if err := ret.MarshalCBOR(buf); err != nil {
return nil, aerrors.Absorb(err, 2, "failed to marshal response to cbor")
}
return buf.Bytes(), nil
case nil:
return nil, nil
default:
return nil, aerrors.New(3, "could not determine type for response from call")
}
}

@arajasek
Copy link
Contributor

arajasek commented Sep 7, 2020

@Kubuxu Duplicate of / subsumed by #3015 maybe?

@raulk
Copy link
Member

raulk commented Sep 7, 2020

@alanshaw is tackling this one, in the context of the test failures he found. @alanshaw, mind elaborating on what you're doing here?

@raulk
Copy link
Member

raulk commented Sep 7, 2020

@Kubuxu also, mind quickly listing the dragons here (besides the numerical exit code use)?

@Kubuxu
Copy link
Contributor Author

Kubuxu commented Sep 7, 2020

Yeah, it is mostly the numerical exit codes that are completely wrong.
We will also need to figure out an exit code for the non-actor panic.

@alanshaw
Copy link
Member

alanshaw commented Sep 9, 2020

I'm hoping that #3697 is an ok solution for one of these numerical exit codes 🤞

@arajasek arajasek mentioned this issue Sep 30, 2020
21 tasks
@magik6k
Copy link
Contributor

magik6k commented Jul 31, 2023

No longer relevant in the FVM world

@magik6k magik6k closed this as completed Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants