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

Panic while using bitbucketserver provider for git commit status #700

Closed
Tracked by #4556
gdasson opened this issue Dec 29, 2023 · 3 comments · Fixed by #722
Closed
Tracked by #4556

Panic while using bitbucketserver provider for git commit status #700

gdasson opened this issue Dec 29, 2023 · 3 comments · Fixed by #722
Labels
area/alerting Alerting related issues and PRs bug Something isn't working

Comments

@gdasson
Copy link
Contributor

gdasson commented Dec 29, 2023

Describe the bug

The support for Bitbucket Server/Datacenter as a provider for git commit status was introduced by this PR

Unfortunately, while testing the code using self signed certificates, I noticed a bug in the code that's causing a panic: runtime error: invalid memory address or nil pointer dereference error

To Reproduce:

Steps to reproduce the behavior:

  1. Enable bitbucket server provider for git commit status like below:
apiVersion: notification.toolkit.fluxcd.io/v1beta3
kind: Provider
metadata:
  name: server-commit-status-provider
  namespace: flux-system
spec:
  address: https://test.internal.server:8443/scm/foo/bar.git
  secretRef:
    name: token
  type: bitbucketserver
  1. The certificate for the server is self signed, but certSecretRef was not provided

Current Actual behavior:

Notification controller dies with a panic error:

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

goroutine 236 [running]:
github.com/fluxcd/notification-controller/internal/notifier.BitbucketServer.duplicateBitbucketServerStatus({{0x40007d3766, 0x5}, {0x40007d376c, 0xd}, {0x40006db680, 0x24}, {0x40007d3740, 0x3d}, {0x400071cb70, 0x21}, ...}, ...)
	github.com/fluxcd/notification-controller/internal/notifier/bitbucketserver.go:195 +0x258
github.com/fluxcd/notification-controller/internal/notifier.BitbucketServer.Post({{0x40007d3766, 0x5}, {0x40007d376c, 0xd}, {0x40006db680, 0x24}, {0x40007d3740, 0x3d}, {0x400071cb70, 0x21}, ...}, ...)
	github.com/fluxcd/notification-controller/internal/notifier/bitbucketserver.go:155 +0x3a8
github.com/fluxcd/notification-controller/internal/server.(*EventServer).dispatchNotification.func1({0x2008500, 0x4000523e60}, {{{0x40007c6870, 0xd}, {0x40007c6880, 0xb}, {0x40007be588, 0x18}, {0x40006daf60, 0x24}, ...}, ...})
	github.com/fluxcd/notification-controller/internal/server/event_handlers.go:210 +0xc0
created by github.com/fluxcd/notification-controller/internal/server.(*EventServer).dispatchNotification in goroutine 234
	github.com/fluxcd/notification-controller/internal/server/event_handlers.go:207 +0x1d0

Expected behavior:

Notification controller should handle the issue gracefully and emit an error message in its logs

Current workaround:

Please make sure to specify certSecretRef (a valid CA cert) to trust the self signed cert

@stefanprodan
Copy link
Member

Can you please post here the whole message including the stack trace.

@stefanprodan stefanprodan added bug Something isn't working area/alerting Alerting related issues and PRs labels Dec 29, 2023
@gdasson
Copy link
Contributor Author

gdasson commented Dec 29, 2023

@stefanprodan : Sure, will do that. I am already testing the fix for it in my env and will soon be submitting a PR to close this issue, since I was the author of that initial PR that introduced this functionality. I just reported this issue for awareness.

@gdasson
Copy link
Contributor Author

gdasson commented Dec 30, 2023

@stefanprodan : Edited the original issue text above to show error with stack trace. I have submitted a PR to fix this bug and added more enhancements.

@stefanprodan stefanprodan changed the title Notification controller panic bug while using bitbucketserver provider for git commit status Panic while using bitbucketserver provider for git commit status Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/alerting Alerting related issues and PRs bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants