Skip to content

Return GRPC not found error instead of plain one#4860

Merged
crosbymichael merged 1 commit intocontainerd:masterfrom
masters-of-cats:pr-process-not-found-err
Dec 21, 2020
Merged

Return GRPC not found error instead of plain one#4860
crosbymichael merged 1 commit intocontainerd:masterfrom
masters-of-cats:pr-process-not-found-err

Conversation

@danail-branekov
Copy link
Copy Markdown
Contributor

When the shim returns a plain error when a process does not exist,
the server is unable to recognise its GRPC status code and assumes
UnknownError. This is awkward for containerd client users as they are
unable to recognise the actual reason for the error.

When the shim returns a NotFound GRPC error, it is properly translated
by the server and clients receive a proper NotFound error instead of
Unknown

Please note that we (CF Garden) would like to have the eventual fix backported to 1.4 as well.

Co-authored-by: Georgi Sabev [email protected]

@k8s-ci-robot
Copy link
Copy Markdown

Hi @danail-branekov. Thanks for your PR.

I'm waiting for a containerd member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@cpuguy83
Copy link
Copy Markdown
Member

This does not seem like the right place.
If the error isn't being translated it's because the grpc service is not doing the translation.

A quick search for where this might be happening is here:

p, err := container.Process(r.ExecID)
if err != nil {
return nil, err
}
st, err := p.Status(ctx)
if err != nil {
return nil, err
}

Is that inline with the calling context where you are experiencing this?

@danail-branekov
Copy link
Copy Markdown
Contributor Author

danail-branekov commented Dec 17, 2020

This does not seem like the right place.

Quite likely, I don't know that piece of the codebase quite well.

A quick search for where this might be happening is here:

Isn't that the function that is getting the state of a task? Note that we are targeting the use case when we ask a task to load a process with non-existing ID.

We would be happy with whatever fix as long as it passes the TestContainerLoadUnexistingProcess proposed by this PR.

When the shim returns a plain error when a process does not exist,
the server is unable to recognise its GRPC status code and assumes
UnknownError. This is awkward for containerd client users as they are
unable to recognise the actual reason for the error.

When the shim returns a NotFound GRPC error, it is properly translated
by the server and clients receive a proper NotFound error instead of
Unknown

Please note that we (CF Garden) would like to have the eventual fix backported to 1.4 as well.

Co-authored-by: Danail Branekov <[email protected]>

Signed-off-by: Danail Branekov <[email protected]>
Signed-off-by: Georgi Sabev <[email protected]>
@danail-branekov danail-branekov force-pushed the pr-process-not-found-err branch from df8a987 to 7451dd1 Compare December 18, 2020 13:36
@danail-branekov
Copy link
Copy Markdown
Contributor Author

@cpuguy83 We have looked at your suggestion more carefully and it makes lots of sense. We have updated the commit to translate the error to GRPC one in service.go.

Thanks!

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Dec 18, 2020

Build succeeded.

@crosbymichael
Copy link
Copy Markdown
Member

/ok-to-test

Copy link
Copy Markdown
Member

@estesp estesp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cpuguy83
Copy link
Copy Markdown
Member

Unfortunately this isn't fixing the test... and now I'm thinking the test isn't running in CI.

@cpuguy83
Copy link
Copy Markdown
Member

Or maybe it's just my local test env...

Copy link
Copy Markdown
Member

@cpuguy83 cpuguy83 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

It was just my test env.

@crosbymichael
Copy link
Copy Markdown
Member

LGTM

@crosbymichael crosbymichael merged commit dc207b6 into containerd:master Dec 21, 2020
@danail-branekov
Copy link
Copy Markdown
Contributor Author

Thank you for merging the PR. Can we also have it backported to 1.4 please?

@cpuguy83
Copy link
Copy Markdown
Member

Seems fine for a backport. Can you open a pr for it?

@danail-branekov danail-branekov deleted the pr-process-not-found-err branch December 21, 2020 17:15
@danail-branekov
Copy link
Copy Markdown
Contributor Author

Sure, here is the backport PR: #4872

Thanks!

@AkihiroSuda AkihiroSuda added the cherry-picked/1.4.x PR commits are cherry picked into the release/1.4 branch label Dec 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cherry-picked/1.4.x PR commits are cherry picked into the release/1.4 branch ok-to-test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants