terraform-provider-argocd icon indicating copy to clipboard operation
terraform-provider-argocd copied to clipboard

Bug Modification of project for Application ArgoCD version = "6.1.1"

Open Ichigo97438 opened this issue 1 year ago • 6 comments

Terraform Version, ArgoCD Provider Version and ArgoCD Version

terraform {
  required_version = ">= 1.2.0, < 2.0.0"
}

    argocd = {
      source = "oboukili/argocd"
      version = "6.1.1"
    }

Affected Resource(s)

  • argocd_application

Debug Output

fatal error: concurrent map writes

goroutine 226 [running]:
github.com/oboukili/terraform-provider-argocd/argocd.resourceArgoCDProjectRead({0x38c3020, 0xc001684bd0}, 0xc001386500, {0x3029160?, 0xc0007eaf00})
        github.com/oboukili/terraform-provider-argocd/argocd/resource_argocd_project.go:127 +0x177
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0xc000eb70a0, {0x38c3058, 0xc001780e10}, 0xd?, {0x3029160, 0xc0007eaf00})
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:795 +0x12e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).RefreshWithoutUpgrade(0xc000eb70a0, {0x38c3058, 0xc001780e10}, 0xc0017a2dd0, {0x3029160, 0xc0007eaf00})
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:1089 +0x59e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadResource(0xc000008558, {0x38c3058?, 0xc001780c90?}, 0xc001786340)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:661 +0x4a5
github.com/hashicorp/terraform-plugin-mux/tf5to6server.v5tov6Server.ReadResource({{0x38d9a00?, 0xc000008558?}}, {0x38c3058?, 0xc001780c90?}, 0xc0017861c0?)
        github.com/hashicorp/[email protected]/tf5to6server/tf5to6server.go:119 +0x242
github.com/hashicorp/terraform-plugin-mux/tf6muxserver.(*muxServer).ReadResource(0x38c2fb0?, {0x38c3058?, 0xc001780960?}, 0xc0017861c0)
        github.com/hashicorp/[email protected]/tf6muxserver/mux_server_ReadResource.go:35 +0x1b5
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ReadResource(0xc0007f4be0, {0x38c3058?, 0xc001780180?}, 0xc00178e060)
        github.com/hashicorp/[email protected]/tfprotov6/tf6server/server.go:787 +0x4b1
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ReadResource_Handler({0x30ed980?, 0xc0007f4be0}, {0x38c3058, 0xc001780180}, 0xc00179c000, 0x0)
        github.com/hashicorp/[email protected]/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:431 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0003c83c0, {0x38c3058, 0xc0017800c0}, {0x38d2200, 0xc000738000}, 0xc001792000, 0xc000f45650, 0x53ecce8, 0x0)
        google.golang.org/[email protected]/server.go:1343 +0xe49
google.golang.org/grpc.(*Server).handleStream(0xc0003c83c0, {0x38d2200, 0xc000738000}, 0xc001792000)
        google.golang.org/[email protected]/server.go:1737 +0xca6
google.golang.org/grpc.(*Server).serveStreams.func1.1()
        google.golang.org/[email protected]/server.go:986 +0x8c
created by google.golang.org/grpc.(*Server).serveStreams.func1
        google.golang.org/[email protected]/server.go:997 +0x15c

goroutine 1 [select]:
github.com/hashicorp/go-plugin.Serve(0xc0000b2fc0)
        github.com/hashicorp/[email protected]/server.go:481 +0x14c5
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.Serve({0x32c9b21, 0x25}, 0xc0005cfcf0, {0x0, 0x0, 0x0})
        github.com/hashicorp/[email protected]/tfprotov6/tf6server/server.go:315 +0xcaa
main.main()
        github.com/oboukili/terraform-provider-argocd/main.go:73 +0x35e

goroutine 6 [select]:
github.com/patrickmn/go-cache.(*janitor).Run(0xc0003a8770, 0x0?)
        github.com/patrickmn/[email protected]+incompatible/cache.go:1079 +0x85
created by github.com/patrickmn/go-cache.runJanitor
        github.com/patrickmn/[email protected]+incompatible/cache.go:1099 +0xed

goroutine 52 [sleep]:
time.Sleep(0x6fc23ac00)
        runtime/time.go:195 +0x13a
sigs.k8s.io/controller-runtime/pkg/log.init.0.func1()
        sigs.k8s.io/[email protected]/pkg/log/log.go:63 +0x38
created by sigs.k8s.io/controller-runtime/pkg/log.init.0
        sigs.k8s.io/[email protected]/pkg/log/log.go:62 +0x25

goroutine 11 [select]:
github.com/hashicorp/go-plugin.(*gRPCBrokerServer).Recv(0x0?)
        github.com/hashicorp/[email protected]/grpc_broker.go:125 +0x67
github.com/hashicorp/go-plugin.(*GRPCBroker).Run(0xc000ac8360)
        github.com/hashicorp/[email protected]/grpc_broker.go:437 +0x44
created by github.com/hashicorp/go-plugin.(*GRPCServer).Init
        github.com/hashicorp/[email protected]/grpc_server.go:88 +0x545

goroutine 12 [syscall, locked to thread]:
syscall.SyscallN(0x0?, {0xc0004cbc28?, 0x0?, 0x0?})
        runtime/syscall_windows.go:557 +0x109
syscall.Syscall6(0x0?, 0x0?, 0x0?, 0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        runtime/syscall_windows.go:501 +0x50
syscall.readFile(0x0?, {0xc00030a000?, 0x1000, 0x227ed3?}, 0x2000?, 0x800000?)
        syscall/zsyscall_windows.go:1024 +0x94
syscall.ReadFile(...)
        syscall/syscall_windows.go:404
syscall.Read(0xc000964000?, {0xc00030a000?, 0xc0004cbd88?, 0x2278ab?})
        syscall/syscall_windows.go:383 +0x33
internal/poll.(*FD).Read(0xc000964000, {0xc00030a000, 0x1000, 0x1000})
        internal/poll/fd_windows.go:422 +0x1c5
os.(*File).read(...)
        os/file_posix.go:31
os.(*File).Read(0xc000972788, {0xc00030a000?, 0x400?, 0x2c09e40?})
        os/file.go:118 +0x5e
bufio.(*Reader).Read(0xc0004cbf40, {0xc000198800, 0x400, 0x0?})
        bufio/bufio.go:237 +0x1bb
github.com/hashicorp/go-plugin.copyChan({0x38e0450, 0xc0007f4aa0}, 0x0?, {0x389d9a0?, 0xc000972788?})
        github.com/hashicorp/[email protected]/grpc_stdio.go:184 +0x1f6
created by github.com/hashicorp/go-plugin.newGRPCStdioServer
        github.com/hashicorp/[email protected]/grpc_stdio.go:40 +0xf5

goroutine 13 [syscall, locked to thread]:
syscall.SyscallN(0x0?, {0xc000f4dc28?, 0x0?, 0x0?})
        runtime/syscall_windows.go:557 +0x109
syscall.Syscall6(0x27f193?, 0x239c45?, 0xc000f4dc88?, 0x26a7e683208?, 0x239ca0?, 0x545d860?, 0x1?, 0xc000f4dc80?)
        runtime/syscall_windows.go:501 +0x50

Steps to Reproduce

Create a argocd project different than default Create an application argocd and use the project created different than default

Expected Behavior

argocd application should be in project different than default

Actual Behavior

Plugin crash and no modification With plugin argocd in version 6.1.0 it's work fine

Ichigo97438 avatar Jun 26 '24 12:06 Ichigo97438

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Oct 02 '24 12:10 github-actions[bot]

Hi @Ichigo97438

Would it be possible to share some details:

  • TF code of both the project and the application
  • Argo CD version used
  • Kubernetes Cluster version used

?

Thank you 🙏

mkilchhofer avatar Oct 14 '24 09:10 mkilchhofer

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Dec 13 '24 12:12 github-actions[bot]

Ran into similar intermittent issues. Would not be able to provide the tf code (proprietary, and too large to isolate a specific minimum working example) but this run was deleting an ArgoCD Project and moving the cluster to another existing one (a TF destroy + update) along with an unrelated ArgoCD application update (git branch change). ArgoCD version: 2.4.28, K8s (GKE) version: v1.31.6-gke.1020000

│ Error: Plugin did not respond
│ 
│ The plugin encountered an error, and failed to respond to the
│ plugin6.(*GRPCProvider).ReadResource call. The plugin logs may contain more
│ details.
╵
Stack trace from the terraform-provider-argocd_v7.0.3 plugin:
fatal error: concurrent map read and map write
goroutine 529 [running]:
github.com/oboukili/terraform-provider-argocd/argocd.resourceArgoCDProjectRead({0x3c00320, 0xc00017ba40}, 0xc0018fa680, {0x32d5ec0?, 0xc000a7fb80})
	github.com/oboukili/terraform-provider-argocd/argocd/resource_argocd_project.go:126 +0x13f
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0xc0009500e0, {0x3c00278, 0xc0016c2150}, 0xd?, {0x32d5ec0, 0xc000a7fb80})
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:823 +0x11b
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).RefreshWithoutUpgrade(0xc0009500e0, {0x3c00278, 0xc0016c2150}, 0xc00180e0d0, {0x32d5ec0, 0
xc000a7fb80})
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:1117 +0x552
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadResource(0xc000566018, {0x3c00278?, 0xc0016c2000?}, 0xc001babb00)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:708 +0x6ca
github.com/hashicorp/terraform-plugin-mux/tf5to6server.v5tov6Server.ReadResource({{0x3c1b840?, 0xc000566018?}}, {0x3c00278?, 0xc0016c2000?}, 0xc001bab940?)
	github.com/hashicorp/[email protected]/tf5to6server/tf5to6server.go:153 +0x2ab
github.com/hashicorp/terraform-plugin-mux/tf6muxserver.(*muxServer).ReadResource(0x3c002b0?, {0x3c00278?, 0xc0016a1ce0?}, 0xc001bab940)
	github.com/hashicorp/[email protected]/tf6muxserver/mux_server_ReadResource.go:35 +0x193
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ReadResource(0xc0009b80a0, {0x3c00278?, 0xc0016a14d0?}, 0xc00017af50)
	github.com/hashicorp/[email protected]/tfprotov6/tf6server/server.go:784 +0x309
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ReadResource_Handler({0x340da20?, 0xc0009b80a0}, {0x3c00278, 0xc0016a14d0}, 0xc00
0397c80, 0x0)
	github.com/hashicorp/[email protected]/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:482 +0x169
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0009d8000, {0x3c00278, 0xc0016a1440}, {0x3c0f940, 0xc000860180}, 0xc0015826c0, 0xc000cd6240, 0x5904828, 0x0)
	google.golang.org/[email protected]/server.go:1369 +0xe23
google.golang.org/grpc.(*Server).handleStream(0xc0009d8000, {0x3c0f940, 0xc000860180}, 0xc0015826c0)
	google.golang.org/[email protected]/server.go:1780 +0x1016
google.golang.org/grpc.(*Server).serveStreams.func2.1()
	google.golang.org/[email protected]/server.go:1019 +0x8b
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 42
	google.golang.org/[email protected]/server.go:1030 +0x135
goroutine 1 [select]:
github.com/hashicorp/go-plugin.Serve(0xc00014e600)
	github.com/hashicorp/[email protected]/server.go:503 +0x1739
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.Serve({0x35a0ad9, 0x25}, 0xc000050630, {0x0, 0x0, 0x0})
	github.com/hashicorp/[email protected]/tfprotov6/tf6server/server.go:316 +0xbaf
main.main()
	github.com/oboukili/terraform-provider-argocd/main.go:73 +0x334
goroutine 17 [select]:
github.com/desertbit/timer.timerRoutine()
	github.com/desertbit/[email protected]/timers.go:119 +0xb2
created by github.com/desertbit/timer.init.0 in goroutine 1
	github.com/desertbit/[email protected]/timers.go:15 +0x1a
goroutine 21 [select]:
go.opencensus.io/stats/view.(*worker).start(0xc000397a00)
	[email protected]/stats/view/worker.go:292 +0x9f
created by go.opencensus.io/stats/view.init.0 in goroutine 1
	[email protected]/stats/view/worker.go:34 +0x8d
goroutine 22 [sleep]:
time.Sleep(0x6fc23ac00)
	runtime/time.go:195 +0x125
sigs.k8s.io/controller-runtime/pkg/log.init.0.func1()
	sigs.k8s.io/[email protected]/pkg/log/log.go:63 +0x2d
created by sigs.k8s.io/controller-runtime/pkg/log.init.0 in goroutine 1
	sigs.k8s.io/[email protected]/pkg/log/log.go:62 +0x1a
goroutine 24 [select]:
github.com/patrickmn/go-cache.(*janitor).Run(0xc0002cdc30, 0xc00014e600?)
	github.com/patrickmn/[email protected]+incompatible/cache.go:1079 +0x7d
created by github.com/patrickmn/go-cache.runJanitor in goroutine 1
	github.com/patrickmn/[email protected]+incompatible/cache.go:1099 +0xdb
goroutine 33 [select]:
github.com/hashicorp/go-plugin.(*gRPCBrokerServer).Recv(0xc00014e658?)
	github.com/hashicorp/[email protected]/grpc_broker.go:128 +0x65
github.com/hashicorp/go-plugin.(*GRPCBroker).Run(0xc000844e70)
	github.com/hashicorp/[email protected]/grpc_broker.go:582 +0x4f
created by github.com/hashicorp/go-plugin.(*GRPCServer).Init in goroutine 1
	github.com/hashicorp/[email protected]/grpc_server.go:91 +0x59f
goroutine 43 [select]:
github.com/hashicorp/go-plugin.(*grpcStdioServer).StreamStdio(0xc000051d60, 0x31532e0?, {0x3c0c6f0, 0xc0002f30e0})
	github.com/hashicorp/[email protected]/grpc_stdio.go:61 +0x111
github.com/hashicorp/go-plugin/internal/plugin._GRPCStdio_StreamStdio_Handler({0x2f535e0?, 0xc000051d60}, {0x3c07500, 0xc0002484b0})
	github.com/hashicorp/[email protected]/internal/plugin/grpc_stdio_grpc.pb.go:117 +0xd0
google.golang.org/grpc.(*Server).processStreamingRPC(0xc0009d8000, {0x3c00278, 0xc000cd6ff0}, {0x3c0f940, 0xc000860180}, 0xc000abb7a0, 0xc000cd60f0, 0x58ed2c0, 0
x0)
	google.golang.org/[email protected]/server.go:1663 +0x1288
google.golang.org/grpc.(*Server).handleStream(0xc0009d8000, {0x3c0f940, 0xc000860180}, 0xc000abb7a0)
	google.golang.org/[email protected]/server.go:1784 +0xfc5
google.golang.org/grpc.(*Server).serveStreams.func2.1()
	google.golang.org/[email protected]/server.go:1019 +0x8b
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 42
	google.golang.org/[email protected]/server.go:1030 +0x135
goroutine 34 [IO wait]:
internal/poll.runtime_pollWait(0x7e1a78408d90, 0x72)
	runtime/netpoll.go:343 +0x85
internal/poll.(*pollDesc).wait(0xc00014f680?, 0xc000867000?, 0x1)
	internal/poll/fd_poll_runtime.go:84 +0x27
internal/poll.(*pollDesc).waitRead(...)
	internal/poll/fd_poll_runtime.go:89
internal/poll.(*FD).Read(0xc00014f680, {0xc000867000, 0x1000, 0x1000})
	internal/poll/fd_unix.go:164 +0x27a
os.(*File).read(...)
	os/file_posix.go:29
os.(*File).Read(0xc0005b4250, {0xc000867000?, 0x400?, 0x2e7d220?})
	os/file.go:118 +0x52
bufio.(*Reader).Read(0xc00004e740, {0xc0008f0800, 0x400, 0x0?})
	bufio/bufio.go:244 +0x197
github.com/hashicorp/go-plugin.copyChan({0x3c1ef10, 0xc00087e000}, 0x0?, {0x3bcdda0?, 0xc0005b4250?})
	github.com/hashicorp/[email protected]/grpc_stdio.go:184 +0x1f6
Error: The terraform-provider-argocd_v7.0.3 plugin crashed!
This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.

adyanth avatar Mar 19 '25 20:03 adyanth

I tried reproducing this issue by creating a project/application and then changing things in both resources at the same time but had no success reproducing the provider crash. It would be helpful to have some more hints how to reproduce.

the-technat avatar May 06 '25 14:05 the-technat

Yeah I really could not reproduce it 100% of the time myself, and since it is part of a bigger module, I couldn't provide a specific example either. Hoping maybe the stack trace could point somewhere, since a concurrent map r/w is a ticking problem waiting to happen.

adyanth avatar May 06 '25 14:05 adyanth

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Jul 06 '25 12:07 github-actions[bot]