citrix / terraform-provider-citrix

Terraform Provider for Citrix
https://registry.terraform.io/providers/citrix/citrix/latest
Apache License 2.0
46 stars 6 forks source link

citrix_daas_hypervisor_resource_pool - for_each #15

Closed lahavana closed 11 months ago

lahavana commented 1 year ago

Hello,

I tried the new verison 0.3.2 today and the issue is still the same as with 0.3.1. If citrix_daas_hypervisor_resource_pool is used in combination with for_each (the goal is to create 19 virtual networks for one hosting connection) the plugin crashes after creating 10 of the 19 networks.

If I run it multiple times, all networks are created but maybe the stack trace helps to further improve your great work!

Stack trace from the terraform-provider-citrix_v0.3.2.exe plugin:

fatal error: concurrent map writes

goroutine 22 [running]: github.com/hashicorp/terraform-plugin-log/internal/logging.LoggerOpts.ApplyMask({{0x0, 0x0}, 0x0, 0x0, 0x0, {0x0, 0x0}, 0x0, 0xba98980, 0x0, ...}, ...)
github.com/hashicorp/terraform-plugin-log@v0.9.0/internal/logging/filtering.go:57 +0x5d8 github.com/hashicorp/terraform-plugin-log/internal/logging.OmitOrMask({{0x0, 0x0}, 0x0, 0x0, 0x0, {0x0, 0x0}, 0x0, 0xba98980, 0x0, ...}, ...) github.com/hashicorp/terraform-plugin-log@v0.9.0/internal/logging/filtering.go:118 +0x20d github.com/hashicorp/terraform-plugin-log/tflog.Info({0x19a2154, 0xba9c9a8}, {0x183b84f, 0x19}, {0xb96043c, 0x1, 0x1}) github.com/hashicorp/terraform-plugin-log@v0.9.0/tflog/provider.go:86 +0xd1 github.com/citrix/terraform-provider-citrix/internal/provider.getClientInterceptor.func1(0xba924d0, 0xbbda280) github.com/citrix/terraform-provider-citrix/internal/provider/provider.go:144 +0x4a2 github.com/citrix/citrix-daas-rest-go/client.NewCitrixDaasClient.func1(0xbbda280) github.com/citrix/citrix-daas-rest-go@v0.2.4/client/citrixdaas_client.go:31 +0x2a github.com/citrix/citrix-daas-rest-go/citrixorchestration.(APIClient).prepareRequest(0xbad6100, {0x19a2154, 0xb85f548}, {0xbb3c000, 0x64}, {0x1822dd5, 0x3}, {0x0, 0x0}, 0xb960788, ...) github.com/citrix/citrix-daas-rest-go@v0.2.4/citrixorchestration/client.go:504 +0xc38 github.com/citrix/citrix-daas-rest-go/citrixorchestration.(HypervisorsAPIsDAASService).HypervisorsGetHypervisorAllResourcesExecute(0xbad6104, {{0x19a2154, 0xb85f548}, 0xbad6104, 0xb8ec248, 0xb8ec268, {0xbe28060, 0x24}, 0xb8ec288, 0x0, ...}) github.com/citrix/citrix-daas-rest-go@v0.2.4/citrixorchestration/api_hypervisors_apis.go:2925 +0xc2c github.com/citrix/citrix-daas-rest-go/citrixorchestration.ApiHypervisorsGetHypervisorAllResourcesRequest.Execute(...) github.com/citrix/citrix-daas-rest-go@v0.2.4/citrixorchestration/api_hypervisors_apis.go:2790 github.com/citrix/terraform-provider-citrix/internal/util.GetSingleResourcePath({0x19a2154, 0xb85f548}, 0xba924d0, {0xbe28060, 0x24}, {0x0, 0x0}, {0xb8983a0, 0xb}, {0x0, ...}, ...) github.com/citrix/terraform-provider-citrix/internal/util/resource.go:58 +0x2b5 github.com/citrix/terraform-provider-citrix/internal/daas.(hypervisorResourcePoolResource).Create(0xbdbc498, {0x19a2154, 0xb85f548}, {{{{0x19a4048, 0xb88ad08}, {0x1694760, 0xb89c880}}, {0x19a4a80, 0xb890150}}, {{{0x19a4048, ...}, ...}, ...}, ...}, ...) github.com/citrix/terraform-provider-citrix/internal/daas/hypervisor_resource_pool_resource.go:187 +0x5ce github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(Server).CreateResource(0xb902e00, {0x19a2154, 0xb85f548}, 0xb96194c, 0xb96191c) github.com/hashicorp/terraform-plugin-framework@v1.4.2/internal/fwserver/server_createresource.go:101 +0x575 github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(Server).ApplyResourceChange(0xb902e00, {0x19a2154, 0xb85f548}, 0xbb96030, 0xb961a10)
github.com/hashicorp/terraform-plugin-framework@v1.4.2/internal/fwserver/server_applyresourcechange.go:57 +0x40a github.com/hashicorp/terraform-plugin-framework/internal/proto6server.(
Server).ApplyResourceChange(0xb902e00, {0x19a2154, 0xbd482e8}, 0xb85c150) github.com/hashicorp/terraform-plugin-framework@v1.4.2/internal/proto6server/server_applyresourcechange.go:55 +0x463 github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(server).ApplyResourceChange(0xb87ae60, {0x19a2154, 0xbd48018}, 0xbe2e040) github.com/hashicorp/terraform-plugin-go@v0.19.0/tfprotov6/tf6server/server.go:857 +0x583 github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ApplyResourceChange_Handler({0x17b09a0, 0xb87ae60}, {0x19a2154, 0xbd48018}, 0xbe2e000, 0x0) github.com/hashicorp/terraform-plugin-go@v0.19.0/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:467 +0x18a google.golang.org/grpc.(Server).processUnaryRPC(0xb93a780, {0x19a2154, 0xbc59d88}, {0x19a4138, 0xb900900}, 0xb8d63c0, 0xb935d58, 0x23953ec, 0x0) google.golang.org/grpc@v1.59.0/server.go:1343 +0xf68 google.golang.org/grpc.(Server).handleStream(0xb93a780, {0x19a4138, 0xb900900}, 0xb8d63c0) google.golang.org/grpc@v1.59.0/server.go:1737 +0xd03 google.golang.org/grpc.(Server).serveStreams.func1.1() google.golang.org/grpc@v1.59.0/server.go:986 +0xa7 created by google.golang.org/grpc.(*Server).serveStreams.func1 google.golang.org/grpc@v1.59.0/server.go:997 +0x16b

goroutine 1 [select]: github.com/hashicorp/go-plugin.Serve(0xb85c960) github.com/hashicorp/go-plugin@v1.5.2/server.go:481 +0x1555 github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.Serve({0x1848b42, 0x23}, 0xb8705d0, {0x0, 0x0, 0x0}) github.com/hashicorp/terraform-plugin-go@v0.19.0/tfprotov6/tf6server/server.go:315 +0xc44 github.com/hashicorp/terraform-plugin-framework/providerserver.Serve({0x19a2114, 0xb82a050}, 0xb808e00, {{0x1848b42, 0x23}, 0x0, 0x0}) github.com/hashicorp/terraform-plugin-framework@v1.4.2/providerserver/providerserver.go:114 +0x2cc main.main() github.com/citrix/terraform-provider-citrix/main.go:30 +0x155

goroutine 6 [select]: github.com/hashicorp/go-plugin.(gRPCBrokerServer).Recv(0xb935c68) github.com/hashicorp/go-plugin@v1.5.2/grpc_broker.go:125 +0x8c github.com/hashicorp/go-plugin.(GRPCBroker).Run(0xb87adc0) github.com/hashicorp/go-plugin@v1.5.2/grpc_broker.go:437 +0x3d created by github.com/hashicorp/go-plugin.(*GRPCServer).Init github.com/hashicorp/go-plugin@v1.5.2/grpc_server.go:88 +0x4f3

goroutine 7 [syscall, locked to thread]: syscall.SyscallN(0x75e8ee10, {0xb84bdfc, 0x6, 0x6}) runtime/syscall_windows.go:557 +0x11d syscall.Syscall6(0x75e8ee10, 0x5, 0x1cc, 0xba6a000, 0x1000, 0xb84be78, 0x0, 0x0) runtime/syscall_windows.go:501 +0x62 syscall.readFile(0x1cc, {0xba6a000, 0x1000, 0x1000}, 0xb84be78, 0x0) syscall/zsyscall_windows.go:1024 +0xae syscall.ReadFile(...) syscall/syscall_windows.go:404 syscall.Read(0x1cc, {0xba6a000, 0x1000, 0x1000}) syscall/syscall_windows.go:383 +0x55 internal/poll.(FD).Read(0xb875080, {0xba6a000, 0x1000, 0x1000}) internal/poll/fd_windows.go:422 +0x203 os.(File).read(...) os/file_posix.go:31 os.(File).Read(0xb870770, {0xba6a000, 0x1000, 0x1000}) os/file.go:118 +0x62 bufio.(Reader).Read(0xb84bfa8, {0xb90ec00, 0x400, 0x400}) bufio/bufio.go:237 +0x1ce github.com/hashicorp/go-plugin.copyChan({0x19a5404, 0xb87ac30}, 0xb827140, {0x199fe9c, 0xb870770}) github.com/hashicorp/go-plugin@v1.5.2/grpc_stdio.go:184 +0x13c created by github.com/hashicorp/go-plugin.newGRPCStdioServer github.com/hashicorp/go-plugin@v1.5.2/grpc_stdio.go:40 +0xe6

goroutine 8 [syscall, locked to thread]: syscall.SyscallN(0x75e8ee10, {0xb84cdfc, 0x6, 0x6}) runtime/syscall_windows.go:557 +0x11d syscall.Syscall6(0x75e8ee10, 0x5, 0x1d4, 0xb886000, 0x1000, 0xb84ce78, 0x0, 0x0) runtime/syscall_windows.go:501 +0x62 syscall.readFile(0x1d4, {0xb886000, 0x1000, 0x1000}, 0xb84ce78, 0x0) syscall/zsyscall_windows.go:1024 +0xae syscall.ReadFile(...) syscall/syscall_windows.go:404 syscall.Read(0x1d4, {0xb886000, 0x1000, 0x1000}) syscall/syscall_windows.go:383 +0x55 internal/poll.(FD).Read(0xb875340, {0xb886000, 0x1000, 0x1000}) internal/poll/fd_windows.go:422 +0x203 os.(File).read(...) os/file_posix.go:31 os.(*File).Read(0xb870780, {0xb886000, 0x1000, 0x1000}) os/file.go:118 +0x62

Error: The terraform-provider-citrix_v0.3.2.exe 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.

Kind regards,

AlanCitrix commented 12 months ago

Thanks, we were able to reproduce the issue. Working on a fix.

zhuolun-citrix commented 12 months ago

Hi @lahavana a fix for this issue has been release in v0.3.3. Please update your terraform provider version and retry. Thank you very much!

zhuolun-citrix commented 11 months ago

Hi @lahavana just following up with you on this issue. Did you get the chance to try out the new version? Please let us know if the issue has been resolved.

Thank you.

lahavana commented 11 months ago

Hello, I've tested it today and the issue is resolved. No chrashes when creating the 19 resources. Thank you!