Skip to content

Conversation

@jseba
Copy link

@jseba jseba commented Apr 6, 2021

When using the client pull API, Client.Pull, I'm noticing that if the context is canceled, for instance, due to a SIGINT, there is a spurious log message "failed to cleanup" with the error "context canceled". This is coming from the unpacker.

I'd like to silence this log message if the cleanup fails because of a context canceled or timeout. The three places where this happens will already return a context.Canceled error, which bubbles up to the API caller.

@k8s-ci-robot
Copy link

Hi @jseba. 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.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Apr 6, 2021

Build succeeded.

@ktock
Copy link
Member

ktock commented Apr 6, 2021

I'd like to silence this log message

Why?

The three places where this happens will already return a context.Canceled error, which bubbles up to the API caller.

This is not true if the cancel occurs during executing Remove.

The following also doesn't bubble up "context cancelled" error.

		if diff.Digest != diffIDs[i] {
			abort()
			return errors.Errorf("wrong diff id calculated on extraction %q", diffIDs[i])
		}

@jseba
Copy link
Author

jseba commented Apr 7, 2021

I'd like to silence this log message

Why?

When using the client API, if our process gets a SIGINT, we cancel the context and handle the errors that result from that. However, we're getting this extra log message that shows up in our metrics as an extra error.

I would like to be able to handle this error in our process but I'm not seeing a way to do that other than just silencing it. I'm open to any suggestions to implement something that allows the caller to receive this error and decide what to do with it.

The three places where this happens will already return a context.Canceled error, which bubbles up to the API caller.

This is not true if the cancel occurs during executing Remove.

The following also doesn't bubble up "context cancelled" error.

		if diff.Digest != diffIDs[i] {
			abort()
			return errors.Errorf("wrong diff id calculated on extraction %q", diffIDs[i])
		}

Ah, I missed that, thanks for pointing that out. I was definitely thinking this seemed on the fragile side and wasn't sure what machinery and other things I was missing.

abort := func() {
if err := sn.Remove(ctx, key); err != nil {
log.G(ctx).WithError(err).Errorf("failed to cleanup %q", key)
if !errdefs.IsCanceled(err) && !errdefs.IsDeadlineExceeded(err) {
Copy link
Member

Choose a reason for hiding this comment

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

IsDeadlineExceeded means that there was a timeout when removing snapshot. I'm not sure we should ignore error in this case.

@dmcgowan
Copy link
Member

dmcgowan commented Apr 8, 2021

It may be more appropriate to change this to Warn. It is relevant information that the snapshot was not removed, whether or not that is because it was cancelled does not change the value of that information. I agree it does not need to be considered an error since the snapshot may be removed by other means. However, until it is removed, that key is unavailable and this log indicates that.

@kzys kzys added the status/needs-update Awaiting contributor update label Jul 2, 2021
@dmcgowan
Copy link
Member

Handled in #7859

@dmcgowan dmcgowan closed this Dec 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ok-to-test status/needs-update Awaiting contributor update

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

6 participants