Skip to content

Conversation

sayboras
Copy link
Member

@sayboras sayboras commented Nov 5, 2024

Update if condition to avoid panic if ip mode is nil, as OR operator is having higher precedence than AND operator.

panic: runtime error: invalid memory address or nil pointer dereference
 [signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x222dcb0]
 goroutine 444 [running]:
 github.com/cilium/cilium/pkg/k8s.ParseService(0x400308f0e0, {0x40030a8480, 0x3, 0x4})
     /go/src/github.com/cilium/cilium/pkg/k8s/service.go:232 +0x1320
 github.com/cilium/cilium/pkg/k8s.(*ServiceCache).UpdateService(0x4001f10c60, 0x400308f0e0, 0x400133f680)
     /go/src/github.com/cilium/cilium/pkg/k8s/service_cache.go:337 +0x1e8
 github.com/cilium/cilium/pkg/k8s/watchers.(*K8sServiceWatcher).upsertK8sServiceV1(0x40005f9400, 0x400308f0e0, 0x10?)
     /go/src/github.com/cilium/cilium/pkg/k8s/watchers/service.go:142 +0x30
 github.com/cilium/cilium/pkg/k8s/watchers.(*K8sServiceWatcher).serviceEventLoop(0x40005f9400, 0x400190be38, 0x400133f680)
     /go/src/github.com/cilium/cilium/pkg/k8s/watchers/service.go:130 +0x1f4
 created by github.com/cilium/cilium/pkg/k8s/watchers.(*K8sServiceWatcher).servicesInit in goroutine 1
     /go/src/github.com/cilium/cilium/pkg/k8s/watchers/service.go:101 +0x160

Reported-by: https://github.com/Truongnht
Fixes: ab8557c

@maintainer-s-little-helper maintainer-s-little-helper bot added the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Nov 5, 2024
@sayboras sayboras added the release-note/bug This PR fixes an issue in a previous release of Cilium. label Nov 5, 2024
@maintainer-s-little-helper maintainer-s-little-helper bot removed the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Nov 5, 2024
@sayboras sayboras marked this pull request as ready for review November 5, 2024 15:36
@sayboras sayboras requested a review from a team as a code owner November 5, 2024 15:36
@sayboras sayboras requested a review from nathanjsweet November 5, 2024 15:36
Copy link
Member

@joestringer joestringer left a comment

Choose a reason for hiding this comment

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

This seems like something we could catch with better unit tests.

@sayboras
Copy link
Member Author

sayboras commented Nov 5, 2024

This seems like something we could catch with better unit tests.

Good point, unit test is added to cover for this case.

@sayboras
Copy link
Member Author

sayboras commented Nov 5, 2024

/test

@sayboras sayboras force-pushed the pr/tammach/panic-ip-mode branch from fc36767 to 16fd428 Compare November 5, 2024 23:04
@sayboras sayboras enabled auto-merge November 5, 2024 23:32
@sayboras
Copy link
Member Author

sayboras commented Nov 6, 2024

/test

1 similar comment
@sayboras
Copy link
Member Author

sayboras commented Nov 6, 2024

/test

@truongnht
Copy link

tested in my cluster with the image disgest from the PR and confirmed it working

@sayboras
Copy link
Member Author

sayboras commented Nov 6, 2024

/test

@sayboras
Copy link
Member Author

sayboras commented Nov 6, 2024

/test

1 similar comment
@nbusseneau
Copy link
Member

/test

@nbusseneau nbusseneau closed this Nov 6, 2024
auto-merge was automatically disabled November 6, 2024 14:51

Pull request was closed

@nbusseneau nbusseneau reopened this Nov 6, 2024
@nbusseneau
Copy link
Member

/test

@nbusseneau nbusseneau closed this Nov 6, 2024
@nbusseneau nbusseneau reopened this Nov 6, 2024
@nbusseneau
Copy link
Member

/test

Update if condition to avoid panic if ip mode is nil, as OR operator is
having higher precedence than AND operator.

```
panic: runtime error: invalid memory address or nil pointer dereference
 [signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x222dcb0]
 goroutine 444 [running]:
 github.com/cilium/cilium/pkg/k8s.ParseService(0x400308f0e0, {0x40030a8480, 0x3, 0x4})
     /go/src/github.com/cilium/cilium/pkg/k8s/service.go:232 +0x1320
 github.com/cilium/cilium/pkg/k8s.(*ServiceCache).UpdateService(0x4001f10c60, 0x400308f0e0, 0x400133f680)
     /go/src/github.com/cilium/cilium/pkg/k8s/service_cache.go:337 +0x1e8
 github.com/cilium/cilium/pkg/k8s/watchers.(*K8sServiceWatcher).upsertK8sServiceV1(0x40005f9400, 0x400308f0e0, 0x10?)
     /go/src/github.com/cilium/cilium/pkg/k8s/watchers/service.go:142 +0x30
 github.com/cilium/cilium/pkg/k8s/watchers.(*K8sServiceWatcher).serviceEventLoop(0x40005f9400, 0x400190be38, 0x400133f680)
     /go/src/github.com/cilium/cilium/pkg/k8s/watchers/service.go:130 +0x1f4
 created by github.com/cilium/cilium/pkg/k8s/watchers.(*K8sServiceWatcher).servicesInit in goroutine 1
     /go/src/github.com/cilium/cilium/pkg/k8s/watchers/service.go:101 +0x160
```

Fixes: ab8557c
Signed-off-by: Tam Mach <tam.mach@cilium.io>
@sayboras sayboras force-pushed the pr/tammach/panic-ip-mode branch from 16fd428 to 3684b8e Compare November 6, 2024 22:11
@sayboras
Copy link
Member Author

sayboras commented Nov 6, 2024

/test

@sayboras sayboras enabled auto-merge November 6, 2024 22:56
@sayboras sayboras added this pull request to the merge queue Nov 7, 2024
Merged via the queue into main with commit 6308b5e Nov 7, 2024
273 checks passed
@sayboras sayboras deleted the pr/tammach/panic-ip-mode branch November 7, 2024 00:47
@maintainer-s-little-helper maintainer-s-little-helper bot added ready-to-merge This PR has passed all tests and received consensus from code owners to merge. labels Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/bug This PR fixes an issue in a previous release of Cilium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants