christophd commented on issue #5197:
URL: https://github.com/apache/camel-k/issues/5197#issuecomment-1972917724

   From what I saw in the error output lately I think this is due to racing 
conditions on parallel running cobra commands (cobra may not be able to handle 
this paralelism)
   
   ````
   fatal error: concurrent map writes
     
     goroutine 2121 [running]:
     github.com/spf13/viper.(*Viper).BindFlagValue(0xc0004b2700, 
{0xc000dd4fa0?, 0x9?}, {0x2e36910, 0xc000e72b40})
        /home/runner/go/pkg/mod/github.com/spf13/[email protected]/viper.go:1247 
+0x67
     github.com/spf13/viper.(*Viper).BindPFlag(0x27b33fc?, {0xc000dd4fa0?, 
0x2e05458?}, 0x2e05458?)
        /home/runner/go/pkg/mod/github.com/spf13/[email protected]/viper.go:1224 
+0x2d
     github.com/spf13/viper.BindPFlag(...)
        /home/runner/go/pkg/mod/github.com/spf13/[email protected]/viper.go:1218
     github.com/apache/camel-k/v2/pkg/cmd.bindPFlags.func1(0xc000e72b40)
        /home/runner/work/camel-k/camel-k/pkg/cmd/util.go:85 +0xe6
     github.com/spf13/pflag.(*FlagSet).VisitAll(0xc001872400?, 0xc00122b7f8)
        /home/runner/go/pkg/mod/github.com/spf13/[email protected]/flag.go:290 +0xec
     github.com/apache/camel-k/v2/pkg/cmd.bindPFlags(0xc000ef3800?)
        /home/runner/work/camel-k/camel-k/pkg/cmd/util.go:80 +0x9c
     github.com/apache/camel-k/v2/pkg/cmd.bindPFlagsHierarchy(0x2674b40?)
        /home/runner/work/camel-k/camel-k/pkg/cmd/util.go:64 +0xbb
     
github.com/apache/camel-k/v2/pkg/cmd.kamelPostAddCommandInit(0xc00[1960](https://github.com/apache/camel-k/actions/runs/8093110281/job/22115080943#step:4:2033)000?)
        /home/runner/work/camel-k/camel-k/pkg/cmd/root.go:96 +0x2b
     github.com/apache/camel-k/v2/pkg/cmd.NewKamelCommand({0x2e35288, 
0xc000334af0})
   ````
   
   The test uses a go routine to run a kamel CLI command in `--dev` mode and 
while the goroutine is cancelled with defered func call the next tests already 
starts and this may cause concurrent writes to map in cobra/viper.
   
   I thought maybe to gracefully terminate the go routine by sending a SIGTERM 
signal to the process that kills the kamel CLI `--dev` mode when the test is 
run?
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to