astefanutti commented on pull request #2126:
URL: https://github.com/apache/camel-k/pull/2126#issuecomment-861278600
The root cause of the issue with running the `debug` command in a separate
routine may lie in the usage of Viper _static_ methods, that relies on a static
instance:
```
fatal error: concurrent map iteration and map write
goroutine 2563 [running]:
runtime.throw(0x2517dd2, 0x26)
/opt/hostedtoolcache/go/1.15.13/x64/src/runtime/panic.go:1116 +0x72
fp=0xc0006f1398 sp=0xc0006f1368 pc=0x439972
runtime.mapiternext(0xc001068720)
/opt/hostedtoolcache/go/1.15.13/x64/src/runtime/map.go:853 +0x554
fp=0xc0006f1418 sp=0xc0006f1398 pc=0x412ab4
reflect.mapiternext(0xc001068720)
/opt/hostedtoolcache/go/1.15.13/x64/src/runtime/map.go:1337 +0x2b
fp=0xc0006f1430 sp=0xc0006f1418 pc=0x46bc0b
reflect.(*MapIter).Next(0xc0002143c0, 0x2213580)
/opt/hostedtoolcache/go/1.15.13/x64/src/reflect/value.go:1277 +0xd6
fp=0xc0006f1458 sp=0xc0006f1430 pc=0x4deb36
internal/fmtsort.Sort(0x216a200, 0xc0007d7410, 0x15, 0x28d13c0)
/opt/hostedtoolcache/go/1.15.13/x64/src/internal/fmtsort/sort.go:63
+0x1ac fp=0xc0006f1508 sp=0xc0006f1458 pc=0x4f1a4c
fmt.(*pp).printValue(0xc0009c60d0, 0x216a200, 0xc0007d7410, 0x15,
0x7fb900000076, 0x0)
/opt/hostedtoolcache/go/1.15.13/x64/src/fmt/print.go:773 +0xca5
fp=0xc0006f16e0 sp=0xc0006f1508 pc=0x4fb1c5
fmt.(*pp).printArg(0xc0009c60d0, 0x216a200, 0xc0007d7410, 0x76)
/opt/hostedtoolcache/go/1.15.13/x64/src/fmt/print.go:716 +0x2b4
fp=0xc0006f1778 sp=0xc0006f16e0 pc=0x4f9e74
fmt.(*pp).doPrintf(0xc0009c60d0, 0x254d701, 0x37, 0xc0006f1918, 0x2, 0x2)
/opt/hostedtoolcache/go/1.15.13/x64/src/fmt/print.go:1030 +0x168
fp=0xc0006f1860 sp=0xc0006f1778 pc=0x4fd468
fmt.Errorf(0x254d701, 0x37, 0xc0006f1918, 0x2, 0x2, 0x30, 0x30)
/opt/hostedtoolcache/go/1.15.13/x64/src/fmt/errors.go:20 +0x77
fp=0xc0006f18c8 sp=0xc0006f1860 pc=0x4f33b7
github.com/spf13/cast.ToStringMapE(0x216a200, 0xc0007d7410, 0x1e87015,
0x2f0000c00076b320, 0xc0007d7380)
/home/runner/go/pkg/mod/github.com/spf13/[email protected]/caste.go:989
+0x217 fp=0xc0006f19a8 sp=0xc0006f18c8 pc=0x1e29b77
github.com/spf13/cast.ToStringMap(...)
/home/runner/go/pkg/mod/github.com/spf13/[email protected]/cast.go:139
github.com/spf13/viper.(*Viper).isPathShadowedInFlatMap(0xc00076b320,
0xc0009c99b0, 0x3, 0x3, 0x216a200, 0xc0007d7410, 0x0, 0x3)
/home/runner/go/pkg/mod/github.com/spf13/[email protected]/viper.go:663
+0x73 fp=0xc0006f1a10 sp=0xc0006f19a8 pc=0x1e87173
github.com/spf13/viper.(*Viper).find(0xc00076b320, 0xc00021adb0, 0x24, 0x1,
0x41617b, 0xc0006f1bd0)
/home/runner/go/pkg/mod/github.com/spf13/[email protected]/viper.go:1092
+0xe6e fp=0xc0006f1b30 sp=0xc0006f1a10 pc=0x1e8a12e
github.com/spf13/viper.(*Viper).Get(0xc00076b320, 0xc00021adb0, 0x24, 0xf,
0xc000af9528)
/home/runner/go/pkg/mod/github.com/spf13/[email protected]/viper.go:728
+0x85 fp=0xc0006f1bc0 sp=0xc0006f1b30 pc=0x1e87465
github.com/spf13/viper.(*Viper).AllSettings(0xc00076b320, 0xc00168a248)
/home/runner/go/pkg/mod/github.com/spf13/[email protected]/viper.go:1923
+0xbc fp=0xc0006f1c80 sp=0xc0006f1bc0 pc=0x1e9191c
github.com/spf13/viper.AllSettings(...)
/home/runner/go/pkg/mod/github.com/spf13/[email protected]/viper.go:1918
github.com/apache/camel-k/pkg/cmd.decodeKey(0x22d5ec0, 0xc0009f40e0,
0xc0008a1355, 0xb, 0x1, 0x3)
/home/runner/work/camel-k/camel-k/pkg/cmd/util.go:120 +0xb8
fp=0xc0006f1d98 sp=0xc0006f1c80 pc=0x1f1a458
github.com/apache/camel-k/pkg/cmd.decode.func1(0xc00092e000, 0xc000af23f0,
0x1, 0x3, 0x0, 0x0)
/home/runner/work/camel-k/camel-k/pkg/cmd/util.go:164 +0x71
fp=0xc0006f1de8 sp=0xc0006f1d98 pc=0x1f2e011
github.com/spf13/cobra.(*Command).execute(0xc00092e000, 0xc000af2390, 0x3,
0x3, 0xc00092e000, 0xc000af2390)
/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:839
+0x530 fp=0xc0006f1ec0 sp=0xc0006f1de8 pc=0x1374450
github.com/spf13/cobra.(*Command).ExecuteC(0xc000ffe000, 0x0, 0xc000e3afc0,
0xc00026f080)
/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:958
+0x375 fp=0xc0006f1f98 sp=0xc0006f1ec0 pc=0x1374f15
github.com/spf13/cobra.(*Command).Execute(0xc000ffe000, 0xc000ffe000, 0x0)
/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:895
+0x2b fp=0xc0006f1fc8 sp=0xc0006f1f98 pc=0x1374b6b
runtime.goexit()
/opt/hostedtoolcache/go/1.15.13/x64/src/runtime/asm_amd64.s:1374 +0x1
fp=0xc0006f1fd0 sp=0xc0006f1fc8 pc=0x472421
created by github.com/apache/camel-k/e2e/common/cli.TestKamelCLIDebug.func1.3
/home/runner/work/camel-k/camel-k/e2e/common/cli/debug_test.go:71 +0x3a7
```
A possible solution would be to create a separate Viper instance, for each
command execution.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]