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

Erronous sync window definition in appproject causes nul pointer dereference when syncing apps #10071

Open
3 tasks done
markbenschop opened this issue Jul 21, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@markbenschop
Copy link

markbenschop commented Jul 21, 2022

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 in an appproject object a sync window is defined with an hour value that is not correct, e.g. 6-24 instead of 6-0, syncing of apps in the appproject fail on the cli. An error is thrown on the cli and in the argocd-server logs. The error shows that the sync failed but leaves no indication what the cause is.

I have tested this with versions 2.4.3, 2.4.6 and 2.4.7.

To Reproduce

In an appproject define a sync window with an incorrect time schedule. E.g.

apiVersion: argoproj.io/v1alpha1
kind: AppProject
metadata:
  name: debug-container
  namespace: argocd
spec:
  destinations:
  - namespace: default
    server: https://kubernetes.default.svc
  sourceRepos:
  - https://git.example.com/myaccount/k8s-gitops-environment
  syncWindows:
  - clusters:
    - '*'
    - ""
    duration: 1h
    kind: allow
    manualSync: true
    schedule: '* 7-24 * * 0-6'
    timeZone: Europe/Amsterdam

The error being the '24'. Valid values are 0-23.
After doing this all apps that are in the project can't be synced both on the cli and webui.

Expected behavior
Maybe an error pointing out that the sync window schedule is incorrect.

Version

argocd version                 
argocd: v2.4.7+81630e6
  BuildDate: 2022-07-18T21:38:56Z
  GitCommit: 81630e6d5075ac53ac60457b51343c2a09a666f4
  GitTreeState: clean
  GoVersion: go1.18.3
  Compiler: gc
  Platform: linux/amd64
argocd-server: v2.4.7+81630e6
  BuildDate: 2022-07-18T21:17:35Z
  GitCommit: 81630e6d5075ac53ac60457b51343c2a09a666f4
  GitTreeState: clean
  GoVersion: go1.18.4
  Compiler: gc
  Platform: linux/amd64
  Kustomize Version: v4.4.1 2021-11-11T23:36:27Z
  Helm Version: v3.8.1+g5cb9af4
  Kubectl Version: v0.23.1
  Jsonnet Version: v0.18.0

Logs

The argocd cli gives an error:

argocd app sync debug-container
FATA[0000] rpc error: code = Internal desc = runtime error: invalid memory address or nil pointer dereference 

In the argocd-server this is logged :

time="2022-07-21T07:24:44Z" level=error msg="Recovered from panic: runtime error: invalid memory address or nil pointer dereference\ngoroutine 2794 [running]:\nruntime/debug.Stack()\n\t/usr/local/go/src/runtime/debug/stack.go:24 +0x65\ngithub.com/argoproj/argo-cd/v2/util/grpc.PanicLoggerUnaryServerInterceptor.func1.1()\n\t/go/src/github.com/argoproj/argo-cd/util/grpc/grpc.go$26 +0x5d\npanic({0x2d80c80, 0x5e38d20})\n\t/usr/local/go/src/runtime/panic.go:838 +0x207\ngithub.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1.(*SyncWindows).active(0xc000a2b168, {0x40d927?, 0x38?, 0x60509e0?})\n\t/go/src/github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1/types.go:1722 +0x1de\ngithub.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1.(*SyncWindows).Active(0x0?)\n\t/go/src/github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1/types.go:1704 +0x31\ngithub.com/argoproj/argo-cd/v2/server/project.(*Server).GetSyncWindowsState(0xc000b925a0, {0x44a1268, 0xc0010ecc90}, 0xc000a96270)\n\t/go/src/github.com/argoproj/argo-cd/server/project/project.go:451 +0x1d5\ngithub.com/argoproj/argo-cd/v2/pkg/apiclient/project._ProjectService_GetSyncWindowsState_Handler.func1({0x44a1268, 0xc0010ecc90}, {0x3101ec0?, 0xc000a96270})\n\t/go/src/github.com/argoproj/argo-cd/pkg/apiclient/project/project.pb.go:1123 +0x78\ngithub.com/argoproj/argo-cd/v2/util/grpc.PanicLoggerUnaryServerInterceptor.func1({0x44a1268?, 0xc0010ecc90?}, {0x3101ec0?, 0xc000a96270?}, 0x8b?, 0x32e8937?)\n\t/go/src/github.com/argoproj/argo-cd/util/grpc/grpc.go:30 +0x97\ngithub.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1.1({0x44a1268?, 0xc0010ecc90?}, {0x3101ec0?, 0xc000a96270?})\n\t/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.3.0/chain.go:25 +0x3a\ngithub.com/argoproj/argo-cd/v2/util/grpc.ErrorCodeGitUnaryServerInterceptor.func1({0x44a1268?, 0xc0010ecc90?}, {0x3101ec0?, 0xc000a96270?}, 0x0?, 0x2c1d140?)\n\t/go/src/github.com/argoproj/argo-cd/util/grpc/errors.go:102 +0x30\ngithub.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1.1({0x44a1268?, 0xc0010ecc90?}, {0x3101ec0?, 0xc000a96270?})\n\t/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.3.0/chain.go:25 +0x3a\ngithub.com/argoproj/argo-cd/v2/util/grpc.ErrorCodeK8sUnaryServerInterceptor.func1({0x44a1268?, 0xc0010ecc90?}, {0x3101ec0?, 0xc000a96270?}, 0x0?, 0x0?)\n\t/go/src/github.com/argoproj/argo-cd/util/grpc/errors.go:118 +0x30\ngithub.com/grpc-ecosystem/go-g
rpc-middleware.ChainUnaryServer.func1.1.1({0x44a1268?, 0xc0010ecc90?}, {0x3101ec0?, 0xc000a96270?})\n\t/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.3.0/chain.go:25 +0x3a\ngithub.com/argoproj/argo-cd/v2/util/grpc.PayloadUnaryServerInterceptor.func1({0x44a1268, 0xc0010ecc90}, {0x3101ec0, 0xc000a96270}, 0xc0011b20a0, 0xc0011b2120)\n\t/go/src/github.com/argoproj/argo-cd/util/grpc/logging.go:80 +0x15a\ngithub.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1.1({0x44a1268?, 0xc0010ecc90?}, {0x3101ec0?, 0xc000a96270?})\n\t/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.3.0/chain.go:25 +0x3a\ngithub.com/argoproj/argo-cd/v2/util/grpc.UserAgentUnaryServerInterceptor.func1({0x44a1268, 0xc0010ecc90}, {0x3101ec0, 0xc000a96270}, 0x44a1268?, 0xc0011b2140)\n\t/go/src/github.com/argoproj/argo-cd/util/grpc/useragent.go:25 +0x8a\ngithub.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1.1({0x44a1268?, 0xc0010ecc90?}, {0x3101ec0?, 0xc000a96270?})\n\t/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.3.0/chain.go:25 +0x3a\ngithub.com/grpc-ecosystem/go-grpc-middleware/auth.UnaryServerInterceptor.func1({0x44a1268, 0xc000a96450}, {0x3101ec0, 0xc000a96270}, 0xc0011b20a0, 0xc0011b2160)\n\t/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.3.0/auth/auth.go:47 +0xba\ngithub.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1.1({0x44a1268?, 0xc000a96450?}, {0x3101ec0?, 0xc000a96270?})\n\t/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.3.0/chain.go:25 +0x3a\ngithub.com/grpc-ecosystem/go-grpc-prometheus.(*ServerMetrics).UnaryServerInterceptor.func1({0x44a1268, 0xc000a96450}, {0x3101ec0, 0xc000a96270}, 0x0?, 0xc0011b21a0)\n\t/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-prometheus@v1.2.0/server_metrics.go:107 +0x87\ngithub.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1.1({0x44a1268?, 0xc000a96450?}, {0x3101ec0?, 0xc000a96270?})\n\t/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.3.0/chain.go:25 +0x3a\ngithub.com/grpc-ecosystem/go-grpc-middleware/logging/logrus.UnaryServerInterceptor.func1({0x44a1268, 0xc000a96360}, {0x3101ec0, 0xc000a96270}, 0xc0011b20a0, 0xc0011b21c0)\n\t/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.3.0/logging/logrus/server_interceptors.go:31 +0x102\ngithub.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1.1({0x44a1268?, 0xc000a96360?}, {0x3101ec0?, 0xc000a96270?})\n\t/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.3.0/chain.go:25 +0x3a\ngo.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc.UnaryServerInterceptor.func1({0x44a1268, 0xc000a96240}, {0x3101ec0, 0xc000a96270}, 0xc0011b20a0, 0xc0011b21e0)\n\t/go/pkg/mod/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc@v0.31.0/interceptor.go:325 +0x664\ngithub.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1.1({0x44a1268?, 0xc000a96240?}, {0x3101ec0?, 0xc000a96270?})\n\t/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.3.0/chain.go:25 +0x3a\ngithub.com/argoproj/argo-cd/v2/server.bug21955WorkaroundInterceptor({0x44a1268, 0xc000a96240}, {0x3101ec0?, 0xc000a96270?}, 0x7f74163c65c0?, 0xc0011b2200)\n\t/go/src/github.com/argoproj/argo-cd/server/server.go:1221 +0x502\ngithub.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1.1({0x44a1268?, 0xc000a96240?}, {0x3101ec0?, 0xc000a96270?})\n\t/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.3.0/chain.go:25 +0x3a\ngithub.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1({0x44a1268, 0xc000a96240}, {0x3101ec0, 0xc000a96270}, 0xc001ae1af8?, 0x2d7efa0?)\n\t/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.3.0/chain.go:34 +0xbf\ngithub.com/argoproj/argo-cd/v2/pkg/apiclient/project._ProjectService_GetSyncWindowsState_Handler({0x30d6a00?, 0xc000b925a0}, {0x44a1268, 0xc000a96240}, 0xc0019ae060, 0xc000e7e5d0)\n\t/go/src/github.com/argoproj/argo-cd/pkg/apiclient/projec
t/project.pb.go:1125 +0x138\ngoogle.golang.org/grpc.(*Server).processUnaryRPC(0xc00069bc00, {0x44ac0a8, 0xc000dcf520}, 0xc000252480, 0xc000e7ecc0, 0x6007430, 0x0)\n\t/go/pkg/mod/google.gola
ng.org/grpc@v1.45.0/server.go:1282 +0xccf\ngoogle.golang.org/grpc.(*Server).handleStream(0xc00069bc00, {0x44ac0a8, 0xc000dcf520}, 0xc000252480, 0x0)\n\t/go/pkg/mod/google.golang.org/grpc@v1
.45.0/server.go:1619 +0xa1b\ngoogle.golang.org/grpc.(*Server).serveStreams.func1.2()\n\t/go/pkg/mod/google.golang.org/grpc@v1.45.0/server.go:921 +0x98\ncreated by google.golang.org/grpc.(*S
erver).serveStreams.func1\n\t/go/pkg/mod/google.golang.org/grpc@v1.45.0/server.go:919 +0x28a\n"
time="2022-07-21T07:24:44Z" level=error msg="finished unary call with code Internal" error="rpc error: code = Internal desc = runtime error: invalid memory address or nil pointer dereferenc
e" grpc.code=Internal grpc.method=GetSyncWindowsState grpc.service=project.ProjectService grpc.start_time="2022-07-21T07:24:44Z" grpc.time_ms=8.912 span.kind=server system=grpc
@markbenschop markbenschop added the bug Something isn't working label Jul 21, 2022
@crenshaw-dev crenshaw-dev added the GraceHopperOSD2022 Good for 2022 Grace Hopper Celebration Open Source Day label Sep 14, 2022
@crenshaw-dev crenshaw-dev removed the GraceHopperOSD2022 Good for 2022 Grace Hopper Celebration Open Source Day label Oct 7, 2022
@hontarenko
Copy link

hontarenko commented Nov 7, 2022

@crenshaw-dev, any updates?

Version argo server - quay.io/argoproj/argocd:v2.4.11

Command:
argocd app wait ${{ env.APP }} --operation --plaintext && argocd app sync ${{ env.APP }} --plaintext && argocd app wait ${{ env.APP }} --health --plaintext

Error:

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

goroutine 1 [running]:
github.com/argoproj/argo-cd/v2/cmd/argocd/commands.NewApplicationSyncCommand.func1(0xc000e30c80?, {0xc000dd9200, 0x1, 0x2})
	/home/runner/work/argo-cd/argo-cd/cmd/argocd/commands/app.go:1537 +0x1966
github.com/spf13/cobra.(*Command).execute(0xc000e30c80, {0xc000dd91e0, 0x2, 0x2})
	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:860 +0x663
github.com/spf13/cobra.(*Command).ExecuteC(0xc000df0000)
	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:974 +0x3b4
github.com/spf13/cobra.(*Command).Execute(...)
	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:902
main.main()
	/home/runner/work/argo-cd/argo-cd/cmd/main.go:57 +0x2c5
Error: Process completed with exit code 2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants