turbot / steampipe

Zero-ETL, infinite possibilities. Live query APIs, code & more with SQL. No DB required.
https://steampipe.io
GNU Affero General Public License v3.0
7.02k stars 278 forks source link

fatal error: concurrent map read and map write #4303

Open e-gineer opened 5 months ago

e-gineer commented 5 months ago

Steampipe version:

Welcome to Steampipe v0.23.2

I got this fatal error when starting steampipe. Notably I started steampipe query a number of times before and after without the problem, so it seems very rare:

~/src/experiments $ STEAMPIPE_LOG_LEVEL=trace steampipe query
fatal error: concurrent map read and map write

goroutine 1 [running]:
github.com/spf13/viper.(*Viper).searchMap(0x103ac1f03?, 0x5?, {0x14000993150, 0x1, 0x1})
    /home/runner/go/pkg/mod/github.com/spf13/viper@v1.18.2/viper.go:669 +0x48
github.com/spf13/viper.(*Viper).find(0x140008ac1c0, {0x103ac1f03, 0x5}, 0x1)
    /home/runner/go/pkg/mod/github.com/spf13/viper@v1.18.2/viper.go:1314 +0x144
github.com/spf13/viper.(*Viper).Get(0x140008ac1c0, {0x103ac1f03?, 0x1043b39e0?})
    /home/runner/go/pkg/mod/github.com/spf13/viper@v1.18.2/viper.go:904 +0x48
github.com/spf13/viper.(*Viper).GetString(0x12ac1b140?, {0x103ac1f03?, 0x18?})
    /home/runner/go/pkg/mod/github.com/spf13/viper@v1.18.2/viper.go:978 +0x20
github.com/spf13/viper.GetString(...)
    /home/runner/go/pkg/mod/github.com/spf13/viper@v1.18.2/viper.go:975
github.com/turbot/steampipe/pkg/interactive.newInteractiveClient({0x1045e8338?, 0x140005ff140}, 0x140000a70e0, 0x1400069ef30)
    /home/runner/work/steampipe/steampipe/pkg/interactive/interactive_client.go:94 +0x68
github.com/turbot/steampipe/pkg/interactive.RunInteractivePrompt({0x1045e8338?, 0x140005ff140}, 0x0?)
    /home/runner/work/steampipe/steampipe/pkg/interactive/run.go:24 +0xf8
github.com/turbot/steampipe/pkg/query/queryexecute.RunInteractiveSession({0x1045e8338, 0x140005ff140}, 0x1056947e0?)
    /home/runner/work/steampipe/steampipe/pkg/query/queryexecute/execute.go:27 +0x64
github.com/turbot/steampipe/cmd.runQueryCmd(0x103b0862c?, {0x1056947e0, 0x0, 0x0})
    /home/runner/work/steampipe/steampipe/cmd/query.go:167 +0x220
github.com/turbot/steampipe/pkg/cmdconfig.OnCmd.func3(0x140008a4a00?, {0x1056947e0, 0x0, 0x0})
    /home/runner/work/steampipe/steampipe/pkg/cmdconfig/builder.go:73 +0x100
github.com/spf13/cobra.(*Command).execute(0x1400086b800, {0x1056947e0, 0x0, 0x0})
    /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:987 +0x828
github.com/spf13/cobra.(*Command).ExecuteC(0x105626ac0)
    /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1115 +0x344
github.com/spf13/cobra.(*Command).Execute(...)
    /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1039
github.com/spf13/cobra.(*Command).ExecuteContext(...)
    /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1032
github.com/turbot/steampipe/cmd.Execute()
    /home/runner/work/steampipe/steampipe/cmd/root.go:110 +0x84
main.main()
    /home/runner/work/steampipe/steampipe/main.go:50 +0xa0

goroutine 10 [select]:
github.com/golang/glog.(*fileSink).flushDaemon(0x10565d018)
    /home/runner/go/pkg/mod/github.com/golang/glog@v1.2.0/glog_file.go:351 +0xa8
created by github.com/golang/glog.init.1 in goroutine 1
    /home/runner/go/pkg/mod/github.com/golang/glog@v1.2.0/glog_file.go:166 +0x150

goroutine 11 [select]:
go.opencensus.io/stats/view.(*worker).start(0x1400034d800)
    /home/runner/go/pkg/mod/go.opencensus.io@v0.24.0/stats/view/worker.go:292 +0x88
created by go.opencensus.io/stats/view.init.0 in goroutine 1
    /home/runner/go/pkg/mod/go.opencensus.io@v0.24.0/stats/view/worker.go:34 +0x98

goroutine 15 [chan receive]:
github.com/turbot/steampipe/pkg/contexthelpers.StartCancelHandler.func1()
    /home/runner/work/steampipe/steampipe/pkg/contexthelpers/cancel.go:14 +0x2c
created by github.com/turbot/steampipe/pkg/contexthelpers.StartCancelHandler in goroutine 1
    /home/runner/work/steampipe/steampipe/pkg/contexthelpers/cancel.go:13 +0xac

goroutine 14 [syscall]:
os/signal.signal_recv()
    /opt/hostedtoolcache/go/1.21.10/x64/src/runtime/sigqueue.go:149 +0x2c
os/signal.loop()
    /opt/hostedtoolcache/go/1.21.10/x64/src/os/signal/signal_unix.go:23 +0x1c
created by os/signal.Notify.func1.1 in goroutine 1
    /opt/hostedtoolcache/go/1.21.10/x64/src/os/signal/signal.go:151 +0x28

goroutine 16 [runnable]:
syscall.syscall(0x14000815668?, 0x10265f2f8?, 0x80000000000?, 0x7ffff80000000000?)
    /opt/hostedtoolcache/go/1.21.10/x64/src/runtime/sys_darwin.go:23 +0x58
syscall.write(0x140001418c0?, {0x140001d4360?, 0x14000815738?, 0x10269315c?})
    /opt/hostedtoolcache/go/1.21.10/x64/src/syscall/zsyscall_darwin_arm64.go:1673 +0x48
syscall.Write(...)
    /opt/hostedtoolcache/go/1.21.10/x64/src/syscall/syscall_unix.go:209
internal/poll.ignoringEINTRIO(...)
    /opt/hostedtoolcache/go/1.21.10/x64/src/internal/poll/fd_unix.go:736
internal/poll.(*FD).Write(0x140001418c0, {0x140001d4360, 0x46, 0x120})
    /opt/hostedtoolcache/go/1.21.10/x64/src/internal/poll/fd_unix.go:380 +0x2c0
os.(*File).write(...)
    /opt/hostedtoolcache/go/1.21.10/x64/src/os/file_posix.go:46
os.(*File).Write(0x1400012cb50, {0x140001d4360?, 0x46, 0x2?})
    /opt/hostedtoolcache/go/1.21.10/x64/src/os/file.go:183 +0x5c
github.com/turbot/go-kit/logging.(*RotatingLogWriter).Write(0x140008c2140, {0x140001d4360, 0x46, 0x120})
    /home/runner/go/pkg/mod/github.com/turbot/go-kit@v0.10.0-rc.0/logging/rotatinglogwriter.go:56 +0x21c
github.com/hashicorp/go-hclog.(*writer).Flush(0x14000b4e9c0, 0x25cbcdc?)
    /home/runner/go/pkg/mod/github.com/hashicorp/go-hclog@v1.6.3/writer.go:32 +0x150
github.com/hashicorp/go-hclog.(*intLogger).log(0x14000b2c180, {0x140008b4cd0, 0x10}, 0x3, {0x1400005d4d7, 0xf}, {0x0, 0x0, 0x0})
    /home/runner/go/pkg/mod/github.com/hashicorp/go-hclog@v1.6.3/intlogger.go:248 +0x180
github.com/hashicorp/go-hclog.(*intLogger).Info(0x14000815a08?, {0x1400005d4d7?, 0x1400005d4d6?}, {0x0?, 0x0?, 0x1400005d4d0?})
    /home/runner/go/pkg/mod/github.com/hashicorp/go-hclog@v1.6.3/intlogger.go:742 +0x4c
github.com/hashicorp/go-hclog.(*stdlogAdapter).dispatch(0x1400005d488?, {0x1400005d4d7?, 0x16?}, 0x3abce7d?)
    /home/runner/go/pkg/mod/github.com/hashicorp/go-hclog@v1.6.3/stdlog.go:60 +0x108
github.com/hashicorp/go-hclog.(*stdlogAdapter).Write(0x1400069e3f0, {0x1400005d488?, 0x17, 0x10565ce00?})
    /home/runner/go/pkg/mod/github.com/hashicorp/go-hclog@v1.6.3/stdlog.go:45 +0x9c
log.(*Logger).output(0x14000116720, 0x0, 0x14000815c48?, 0x14000815db0)
    /opt/hostedtoolcache/go/1.21.10/x64/src/log/log.go:245 +0x3cc
log.Printf(...)
    /opt/hostedtoolcache/go/1.21.10/x64/src/log/log.go:397
github.com/turbot/steampipe/pkg/initialisation.(*InitData).Init(0x140000a70e0, {0x1045e8370?, 0x14000aa0000}, {0x103ac1f2b, 0x5}, {0x14000815f00, 0x2, 0x2})
    /home/runner/work/steampipe/steampipe/pkg/initialisation/init_data.go:72 +0xc8
github.com/turbot/steampipe/pkg/query.(*InitData).init(0x140000a70e0, {0x1045e8370, 0x140008c21e0}, 0x0?, {0x1056947e0, 0x0, 0x0})
    /home/runner/work/steampipe/steampipe/pkg/query/init_data.go:144 +0x4dc
created by github.com/turbot/steampipe/pkg/query.NewInitData in goroutine 1
    /home/runner/work/steampipe/steampipe/pkg/query/init_data.go:64 +0x404
~/src/experiments $ 
kaidaguerre commented 5 months ago

Oof I hate these one.

Seems to be a viper related issue. The first thread is reading a value from viper, which is doing a map read. Nothing in the stack indicates what is writing to viper but I wonder if there is som incomplete initialisation going on at that point. I'll take a look for obvious candidates

github-actions[bot] commented 3 months ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] commented 2 months ago

This issue was closed because it has been stalled for 90 days with no activity.