Use UnmarshalTo instead of UnmarshalAny when dealing with cgroup metrics.#9195
Use UnmarshalTo instead of UnmarshalAny when dealing with cgroup metrics.#9195alam0rt wants to merge 1 commit into
Conversation
|
Hi @alam0rt. 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 Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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. |
Signed-off-by: Sam Lockart <sam.lockart@zendesk.com>
2a860ef to
9b68866
Compare
|
The unit test below didn't result in any error to me (with v1.7.5). Do you mind running it on your end? |
|
|
||
| data, err := typeurl.UnmarshalAny(stats) | ||
| if err != nil { | ||
| s := &v1.Metrics{} |
There was a problem hiding this comment.
This chunk of code has remained the same in over 4 years now. I am not sure this is anything specific to containerd 1.7.5 like the github issue here mentions #9052 . What version were you previously on? Has there been any changes on your application?
There was a problem hiding this comment.
We are using containerd with kubelet, there's nothing that comes to mind. I'll run this test on a kubelet and let you know
Damn, won't compile on OSX due to build flags. I tried using ctr metrics No issue there. Will continue looking |
|
Some more info: I believe this started occuring after the upgrade to 1.7.0 which I can see is when gogoproto was removed? I added a print to https://github.com/containerd/containerd/blob/fe457eb99ac0e27b3ce638175ef8e68a7d2bc373/vendor/github.com/containerd/typeurl/v2/types.go
|
|
@alam0rt What build of containerd are you using? I was wondering how the types could conflict since a panic will occur with multiple registrations. However, typeurl, gogoproto, and protobuf packages each have their own global registrations. I'm wondering why your build has this type registered while others don't seem to. |
Hey @dmcgowan, we aren't using anything to esoteric I don't think |
|
Any guidance on this would be great - not sure why we are seeing this error considering the code seems fine + we are running a proper release |
|
PR needs rebase. DetailsInstructions 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. |
|
Hi @alam0rt, @dmcgowan, @kiashok, @henry118 I also see that |
|
This PR is stale because it has been open 90 days with no activity. This PR will be closed in 7 days unless new comments are made or the stale label is removed. |
|
This PR was closed because it has been stalled for 7 days with no activity. |
|
I would suggest reopening this pr as the issue still exists and this pr fixes it. Unmarshal
This is due to hcsshim causing the dependency to have both github.com/containerd/cgroups/stats/v1/ and . /vendor/github.com/containerd/cgroups/v3/cgroup1/stats How to reproduce this issue:
steps:
[metrics]
address = "127.0.0.1:7000"
|
|
This pr should rebase though, and it's not the issue in 2.0 because there aren't two v1/stat.Metrics |
|
This PR is stale because it has been open 90 days with no activity. This PR will be closed in 7 days unless new comments are made or the stale label is removed. |
|
Oh my bad I didn't see this get reopened. I'll rebase it if required |
|
Hi @alam0rt , I used a new pr to follow up on this fix and you are the core author. I'm going to close this pr. |
After encountering the issue here: #9052, it appears that the type assertion was failing as the typeof data was an
interface{}despite the concrete type being a pointer tov1.Metrics. We can instead unmarshal the data directly into the expected type variable which appears to work as expected.