Skip to content

net/valkey: fix nil pointer panic in shardForKey - #4173

Draft
madumalt wants to merge 1 commit into
masterfrom
fix/panic/valkey/shardForKey
Draft

net/valkey: fix nil pointer panic in shardForKey#4173
madumalt wants to merge 1 commit into
masterfrom
fix/panic/valkey/shardForKey

Conversation

@madumalt

@madumalt madumalt commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

shardForKey dereferences the atomic pointer without a nil check:

return *vr.shards[xxhash.Sum64String(key)%ringSize].Load()

When shard slots are not yet initialized (e.g. ring created with zero addresses before AddrUpdater populates them), Load() returns nil and the dereference panics. This crashes every request hitting a Valkey-backed cluster rate limit filter:

panic caused by: runtime error: invalid memory address or nil pointer dereference
github.com/zalando/skipper/net.(*valkeyRing).shardForKey(0x363fc1b64000, {0x363fc15dcc00?, 0x0?})
    github.com/zalando/skipper/net/valkey.go:249 +0x64

Change shardForKey to return (valkey.Client, error) and check for nil before dereferencing. Propagate the error through all valkeyRing methods and ValkeyRingClient wrappers so callers receive a proper error instead of a panic.

Alternative Approach

An alternative approach would be to prevent nil from ever being stored by ensuring newValkeyRing does not return a usable ring until updateShards has run with at least one address, and guarding SetAddr against partial initialization races. This would be a stronger invariant but a larger change; the nil-check in shardForKey is the minimal safety net that prevents the panic regardless of cause.

shardForKey dereferences the atomic pointer without a nil check:

    return *vr.shards[xxhash.Sum64String(key)%ringSize].Load()

When shard slots are not yet initialized (e.g. ring created with zero
addresses before AddrUpdater populates them), Load() returns nil and
the dereference panics. This crashes every request hitting a
Valkey-backed cluster rate limit filter:

    panic caused by: runtime error: invalid memory address or nil pointer dereference
    github.com/zalando/skipper/net.(*valkeyRing).shardForKey(0x363fc1b64000, {0x363fc15dcc00?, 0x0?})
        github.com/zalando/skipper/net/valkey.go:249 +0x64

Change shardForKey to return (valkey.Client, error) and check for nil
before dereferencing. Propagate the error through all valkeyRing
methods and ValkeyRingClient wrappers so callers receive a proper error
instead of a panic.

An alternative approach would be to prevent nil from ever being stored
by ensuring newValkeyRing does not return a usable ring until
updateShards has run with at least one address, and guarding SetAddr
against partial initialization races. This would be a stronger
invariant but a larger change; the nil-check in shardForKey is the
minimal safety net that prevents the panic regardless of cause.

Signed-off-by: Thilina Madumal <thilina.madumal@zalando.de>
@madumalt madumalt added bugfix Bug fixes and patches do-not-merge minor no risk changes, for example new filters labels Aug 7, 2026
@madumalt

madumalt commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

Logs of the Panic

application='skipper-ingress' 'panic' cluster='aws::eu-central-1:' pod='skipper-ingress-canary-5d97c5585f-kwnzc'

| timestamp    | host                                    | logfile                                        | rawLogLine                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ------------ | --------------------------------------- | ---------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 10:12:43.000 | aws::eu-central-1: | ?app=skipper-ingress&comp=ingress&cid=skipper- | [APP]time="2026-08-07T08:12:43Z" level=error msg="stacktrace of panic caused by: runtime error: invalid memory address or nil pointer dereference:\ngoroutine 1253 [running]:\ngithub.com/zalando/skipper/proxy.stack()\n\tgithub.com/zalando/skipper/proxy/proxy.go:1287 +0x64\ngithub.com/zalando/skipper/proxy.(*Proxy).do.func1.1()\n\tgithub.com/zalando/skipper/proxy/proxy.go:1305 +0x38\ngolang.org/x/time/rate.(*Sometimes).Do(0x363fc14b7b20, 0x363fc5370a88)\n\tgolang.org/x/time@v0.15.0/rate/sometimes.go:63 +0x13c\ngithub.com/zalando/skipper/proxy.(*Proxy).do.func1()\n\tgithub.com/zalando/skipper/proxy/proxy.go:1304 +0x8c\npanic({0x2f30aa0?, 0x660e7a0?})\n\truntime/panic.go:860 +0x12c\ngithub.com/zalando/skipper/net.(*valkeyRing).shardForKey(0x363fc1b64000, {0x363fc15dcc00?, 0x0?})\n\tgithub.com/zalando/skipper/net/valkey.go:249 +0x64\ngithub.com/zalando/skipper/net.(*valkeyRing).ZRemRangeByScore(0x124f84?, {0x3c9a750, 0x363fc1b30450}, {0x363fc15dcc00, 0x54}, {0x367a920, 0x3}, {0x363fc49ea4f8, 0x13})\n\tgithub.com/zalando/skipper/net/valkey.go:313 +0x5c\ngithub.com/zalando/skipper/net.(*ValkeyRingClient).ZRemRangeByScore(0x367a25c?, {0x3c9a750?, 0x363fc1b30450?}, {0x363fc15dcc00?, 0x1?}, {0x367a920?, 0x363fc52f6008?}, {0x363fc49ea4f8?, 0x363fc5370e58?})\n\tgithub.com/zalando/skipper/net/valkey.go:562 +0x3c\ngithub.com/zalando/skipper/ratelimit.(*clusterLimitValkey).allow(0x363fc53a7560, {0x3c9a750, 0x363fc1b30450}, {0x363fc62fd827?, 0x3020600?})\n\tgithub.com/zalando/skipper/ratelimit/valkey.go:158 +0x1a0\ngithub.com/zalando/skipper/ratelimit.(*clusterLimitValkey).Allow(0x363fc53a7560, {0x3c9a750, 0x363fc1b30450}, {0x363fc62fd827, 0x7})\n\tgithub.com/zalando/skipper/ratelimit/valkey.go:123 +0x1a0\ngithub.com/zalando/skipper/ratelimit.(*Ratelimit).Allow(0x363fc5371048?, {0x3c9a750?, 0x363fc1b30450?}, {0x363fc62fd827?, 0x363fc182d8a0?})\n\tgithub.com/zalando/skipper/ratelimit/ratelimit.go:379 +0x34\ngithub.com/zalando/skipper/filters/ratelimit.(*filter).Request(0x363fc16c7650, {0x3cd3420, 0x363fc1d6c500})\n\tgithub.com/zalando/skipper/filters/ratelimit/ratelimit.go:478 +0x1c8\ngithub.com/zalando/skipper/proxy.(*Proxy).applyFiltersToRequest(0x363fc14b7a20, {0x363fc4fa9440, 0xb, 0x1?}, 0x363fc1d6c500, 0x363fc53712f8)\n\tgithub.com/zalando/skipper/proxy/proxy.go:975 +0x2bc\ngithub.com/zalando/skipper/proxy.(*Proxy).do(0x363fc14b7a20, 0x363fc1d6c500, {0x3cc3840, 0x363fc5d5b760})\n\tgithub.com/zalando/skipper/proxy/proxy.go:1358 +0x628\ngithub.com/zalando/skipper/proxy.(*Proxy).ServeHTTP(0x363fc14b7a20, {0x3c93c60, 0x363fc5f7b770}, 0x363fc1d6c3c0)\n\tgithub.com/zalando/skipper/proxy/proxy.go:1869 +0x71c\ngithub.com/zalando/skipper/net.(*ForwardedHeadersHandler).ServeHTTP(0x363fc4c47bd0, {0x3c93c60, 0x363fc5f7b770}, 0x363fc1d6c280)\n\tgithub.com/zalando/skipper/net/headers.go:89 +0xf8\ngithub.com/zalando/skipper/net.(*HostPatchHandler).ServeHTTP(0x363fc1d75830, {0x3c93c60, 0x363fc5f7b770}, 0x363fc1d6c280)\n\tgithub.com/zalando/skipper/net/host.go:60 +0x70\ngithub.com/zalando/skipper/net.(*ValidateQueryHandler).ServeHTTP(0x363fc4c590c0, {0x3c93c60, 0x363fc5f7b770}, 0x363fc1d6c280)\n\tgithub.com/zalando/skipper/net/query.go:19 +0x7c\ngithub.com/zalando/skipper/net.(*ConnManager).serveHTTP(0x363fc4ccab10, {0x3c93c60, 0x363fc5f7b770}, 0x363fc1d6c280)\n\tgithub.com/zalando/skipper/net/connmanager.go:77 +0x278\nnet/http.HandlerFunc.ServeHTTP(0x10?, {0x3c93c60?, 0x363fc5f7b770?}, 0x363fc5f7b770?)\n\tnet/http/server.go:2286 +0x38\nnet/http.serverHandler.ServeHTTP({0x3c7fa50?}, {0x3c93c60?, 0x363fc5f7b770?}, 0x6?)\n\tnet/http/server.go:3311 +0xb0\nnet/http.(*conn).serve(0x363fc5d2d320, {0x3c9a750, 0x363fc5d4b7a0})\n\tnet/http/server.go:2073 +0x51c\ncreated by net/http.(*Server).Serve in goroutine 1\n\tnet/http/server.go:3464 +0x37c\n" trace_id=b57889b9422cc7bb |
| 10:12:43.000 | aws::eu-central-1: | ?app=skipper-ingress&comp=ingress&cid=skipper- | [APP]time="2026-08-07T08:12:43Z" level=error msg="error while proxying after 433.511µs, route kube_rg__zllm__zllm_litellm_proxy_main_228_traffic_segment__all__1_0 with backend lb ://, status code 500: dialing failed false: panic caused by: runtime error: invalid memory address or nil pointer dereference, remote host: 193.38.255.26, request: \"POST /v1/responses HTTP/1.1\", host: zllm.data.zalan.do, user agent: \"OpenAI/Python 2.49.0\"" trace_id=b57889b9422cc7bb                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| 10:12:43.000 | aws::eu-central-1:| ?app=skipper-ingress&comp=ingress&cid=skipper- | [APP]time="2026-08-07T08:12:43Z" level=error msg="stacktrace of panic caused by: runtime error: invalid memory address or nil pointer dereference:\ngoroutine 632 [running]:\ngithub.com/zalando/skipper/proxy.stack()\n\tgithub.com/zalando/skipper/proxy/proxy.go:1287 +0x64\ngithub.com/zalando/skipper/proxy.(*Proxy).do.func1.1()\n\tgithub.com/zalando/skipper/proxy/proxy.go:1305 +0x38\ngolang.org/x/time/rate.(*Sometimes).Do(0x363fc14b7b20, 0x363fc1adaa88)\n\tgolang.org/x/time@v0.15.0/rate/sometimes.go:63 +0x13c\ngithub.com/zalando/skipper/proxy.(*Proxy).do.func1()\n\tgithub.com/zalando/skipper/proxy/proxy.go:1304 +0x8c\npanic({0x2f30aa0?, 0x660e7a0?})\n\truntime/panic.go:860 +0x12c\ngithub.com/zalando/skipper/net.(*valkeyRing).shardForKey(0x363fc1b64000, {0x363fc5e546c0?, 0x0?})\n\tgithub.com/zalando/skipper/net/valkey.go:249 +0x64\ngithub.com/zalando/skipper/net.(*valkeyRing).ZRemRangeByScore(0x124f84?, {0x3c9a750, 0x363fc1b1f590}, {0x363fc5e546c0, 0x54}, {0x367a920, 0x3}, {0x363fc1353680, 0x13})\n\tgithub.com/zalando/skipper/net/valkey.go:313 +0x5c\ngithub.com/zalando/skipper/net.(*ValkeyRingClient).ZRemRangeByScore(0x367a25c?, {0x3c9a750?, 0x363fc1b1f590?}, {0x363fc5e546c0?, 0x1?}, {0x367a920?, 0x363fc52f6008?}, {0x363fc1353680?, 0x363fc1adae58?})\n\tgithub.com/zalando/skipper/net/valkey.go:562 +0x3c\ngithub.com/zalando/skipper/ratelimit.(*clusterLimitValkey).allow(0x363fc53a7560, {0x3c9a750, 0x363fc1b1f590}, {0x363fc5d3b829?, 0x3020600?})\n\tgithub.com/zalando/skipper/ratelimit/valkey.go:158 +0x1a0\ngithub.com/zalando/skipper/ratelimit.(*clusterLimitValkey).Allow(0x363fc53a7560, {0x3c9a750, 0x363fc1b1f590}, {0x363fc5d3b829, 0x8})\n\tgithub.com/zalando/skipper/ratelimit/valkey.go:123 +0x1a0\ngithub.com/zalando/skipper/ratelimit.(*Ratelimit).Allow(0x363fc1adb048?, {0x3c9a750?, 0x363fc1b1f590?}, {0x363fc5d3b829?, 0x363fc182d8a0?})\n\tgithub.com/zalando/skipper/ratelimit/ratelimit.go:379 +0x34\ngithub.com/zalando/skipper/filters/ratelimit.(*filter).Request(0x363fc16c7650, {0x3cd3420, 0x363fc1d6d680})\n\tgithub.com/zalando/skipper/filters/ratelimit/ratelimit.go:478 +0x1c8\ngithub.com/zalando/skipper/proxy.(*Proxy).applyFiltersToRequest(0x363fc14b7a20, {0x363fc4fa9440, 0xb, 0x1?}, 0x363fc1d6d680, 0x363fc1adb2f8)\n\tgithub.com/zalando/skipper/proxy/proxy.go:975 +0x2bc\ngithub.com/zalando/skipper/proxy.(*Proxy).do(0x363fc14b7a20, 0x363fc1d6d680, {0x3cc3840, 0x363fc5d5b970})\n\tgithub.com/zalando/skipper/proxy/proxy.go:1358 +0x628\ngithub.com/zalando/skipper/proxy.(*Proxy).ServeHTTP(0x363fc14b7a20, {0x3c93c60, 0x363fc5f7b860}, 0x363fc1d6d540)\n\tgithub.com/zalando/skipper/proxy/proxy.go:1869 +0x71c\ngithub.com/zalando/skipper/net.(*ForwardedHeadersHandler).ServeHTTP(0x363fc4c47bd0, {0x3c93c60, 0x363fc5f7b860}, 0x363fc1d6d400)\n\tgithub.com/zalando/skipper/net/headers.go:89 +0xf8\ngithub.com/zalando/skipper/net.(*HostPatchHandler).ServeHTTP(0x363fc1d75830, {0x3c93c60, 0x363fc5f7b860}, 0x363fc1d6d400)\n\tgithub.com/zalando/skipper/net/host.go:60 +0x70\ngithub.com/zalando/skipper/net.(*ValidateQueryHandler).ServeHTTP(0x363fc4c590c0, {0x3c93c60, 0x363fc5f7b860}, 0x363fc1d6d400)\n\tgithub.com/zalando/skipper/net/query.go:19 +0x7c\ngithub.com/zalando/skipper/net.(*ConnManager).serveHTTP(0x363fc4ccab10, {0x3c93c60, 0x363fc5f7b860}, 0x363fc1d6d400)\n\tgithub.com/zalando/skipper/net/connmanager.go:77 +0x278\nnet/http.HandlerFunc.ServeHTTP(0x10?, {0x3c93c60?, 0x363fc5f7b860?}, 0x363fc5f7b860?)\n\tnet/http/server.go:2286 +0x38\nnet/http.serverHandler.ServeHTTP({0x3c7fa50?}, {0x3c93c60?, 0x363fc5f7b860?}, 0x6?)\n\tnet/http/server.go:3311 +0xb0\nnet/http.(*conn).serve(0x363fc54567e0, {0x3c9a750, 0x363fc547c360})\n\tnet/http/server.go:2073 +0x51c\ncreated by net/http.(*Server).Serve in goroutine 1\n\tnet/http/server.go:3464 +0x37c\n" trace_id=b9fc801ac95b4716  |
| 10:12:43.000 | aws::eu-central-1: | ?app=skipper-ingress&comp=ingress&cid=skipper- | [APP]time="2026-08-07T08:12:43Z" level=error msg="error while proxying after 1.481652ms, route kube_rg__zllm__zllm_litellm_proxy_main_228_traffic_segment__all__1_0 with backend lb ://, status code 500: dialing failed false: panic caused by: runtime error: invalid memory address or nil pointer dereference, remote host: 95.91.246.108, request: \"POST /v1/messages HTTP/1.1\", host: zllm.data.zalan.do, user agent: \"claude-cli/2.1.212 (external, cli)\"" trace_id=b9fc801ac95b4716                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| 10:12:44.000 | aws::eu-central-1: | ?app=skipper-ingress&comp=ingress&cid=skipper- | [APP]time="2026-08-07T08:12:44Z" level=error msg="stacktrace of panic caused by: runtime error: invalid memory address or nil pointer dereference:\ngoroutine 632 [running]:\ngithub.com/zalando/skipper/proxy.stack()\n\tgithub.com/zalando/skipper/proxy/proxy.go:1287 +0x64\ngithub.com/zalando/skipper/proxy.(*Proxy).do.func1.1()\n\tgithub.com/zalando/skipper/proxy/proxy.go:1305 +0x38\ngolang.org/x/time/rate.(*Sometimes).Do(0x363fc14b7b20, 0x363fc1adaa88)\n\tgolang.org/x/time@v0.15.0/rate/sometimes.go:63 +0x13c\ngithub.com/zalando/skipper/proxy.(*Proxy).do.func1()\n\tgithub.com/zalando/skipper/proxy/proxy.go:1304 +0x8c\npanic({0x2f30aa0?, 0x660e7a0?})\n\truntime/panic.go:860 +0x12c\ngithub.com/zalando/skipper/net.(*valkeyRing).shardForKey(0x363fc1b64000, {0x363fc5e54780?, 0x0?})\n\tgithub.com/zalando/skipper/net/valkey.go:249 +0x64\ngithub.com/zalando/skipper/net.(*valkeyRing).ZRemRangeByScore(0x124f84?, {0x3c9a750, 0x363fc1b42b70}, {0x363fc5e54780, 0x54}, {0x367a920, 0x3}, {0x363fc1353ab8, 0x13})\n\tgithub.com/zalando/skipper/net/valkey.go:313 +0x5c\ngithub.com/zalando/skipper/net.(*ValkeyRingClient).ZRemRangeByScore(0x367a25c?, {0x3c9a750?, 0x363fc1b42b70?}, {0x363fc5e54780?, 0x1?}, {0x367a920?, 0x363fc1379808?}, {0x363fc1353ab8?, 0x363fc1adae58?})\n\tgithub.com/zalando/skipper/net/valkey.go:562 +0x3c\ngithub.com/zalando/skipper/ratelimit.(*clusterLimitValkey).allow(0x363fc53a7560, {0x3c9a750, 0x363fc1b42b70}, {0x363fc1db46a9?, 0x3020600?})\n\tgithub.com/zalando/skipper/ratelimit/valkey.go:158 +0x1a0\ngithub.com/zalando/skipper/ratelimit.(*clusterLimitValkey).Allow(0x363fc53a7560, {0x3c9a750, 0x363fc1b42b70}, {0x363fc1db46a9, 0x8})\n\tgithub.com/zalando/skipper/ratelimit/valkey.go:123 +0x1a0\ngithub.com/zalando/skipper/ratelimit.(*Ratelimit).Allow(0x363fc1adb048?, {0x3c9a750?, 0x363fc1b42b70?}, {0x363fc1db46a9?, 0x363fc182d8a0?})\n\tgithub.com/zalando/skipper/ratelimit/ratelimit.go:379 +0x34\ngithub.com/zalando/skipper/filters/ratelimit.(*filter).Request(0x363fc16c7650, {0x3cd3420, 0x363fc1db0280})\n\tgithub.com/zalando/skipper/filters/ratelimit/ratelimit.go:478 +0x1c8\ngithub.com/zalando/skipper/proxy.(*Proxy).applyFiltersToRequest(0x363fc14b7a20, {0x363fc4fa9440, 0xb, 0x1?}, 0x363fc1db0280, 0x363fc1adb2f8)\n\tgithub.com/zalando/skipper/proxy/proxy.go:975 +0x2bc\ngithub.com/zalando/skipper/proxy.(*Proxy).do(0x363fc14b7a20, 0x363fc1db0280, {0x3cc3840, 0x363fc5ed0790})\n\tgithub.com/zalando/skipper/proxy/proxy.go:1358 +0x628\ngithub.com/zalando/skipper/proxy.(*Proxy).ServeHTTP(0x363fc14b7a20, {0x3c93c60, 0x363fc197ad20}, 0x363fc1db0140)\n\tgithub.com/zalando/skipper/proxy/proxy.go:1869 +0x71c\ngithub.com/zalando/skipper/net.(*ForwardedHeadersHandler).ServeHTTP(0x363fc4c47bd0, {0x3c93c60, 0x363fc197ad20}, 0x363fc1db0000)\n\tgithub.com/zalando/skipper/net/headers.go:89 +0xf8\ngithub.com/zalando/skipper/net.(*HostPatchHandler).ServeHTTP(0x363fc1d75830, {0x3c93c60, 0x363fc197ad20}, 0x363fc1db0000)\n\tgithub.com/zalando/skipper/net/host.go:60 +0x70\ngithub.com/zalando/skipper/net.(*ValidateQueryHandler).ServeHTTP(0x363fc4c590c0, {0x3c93c60, 0x363fc197ad20}, 0x363fc1db0000)\n\tgithub.com/zalando/skipper/net/query.go:19 +0x7c\ngithub.com/zalando/skipper/net.(*ConnManager).serveHTTP(0x363fc4ccab10, {0x3c93c60, 0x363fc197ad20}, 0x363fc1db0000)\n\tgithub.com/zalando/skipper/net/connmanager.go:77 +0x278\nnet/http.HandlerFunc.ServeHTTP(0x10?, {0x3c93c60?, 0x363fc197ad20?}, 0x363fc197ad20?)\n\tnet/http/server.go:2286 +0x38\nnet/http.serverHandler.ServeHTTP({0x3c7fa50?}, {0x3c93c60?, 0x363fc197ad20?}, 0x6?)\n\tnet/http/server.go:3311 +0xb0\nnet/http.(*conn).serve(0x363fc54567e0, {0x3c9a750, 0x363fc547c360})\n\tnet/http/server.go:2073 +0x51c\ncreated by net/http.(*Server).Serve in goroutine 1\n\tnet/http/server.go:3464 +0x37c\n" trace_id=be1a639142aecf88  |
| 10:12:44.000 | aws::eu-central-1: | ?app=skipper-ingress&comp=ingress&cid=skipper- | [APP]time="2026-08-07T08:12:44Z" level=error msg="error while proxying after 361.591µs, route kube_rg__zllm__zllm_litellm_proxy_main_228_traffic_segment__all__1_0 with backend lb ://, status code 500: dialing failed false: panic caused by: runtime error: invalid memory address or nil pointer dereference, remote host: 95.91.246.108, request: \"POST /v1/messages HTTP/1.1\", host: zllm.data.zalan.do, user agent: \"claude-cli/2.1.212 (external, cli)\"" trace_id=be1a639142aecf88                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| 10:12:44.000 | aws::eu-central-1: | ?app=skipper-ingress&comp=ingress&cid=skipper- | [APP]time="2026-08-07T08:12:44Z" level=error msg="error while proxying after 224.675µs, route kube_rg__zllm__zllm_litellm_proxy_main_228_traffic_segment__all__1_0 with backend lb ://, status code 500: dialing failed false: panic caused by: runtime error: invalid memory address or nil pointer dereference, remote host: 193.38.255.26, request: \"POST /v1/responses HTTP/1.1\", host: zllm.data.zalan.do, user agent: \"OpenAI/Python 2.49.0\"" trace_id=bc8423b59b8e668d                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| 10:12:45.000 | aws::eu-central-1: | ?app=skipper-ingress&comp=ingress&cid=skipper- | [APP]time="2026-08-07T08:12:45Z" level=error msg="error while proxying after 186.55µs, route kube_rg__zllm__zllm_litellm_proxy_main_228_traffic_segment__all__1_0 with backend lb ://, status code 500: dialing failed false: panic caused by: runtime error: invalid memory address or nil pointer dereference, remote host: 77.11.138.239, request: \"POST /v1/messages HTTP/1.1\", host: zllm.data.zalan.do, user agent: \"claude-cli/2.1.220 (external, cli)\"" trace_id=d13efad67012de5f                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| 10:12:45.000 | aws::eu-central-1: | ?app=skipper-ingress&comp=ingress&cid=skipper- | [APP]time="2026-08-07T08:12:45Z" level=error msg="error while proxying after 231.899µs, route kube_rg__zllm__zllm_litellm_proxy_main_228_traffic_segment__all__1_0 with backend lb ://, status code 500: dialing failed false: panic caused by: runtime error: invalid memory address or nil pointer dereference, remote host: 147.161.168.96, request: \"POST /v1/responses HTTP/1.1\", host: zllm.data.zalan.do, user agent: \"codex-tui/0.145.0 (Ubuntu 24.4.0; x86_64) gnome-terminal (codex-tui; 0.145.0)\"" trace_id=ed2318be7b2fa13b                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| 10:12:45.000 | aws::eu-central-1: | ?app=skipper-ingress&comp=ingress&cid=skipper- | [APP]time="2026-08-07T08:12:45Z" level=error msg="error while proxying after 171.365µs, route kube_rg__zllm__zllm_litellm_proxy_main_228_traffic_segment__all__1_0 with backend lb ://, status code 500: dialing failed false: panic caused by: runtime error: invalid memory address or nil pointer dereference, remote host: 193.38.255.26, request: \"POST /v1/responses HTTP/1.1\", host: zllm.data.zalan.do, user agent: \"OpenAI/Python 2.49.0\"" trace_id=7669a53ec56dac35                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| 10:12:45.000 | aws::eu-central-1: | ?app=skipper-ingress&comp=ingress&cid=skipper- | [APP]time="2026-08-07T08:12:45Z" level=error msg="error while proxying after 152.059µs, route kube_rg__zllm__zllm_litellm_proxy_main_228_traffic_segment__all__1_0 with backend lb ://, status code 500: dialing failed false: panic caused by: runtime error: invalid memory address or nil pointer dereference, remote host: 95.91.246.108, request: \"POST /v1/messages HTTP/1.1\", host: zllm.data.zalan.do, user agent: \"claude-cli/2.1.212 (external, cli)\"" trace_id=3e104ed5030e1e75                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| 10:12:46.000 | aws::eu-central-1: | ?app=skipper-ingress&comp=ingress&cid=skipper- | [APP]time="2026-08-07T08:12:46Z" level=error msg="error while proxying after 181.295µs, route kube_rg__zllm__zllm_litellm_proxy_main_228_traffic_segment__all__1_0 with backend lb ://, status code 500: dialing failed false: panic caused by: runtime error: invalid memory address or nil pointer dereference, remote host: 144.2.114.182, request: \"POST /v1/responses HTTP/1.1\", host: zllm.data.zalan.do, user agent: \"Codex Desktop/0.147.0-alpha.6.5 (Mac OS 26.5.2; arm64) unknown (Codex Desktop; 26.803.41515)\"" trace_id=9b04de3bdf960b97                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |

Comment thread net/valkey.go
// shardForKey does the lookup for valkey most operations to find the valkey ring shard
func (vr *valkeyRing) shardForKey(key string) valkey.Client {
return *vr.shards[xxhash.Sum64String(key)%ringSize].Load()
func (vr *valkeyRing) shardForKey(key string) (valkey.Client, error) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we should not have a change here. We should fix the initial creation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah that's what I proposed in the alternative approach. But atm I don't have all information how can I do it. Any leads?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think in skipper.go we create the valkey client. We could expose Ready() bool in valkey client and we do something like for !valkey.Ready() { time.Sleep(time.Second) } in skipper.go before we start the main listener that would make skipper "ready" for NLB and kubernetes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ready() should check that the sharding client array has no nil entry or something like that.

@madumalt
madumalt marked this pull request as draft August 7, 2026 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Bug fixes and patches do-not-merge minor no risk changes, for example new filters

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants