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

upgrade modern-go/reflect2 to fix nil panic under go 1.18 #1849

Merged
merged 2 commits into from Aug 15, 2022

Conversation

2uasimojo
Copy link
Member

@2uasimojo 2uasimojo commented Aug 11, 2022

Early hive-operator crash with stack trace like:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x123e5fc]

goroutine 1347 [running]:
reflect.mapiternext(0x123946f?)
	runtime/map.go:1378 +0x19
github.com/modern-go/reflect2.(*UnsafeMapIterator).UnsafeNext(0x300b1f1?)
	github.com/modern-go/reflect2@v1.0.1/unsafe_map.go:136 +0x32
github.com/json-iterator/go.(*mapEncoder).Encode(0xc005472bd0, 0xc00098d3e0, 0xc002f7a240)
	github.com/json-iterator/go@v1.1.11/reflect_map.go:262 +0x3c5
github.com/json-iterator/go.(*placeholderEncoder).Encode(0x2ed0f40?, 0xc000175701?, 0xc002f7a258?)
	github.com/json-iterator/go@v1.1.11/reflect.go:332 +0x22
github.com/json-iterator/go.(*structFieldEncoder).Encode(0xc007f11410, 0x2d32120?, 0xc002f7a240)
	github.com/json-iterator/go@v1.1.11/reflect_struct_encoder.go:110 +0x56
github.com/json-iterator/go.(*structEncoder).Encode(0xc007f11a10, 0x0?, 0xc002f7a240)
	github.com/json-iterator/go@v1.1.11/reflect_struct_encoder.go:158 +0x765
github.com/json-iterator/go.(*OptionalEncoder).Encode(0xc000a34a00?, 0x0?, 0x0?)
	github.com/json-iterator/go@v1.1.11/reflect_optional.go:70 +0xa4
github.com/json-iterator/go.(*onePtrEncoder).Encode(0xc005403d60, 0xc00098d2c0, 0xc0007a7230?)
	github.com/json-iterator/go@v1.1.11/reflect.go:219 +0x82
github.com/json-iterator/go.(*Stream).WriteVal(0xc002f7a240, {0x32e56c0, 0xc00098d2c0})
	github.com/json-iterator/go@v1.1.11/reflect.go:98 +0x158
github.com/json-iterator/go.(*frozenConfig).Marshal(0xc000a34a00, {0x32e56c0, 0xc00098d2c0})
	github.com/json-iterator/go@v1.1.11/config.go:299 +0xc9
github.com/openshift/hive/pkg/resource.(*jsonPrinter).PrintObj(0xc000317030?, {0x36bc250?, 0xc00098d2c0?}, {0x36b1420, 0xc003617c20})
	github.com/openshift/hive/pkg/resource/serializer.go:59 +0x49
k8s.io/cli-runtime/pkg/printers.(*TypeSetterPrinter).PrintObj(0xc002eba020, {0x36bc250, 0xc00098d2c0}, {0x36b1420, 0xc003617c20})
	k8s.io/cli-runtime@v0.22.0/pkg/printers/typesetter.go:71 +0x2d2
github.com/openshift/hive/pkg/resource.Serialize({0x36bc250, 0xc00098d2c0}, 0xc000317030)
	github.com/openshift/hive/pkg/resource/serializer.go:79 +0x118
github.com/openshift/hive/pkg/resource.(*helper).ApplyRuntimeObject(0xc000b33800, {0x36bc250?, 0xc00098d2c0?}, 0x7fbb5a929108?)
	github.com/openshift/hive/pkg/resource/apply.go:72 +0x35
github.com/openshift/hive/pkg/operator/util.ApplyRuntimeObjectWithGC({0x36da4b0, 0xc000b33800}, {0x36bc250?, 0xc00098d2c0}, 0xc0024b0f00)
	github.com/openshift/hive/pkg/operator/util/apply.go:108 +0x1a5
github.com/openshift/hive/pkg/operator/hive.(*ReconcileHiveConfig).deployAWSPrivateLinkConfigMap(0xc0004d62d0?, {0x36e24d0, 0xc0024ae5b0}, {0x36da4b0, 0xc000b33800}, 0xc0024b0f00)
	github.com/openshift/hive/pkg/operator/hive/awsprivatelink.go:40 +0x199
github.com/openshift/hive/pkg/operator/hive.(*ReconcileHiveConfig).Reconcile(0xc0004d62d0, {0x36d3e28?, 0xc0027fc390?}, {{{0x0?, 0x0?}, {0xc001502f00?, 0x4?}}})
	github.com/openshift/hive/pkg/operator/hive/hive_controller.go:410 +0x1c31
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile(0xc000ada320, {0x36d3e28, 0xc0027fc300}, {{{0x0?, 0x3186b20?}, {0xc001502f00?, 0xc00137ce40?}}})
	sigs.k8s.io/controller-runtime@v0.10.2/pkg/internal/controller/controller.go:114 +0x222
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler(0xc000ada320, {0x36d3d80, 0xc000a88100}, {0x300a5a0?, 0xc0007a8320?})
	sigs.k8s.io/controller-runtime@v0.10.2/pkg/internal/controller/controller.go:311 +0x2e9
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem(0xc000ada320, {0x36d3d80, 0xc000a88100})
	sigs.k8s.io/controller-runtime@v0.10.2/pkg/internal/controller/controller.go:266 +0x1d9
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2()
	sigs.k8s.io/controller-runtime@v0.10.2/pkg/internal/controller/controller.go:227 +0x85
created by sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2
	sigs.k8s.io/controller-runtime@v0.10.2/pkg/internal/controller/controller.go:223 +0x307

Seems to be an artifact of building with github.com/modern-go/reflect2 <
v1.0.2 under go 1.18 (but not go1.17).

HIVE-1997

@2uasimojo
Copy link
Member Author

/assign @suhanime

@openshift-ci openshift-ci bot requested review from dgoodwin and twiest August 11, 2022 14:39
@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 11, 2022
@2uasimojo
Copy link
Member Author

I suppose perhaps we should update CI for this branch to use go1.18?

@suhanime
Copy link
Contributor

I suppose perhaps we should update CI for this branch to use go1.18?

Yes - we need to ensure it works with go1.18

@2uasimojo
Copy link
Member Author

Yes - we need to ensure it works with go1.18

I validated that locally, but yeah. I'll need to put up a separate PR to make CI refresh to 1.18 -- it's kind of a painful process :(

Needed for HIVE-1997
@2uasimojo
Copy link
Member Author

separate PR to make CI refresh to 1.18

#1850

Early hive-operator crash with stack trace like:

```
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x123e5fc]

goroutine 1347 [running]:
reflect.mapiternext(0x123946f?)
	runtime/map.go:1378 +0x19
github.com/modern-go/reflect2.(*UnsafeMapIterator).UnsafeNext(0x300b1f1?)
	github.com/modern-go/reflect2@v1.0.1/unsafe_map.go:136 +0x32
github.com/json-iterator/go.(*mapEncoder).Encode(0xc005472bd0, 0xc00098d3e0, 0xc002f7a240)
	github.com/json-iterator/go@v1.1.11/reflect_map.go:262 +0x3c5
github.com/json-iterator/go.(*placeholderEncoder).Encode(0x2ed0f40?, 0xc000175701?, 0xc002f7a258?)
	github.com/json-iterator/go@v1.1.11/reflect.go:332 +0x22
github.com/json-iterator/go.(*structFieldEncoder).Encode(0xc007f11410, 0x2d32120?, 0xc002f7a240)
	github.com/json-iterator/go@v1.1.11/reflect_struct_encoder.go:110 +0x56
github.com/json-iterator/go.(*structEncoder).Encode(0xc007f11a10, 0x0?, 0xc002f7a240)
	github.com/json-iterator/go@v1.1.11/reflect_struct_encoder.go:158 +0x765
github.com/json-iterator/go.(*OptionalEncoder).Encode(0xc000a34a00?, 0x0?, 0x0?)
	github.com/json-iterator/go@v1.1.11/reflect_optional.go:70 +0xa4
github.com/json-iterator/go.(*onePtrEncoder).Encode(0xc005403d60, 0xc00098d2c0, 0xc0007a7230?)
	github.com/json-iterator/go@v1.1.11/reflect.go:219 +0x82
github.com/json-iterator/go.(*Stream).WriteVal(0xc002f7a240, {0x32e56c0, 0xc00098d2c0})
	github.com/json-iterator/go@v1.1.11/reflect.go:98 +0x158
github.com/json-iterator/go.(*frozenConfig).Marshal(0xc000a34a00, {0x32e56c0, 0xc00098d2c0})
	github.com/json-iterator/go@v1.1.11/config.go:299 +0xc9
github.com/openshift/hive/pkg/resource.(*jsonPrinter).PrintObj(0xc000317030?, {0x36bc250?, 0xc00098d2c0?}, {0x36b1420, 0xc003617c20})
	github.com/openshift/hive/pkg/resource/serializer.go:59 +0x49
k8s.io/cli-runtime/pkg/printers.(*TypeSetterPrinter).PrintObj(0xc002eba020, {0x36bc250, 0xc00098d2c0}, {0x36b1420, 0xc003617c20})
	k8s.io/cli-runtime@v0.22.0/pkg/printers/typesetter.go:71 +0x2d2
github.com/openshift/hive/pkg/resource.Serialize({0x36bc250, 0xc00098d2c0}, 0xc000317030)
	github.com/openshift/hive/pkg/resource/serializer.go:79 +0x118
github.com/openshift/hive/pkg/resource.(*helper).ApplyRuntimeObject(0xc000b33800, {0x36bc250?, 0xc00098d2c0?}, 0x7fbb5a929108?)
	github.com/openshift/hive/pkg/resource/apply.go:72 +0x35
github.com/openshift/hive/pkg/operator/util.ApplyRuntimeObjectWithGC({0x36da4b0, 0xc000b33800}, {0x36bc250?, 0xc00098d2c0}, 0xc0024b0f00)
	github.com/openshift/hive/pkg/operator/util/apply.go:108 +0x1a5
github.com/openshift/hive/pkg/operator/hive.(*ReconcileHiveConfig).deployAWSPrivateLinkConfigMap(0xc0004d62d0?, {0x36e24d0, 0xc0024ae5b0}, {0x36da4b0, 0xc000b33800}, 0xc0024b0f00)
	github.com/openshift/hive/pkg/operator/hive/awsprivatelink.go:40 +0x199
github.com/openshift/hive/pkg/operator/hive.(*ReconcileHiveConfig).Reconcile(0xc0004d62d0, {0x36d3e28?, 0xc0027fc390?}, {{{0x0?, 0x0?}, {0xc001502f00?, 0x4?}}})
	github.com/openshift/hive/pkg/operator/hive/hive_controller.go:410 +0x1c31
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile(0xc000ada320, {0x36d3e28, 0xc0027fc300}, {{{0x0?, 0x3186b20?}, {0xc001502f00?, 0xc00137ce40?}}})
	sigs.k8s.io/controller-runtime@v0.10.2/pkg/internal/controller/controller.go:114 +0x222
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler(0xc000ada320, {0x36d3d80, 0xc000a88100}, {0x300a5a0?, 0xc0007a8320?})
	sigs.k8s.io/controller-runtime@v0.10.2/pkg/internal/controller/controller.go:311 +0x2e9
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem(0xc000ada320, {0x36d3d80, 0xc000a88100})
	sigs.k8s.io/controller-runtime@v0.10.2/pkg/internal/controller/controller.go:266 +0x1d9
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2()
	sigs.k8s.io/controller-runtime@v0.10.2/pkg/internal/controller/controller.go:227 +0x85
created by sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2
	sigs.k8s.io/controller-runtime@v0.10.2/pkg/internal/controller/controller.go:223 +0x307
```

Seems to be an artifact of building with github.com/modern-go/reflect2 <
v1.0.2 under go 1.18 (but not go1.17).

HIVE-1997
@codecov
Copy link

codecov bot commented Aug 11, 2022

Codecov Report

Merging #1849 (1660193) into ocm-2.4 (74831db) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff            @@
##           ocm-2.4    #1849   +/-   ##
========================================
  Coverage    41.63%   41.63%           
========================================
  Files          336      336           
  Lines        30615    30615           
========================================
  Hits         12747    12747           
  Misses       16782    16782           
  Partials      1086     1086           

@2uasimojo
Copy link
Member Author

/test e2e
/test e2e-gcp
/test e2e-pool

@2uasimojo
Copy link
Member Author

/test e2e

This is using a cached result, but I can't seem to delete the build :(

@2uasimojo
Copy link
Member Author

/test e2e

@2uasimojo
Copy link
Member Author

/retest

@suhanime
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Aug 15, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 15, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 2uasimojo, suhanime

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 15, 2022

@2uasimojo: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-gcp 1660193 link false /test e2e-gcp

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@openshift-merge-robot openshift-merge-robot merged commit ba51985 into openshift:ocm-2.4 Aug 15, 2022
@2uasimojo 2uasimojo deleted the ocm-2.4 branch August 15, 2022 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants