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

fix: nil pointer dereference in conversion webhook #787

Merged
merged 1 commit into from
Feb 26, 2024

Conversation

drivebyer
Copy link
Collaborator

Description
The operator log show:

2024/02/19 03:12:45 http: panic serving 10.6.231.10:55106: runtime error: invalid memory address or nil pointer dereference
goroutine 2997 [running]:
net/http.(*conn).serve.func1()
    /usr/local/go/src/net/http/server.go:1868 +0xb9
panic({0x194d4a0?, 0x2be6c70?})
    /usr/local/go/src/runtime/panic.go:920 +0x270
github.com/OT-CONTAINER-KIT/redis-operator/api/v1beta1.(*RedisSentinel).ConvertFrom(0xc000345a00, {0x1e4f3e8?, 0xc0006f6b40})
    /workspace/api/v1beta1/redissentinel_conversion.go:125 +0x4cb
sigs.k8s.io/controller-runtime/pkg/webhook/conversion.(*webhook).convertObject(0xc00004ef20?, {0x1e48f10, 0xc0006f6b40}, {0x1e49258, 0xc000345a00})
    /go/pkg/mod/sigs.k8s.io/[email protected]/pkg/webhook/conversion/conversion.go:140 +0x376
sigs.k8s.io/controller-runtime/pkg/webhook/conversion.(*webhook).handleConvertRequest(0xc00004ef20, 0xc000963000)
    /go/pkg/mod/sigs.k8s.io/[email protected]/pkg/webhook/conversion/conversion.go:105 +0x1c5
sigs.k8s.io/controller-runtime/pkg/webhook/conversion.(*webhook).ServeHTTP(0x1e44b00?, {0x7f603ce4ad30?, 0xc0001c0730}, 0xc0008fea00)
    /go/pkg/mod/sigs.k8s.io/[email protected]/pkg/webhook/conversion/conversion.go:72 +0xf6
sigs.k8s.io/controller-runtime/pkg/webhook/internal/metrics.InstrumentedHook.InstrumentHandlerInFlight.func1({0x7f603ce4ad30, 0xc0001c0730}, 0x1e4f900?)
    /go/pkg/mod/github.com/prometheus/[email protected]/prometheus/promhttp/instrument_server.go:60 +0xcb
net/http.HandlerFunc.ServeHTTP(0x1e4f9b8?, {0x7f603ce4ad30?, 0xc0001c0730?}, 0xc0005418a0?)
    /usr/local/go/src/net/http/server.go:2136 +0x29
github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerCounter.func1({0x1e4f9b8?, 0xc0001fa620?}, 0xc0008fea00)
    /go/pkg/mod/github.com/prometheus/[email protected]/prometheus/promhttp/instrument_server.go:147 +0xb6
net/http.HandlerFunc.ServeHTTP(0x701406?, {0x1e4f9b8?, 0xc0001fa620?}, 0x410725?)
    /usr/local/go/src/net/http/server.go:2136 +0x29
github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerDuration.func2({0x1e4f9b8, 0xc0001fa620}, 0xc0008fea00)
    /go/pkg/mod/github.com/prometheus/[email protected]/prometheus/promhttp/instrument_server.go:109 +0xc2
net/http.HandlerFunc.ServeHTTP(0x10?, {0x1e4f9b8?, 0xc0001fa620?}, 0xc000962fac?)
    /usr/local/go/src/net/http/server.go:2136 +0x29
net/http.(*ServeMux).ServeHTTP(0x410725?, {0x1e4f9b8, 0xc0001fa620}, 0xc0008fea00)
    /usr/local/go/src/net/http/server.go:2514 +0x142
net/http.serverHandler.ServeHTTP({0x1e497d0?}, {0x1e4f9b8?, 0xc0001fa620?}, 0x6?)
    /usr/local/go/src/net/http/server.go:2938 +0x8e
net/http.(*conn).serve(0xc000377c20, {0x1e5cb48, 0xc00017c240})
    /usr/local/go/src/net/http/server.go:2009 +0x5f4
created by net/http.(*Server).Serve in goroutine 66
    /usr/local/go/src/net/http/server.go:3086 +0x5cb

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • Tests have been added/modified and all tests pass.
  • Functionality/bugs have been confirmed to be unchanged or fixed.
  • I have performed a self-review of my own code.
  • Documentation has been updated or added where necessary.

Additional Context

@drivebyer drivebyer added the bug Something isn't working label Feb 26, 2024
@drivebyer drivebyer enabled auto-merge (squash) February 26, 2024 08:16
Copy link

codecov bot commented Feb 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 32.78%. Comparing base (df2df6d) to head (697c4f9).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #787      +/-   ##
==========================================
+ Coverage   32.76%   32.78%   +0.02%     
==========================================
  Files          19       19              
  Lines        3235     3233       -2     
==========================================
  Hits         1060     1060              
+ Misses       2116     2114       -2     
  Partials       59       59              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@drivebyer drivebyer merged commit 891d740 into OT-CONTAINER-KIT:master Feb 26, 2024
31 checks passed
@drivebyer drivebyer deleted the fix-conversion branch February 27, 2024 01:58
mattrobinsonsre pushed a commit to mattrobinsonsre/redis-operator that referenced this pull request Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants