Skip to content

expose IsOperationAccessIsDenied, IsOperationInvalidState error checks#457

Closed
andrey-ko wants to merge 1 commit intomicrosoft:masterfrom
andrey-ko:ext-errors
Closed

expose IsOperationAccessIsDenied, IsOperationInvalidState error checks#457
andrey-ko wants to merge 1 commit intomicrosoft:masterfrom
andrey-ko:ext-errors

Conversation

@andrey-ko
Copy link

on RS1, RS2 builds call to GetContainers may fail with 'access denied' or
'invalid state' errors. You may want to have retry loop to resolve this
issue. But there should be a way to check if returned error is one of these
types. This commit exposes IsOperationAccessIsDenied and IsOperationInvalidState
for these cases.
one use case may be found here: https://github.com/moby/moby/blob/5ec31380a5d3ea92fc68e53cd1fc96f11ac02e6e/daemon/graphdriver/windows/windows.go#L276

@msftclas
Copy link

msftclas commented Jan 19, 2019

CLA assistant check
All CLA requirements met.

on RS1, RS2 builds call to GetContainers may fail with 'access denied' or
'invalid state' errors. You may want to have retry loop to resolve this
issue. But there should be a way to check if returned error is one of these
types. This commit exposes IsOperationAccessIsDenied and IsOperationInvalidState
for these cases.

Signed-off-by: Andrey Kolomentsev <andrey.kolomentsev@gmail.com>
@jterry75
Copy link
Contributor

@jhowardmsft - This is not breaking to V1. I am ok with forwarding these interfaces you?

@lowenna
Copy link
Contributor

lowenna commented Jan 23, 2019

I'm confused - did we break the previous error detection somehow?

@andrey-ko
Copy link
Author

andrey-ko commented Jan 23, 2019

@jhowardmsft yes it was broken. Before GetContainers was returning syscall.Errno. But after this commit e70197a#diff-ece1473ec5e6e5832bc471a16557a457L157 it was wrapped with HcsError type. And after it this retry loop https://github.com/moby/moby/blob/5ec31380a5d3ea92fc68e53cd1fc96f11ac02e6e/daemon/graphdriver/windows/windows.go#L276 stopped working

More specifically condition err == hcsshim.ErrVmcomputeOperationAccessIsDenied is always false now because err is of hcs.HcsError type now, not syscall.Errno as it was before

@jterry75
Copy link
Contributor

@jstarks
Copy link
Member

jstarks commented Jan 24, 2019

Perhaps we should have the root package pull the syscall.Errno back out for compatibility, so that code using the internal packages can continue to get the rich error information.

@jterry75
Copy link
Contributor

@jhowardmsft - Assigning to you.

@thaJeztah
Copy link
Contributor

thaJeztah commented Jan 30, 2019

Wondering if hcsshim should define some standard interfaces (see
moby/moby#38580 (comment)), and possibly use a Causer interface (https://godoc.org/github.com/pkg/errors#hdr-Retrieving_the_cause_of_an_error) to provide access to the underlying errors

The current getInnerError() approach looks like it may be hard to maintain (keeping it in sync with any possible error-type)

@jterry75
Copy link
Contributor

@thaJeztah - I had the same thought. Unfortunately however these are breaking changes and need to be undone. But I agree that long term exposing the syscall error's with a Causer interface is the ideal approach.

@thaJeztah
Copy link
Contributor

@ddebroy PTAL; looks like this needs a carry

@jterry75 jterry75 closed this Aug 21, 2019
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

Successfully merging this pull request may close these issues.

6 participants