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

Negative revisionHistoryLimit causes panic #21691

Open
3 tasks done
jplitza opened this issue Jan 28, 2025 · 0 comments
Open
3 tasks done

Negative revisionHistoryLimit causes panic #21691

jplitza opened this issue Jan 28, 2025 · 0 comments
Labels

Comments

@jplitza
Copy link

jplitza commented Jan 28, 2025

Checklist:

  • I've searched in the docs and FAQ for my answer: https://bit.ly/argocd-faq.
  • I've included steps to reproduce the bug.
  • I've pasted the output of argocd version.

Describe the bug

When spec.revisionHistoryLimit is negative, a panic occurs during syncing.

To Reproduce

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: repro
spec:
  destination:
    namespace: default
    server: https://kubernetes.default.svc
  project: default
  source:
    chart: argo-cd
    repoURL: ghcr.io/argoproj/argo-helm
  revisionHistoryLimit: -1

Afterwards, sync.

Expected behavior

A readable error message pointing out that negative values are not allowed.

OR

Silently interpreting the revisionHistoryLimit as 0.

Screenshots

Version

Paste the output from `argocd version` here.
{
    "Version": "v2.13.3+a25c8a0.dirty",
    "BuildDate": "2025-01-24T08:27:01Z",
    "GitCommit": "a25c8a0eef7830be0c2c9074c92dbea8ff23a962",
    "GitTreeState": "dirty",
    "GoVersion": "go1.23.5",
    "Compiler": "gc",
    "Platform": "linux/amd64",
    "KustomizeVersion": "(devel) unknown",
    "HelmVersion": "v3.17.0+g301108e",
    "KubectlVersion": "v0.31.0",
    "JsonnetVersion": "v0.20.0"
}

Logs

Recovered from panic: runtime error: slice bounds out of range [5:4]
goroutine 256 [running]:
runtime/debug.Stack()
	/opt/bitnami/go/src/runtime/debug/stack.go:26 +0x6b
github.com/argoproj/argo-cd/v2/controller.(*ApplicationController).processRequestedAppOperation.func1()
	/bitnami/blacksmith-sandox/argo-cd-2.13.3/src/github.com/argoproj/argo-cd/controller/appcontroller.go:1323 +0x6f
panic({0x64bf7c0?, 0xc00c0b8420?})
	/opt/bitnami/go/src/runtime/panic.go:785 +0x136
github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1.RevisionHistories.Trunc({0xc0194d6008, 0x4, 0x4}, 0xffffffffffffffff)
	/bitnami/blacksmith-sandox/argo-cd-2.13.3/src/github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1/types.go:1132 +0xbb
github.com/argoproj/argo-cd/v2/controller.(*appStateManager).persistRevisionHistory(0xc00032d6c0, 0xc01bafa408, {0xc0263d6fc0, 0x14}, {{0xc00cdce840, 0x1b}, {0x0, 0x0}, {0xc001bf8d10, 0xd}, ...}, ...)
	/bitnami/blacksmith-sandox/argo-cd-2.13.3/src/github.com/argoproj/argo-cd/controller/state.go:1005 +0x73a
github.com/argoproj/argo-cd/v2/controller.(*appStateManager).SyncAppState(0xc00032d6c0, 0xc01bafa408, 0xc0014166e0)
	/bitnami/blacksmith-sandox/argo-cd-2.13.3/src/github.com/argoproj/argo-cd/controller/sync.go:438 +0x550a
github.com/argoproj/argo-cd/v2/controller.(*ApplicationController).processRequestedAppOperation(0xc000704700, 0xc01bafa408)
	/bitnami/blacksmith-sandox/argo-cd-2.13.3/src/github.com/argoproj/argo-cd/controller/appcontroller.go:1381 +0xde2
github.com/argoproj/argo-cd/v2/controller.(*ApplicationController).processAppOperationQueueItem(0xc000704700)
	/bitnami/blacksmith-sandox/argo-cd-2.13.3/src/github.com/argoproj/argo-cd/controller/appcontroller.go:987 +0x890
github.com/argoproj/argo-cd/v2/controller.(*ApplicationController).Run.func4()
	/bitnami/blacksmith-sandox/argo-cd-2.13.3/src/github.com/argoproj/argo-cd/controller/appcontroller.go:886 +0x25
k8s.io/apimachinery/pkg/util/wait.BackoffUntil.func1(0xc000125f20)
	/bitnami/blacksmith-sandox/kustomize-5.5.0/pkg/mod/k8s.io/[email protected]/pkg/util/wait/backoff.go:226 +0x39
k8s.io/apimachinery/pkg/util/wait.BackoffUntil(0xc000125f20, {0x7d41040, 0xc0015834a0}, 0x1, 0xc000412930)
	/bitnami/blacksmith-sandox/kustomize-5.5.0/pkg/mod/k8s.io/[email protected]/pkg/util/wait/backoff.go:227 +0xbb
k8s.io/apimachinery/pkg/util/wait.JitterUntil(0xc000125f20, 0x3b9aca00, 0x0, 0x1, 0xc000412930)
	/bitnami/blacksmith-sandox/kustomize-5.5.0/pkg/mod/k8s.io/[email protected]/pkg/util/wait/backoff.go:204 +0x76
k8s.io/apimachinery/pkg/util/wait.Until(0xc000125f20, 0x3b9aca00, 0xc000412930)
	/bitnami/blacksmith-sandox/kustomize-5.5.0/pkg/mod/k8s.io/[email protected]/pkg/util/wait/backoff.go:161 +0x2d
created by github.com/argoproj/argo-cd/v2/controller.(*ApplicationController).Run in goroutine 117
	/bitnami/blacksmith-sandox/argo-cd-2.13.3/src/github.com/argoproj/argo-cd/controller/appcontroller.go:885 +0x11ba
@jplitza jplitza added the bug Something isn't working label Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants