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

Nil pointer exception when TCPRoute weight is 0 #5277

Open
tobrien-nydig opened this issue Feb 14, 2025 · 1 comment · May be fixed by #5278
Open

Nil pointer exception when TCPRoute weight is 0 #5277

tobrien-nydig opened this issue Feb 14, 2025 · 1 comment · May be fixed by #5278
Assignees
Labels
kind/bug Something isn't working

Comments

@tobrien-nydig
Copy link

tobrien-nydig commented Feb 14, 2025

Description:
We are trying to use Argo Rollouts in conjunction with the Envoy Gateway but hitting a bug when fully promoting our Canary service. Rollouts sets the TCPRoute weight to 0 on the old service to do this. When this happens, we get a nil pointer exception and the route is not updated.

Repro steps:

apiVersion: gateway.networking.k8s.io/v1alpha2
kind: TCPRoute
metadata:
  name: rollouts-tcp-route
  namespace: rollouts-demo
spec:
  parentRefs:
    - group: gateway.networking.k8s.io
      kind: Gateway
      name: eg
      namespace: rollouts-demo
  rules:
    - backendRefs:
        - group: ''
          kind: Service
          name: argo-rollouts-green-service
          port: 7070
          weight: 0
        - group: ''
          kind: Service
          name: argo-rollouts-blue-service
          port: 7070
          weight: 100

Environment:
1.3.0

Logs:

{"runner": "gateway-api", "stackTrace": "goroutine 186 [running]:runtime/debug.Stack()
    /opt/hostedtoolcache/go/1.23.5/x64/src/runtime/debug/stack.go:26 +0x5e
github.com/envoyproxy/gateway/internal/message.handleWithCrashRecovery[...].func1()
    /home/runner/work/gateway/gateway/internal/message/watchutil.go:52 +0x1c5
panic({0x2d09d40?, 0xa3f9d10?})
    /opt/hostedtoolcache/go/1.23.5/x64/src/runtime/panic.go:785 +0x132
github.com/envoyproxy/gateway/internal/ir.(*DestinationSetting).Validate(0x2b30fc0?)
    /home/runner/work/gateway/gateway/internal/ir/xds.go:1448 +0x1a
github.com/envoyproxy/gateway/internal/ir.(*RouteDestination).Validate(0x196?)
    /home/runner/work/gateway/gateway/internal/ir/xds.go:1394 +0xc5
github.com/envoyproxy/gateway/internal/ir.TCPRoute.Validate({{0xc000908b10, 0x29}, 0x0, 0xc0012cdb00, 0x0, 0xc0001a7280, 0x0, 0x0, 0x0, 0x0, ...})
    /home/runner/work/gateway/gateway/internal/ir/xds.go:1839 +0x1e5
github.com/envoyproxy/gateway/internal/ir.TCPListener.Validate({{{0xc003561de8, 0x14}, {0x332b863, 0x7}, 0x1b9e, {0x0, 0x0, 0x0}, 0x0, 0x0}, ...})
    /home/runner/work/gateway/gateway/internal/ir/xds.go:1812 +0x218
github.com/envoyproxy/gateway/internal/ir.(*Xds).Validate(0xc002d6b560)
    /home/runner/work/gateway/gateway/internal/ir/xds.go:188 +0x1f8
github.com/envoyproxy/gateway/internal/gatewayapi/runner.(*Runner).subscribeAndTranslate.func1({{0xc00210cc90?, 0x80?}, 0xf0?, 0xc001181c98?}, 0xc000727b20)
    /home/runner/work/gateway/gateway/internal/gatewayapi/runner/runner.go:189 +0xda6
github.com/envoyproxy/gateway/internal/message.handleWithCrashRecovery[...](0xc0031d5f98?, {{0xc00210cc90, 0x30?}, 0x8?, 0xc001181c98?}, {{0x33359fa, 0xb}, {0x3347e7f, 0x12}}, 0xc000727b20?)
    /home/runner/work/gateway/gateway/internal/message/watchutil.go:58 +0x137
github.com/envoyproxy/gateway/internal/message.HandleSubscription[...]({{0x33359fa, 0x82e1ac8?}, {0x3347e7f?, 0x225b3a2273627265?}}, 0xc001c7fb90?, 0xc0031d5f98)
    /home/runner/work/gateway/gateway/internal/message/watchutil.go:97 +0x7b0
github.com/envoyproxy/gateway/internal/gatewayapi/runner.(*Runner).subscribeAndTranslate(0xc000ab8b40, {0x82e1ac8?, 0xc000be0000?})
    /home/runner/work/gateway/gateway/internal/gatewayapi/runner/runner.go:119 +0x7e
created by github.com/envoyproxy/gateway/internal/gatewayapi/runner.(*Runner).Start in goroutine 53
    /home/runner/work/gateway/gateway/internal/gatewayapi/runner/runner.go:85 +0x2a5
", "error": "runtime error: invalid memory address or nil pointer dereference"}
@arkodg
Copy link
Contributor

arkodg commented Feb 14, 2025

similar to #2515, might have missed handling this for TCPRoute, the fix was to create a nil destination setting for this case,
assigning this to you @tobrien-nydig since you already raised a PR, tia

@arkodg arkodg added kind/bug Something isn't working and removed triage labels Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants