aspect-build/aspect-cli

[Bug]: js gazelle crash when parsing tsconfig

Closed this issue · 0 comments

NOTE: this may be from executing the compiled gazelle_binary binary file while bazel is (re-)building it, which would be a user error and not a bug.

What happened?

Seems random and inconsistent, here's the error:

fatal error: concurrent map writes

goroutine 221 [running]:
github.com/aspect-build/silo/cli/core/gazelle/js/typescript.parseTsConfigJSONFile(0x1400020c6f0, {0x14000025c20, 0x1c}, {0x14002563c10, 0x10}, {0x1030e7758, 0xd})
	cli/core/gazelle/js/typescript/tsconfig.go:100 +0x78
github.com/aspect-build/silo/cli/core/gazelle/js/typescript.(*TsWorkspace).GetTsConfigFile(0x14000010150, {0x14002f975c0, 0x10})
	cli/core/gazelle/js/typescript/config.go:63 +0xd0
github.com/aspect-build/silo/cli/core/gazelle/js/typescript.(*TsWorkspace).getConfig(0x14000010150, {0x14002f975c0?, 0x6377e25db8?})
	cli/core/gazelle/js/typescript/config.go:86 +0xd4
github.com/aspect-build/silo/cli/core/gazelle/js/typescript.(*TsWorkspace).ExpandPaths(0x14002f975c0?, {0x14002f975c0, 0x3c}, {0x1400071e2b8, 0x15})
	cli/core/gazelle/js/typescript/config.go:109 +0x34
github.com/aspect-build/silo/cli/core/gazelle/js.(*typeScriptLang).collectImports(0x1400010a910, 0x0?, {0x14000025c20?, 0x0?}, {0x14002f975c0, 0x3c})
	cli/core/gazelle/js/generate.go:512 +0x250
github.com/aspect-build/silo/cli/core/gazelle/js.(*typeScriptLang).parseFiles.func1()
	cli/core/gazelle/js/generate.go:472 +0xa8
created by github.com/aspect-build/silo/cli/core/gazelle/js.(*typeScriptLang).parseFiles
	cli/core/gazelle/js/generate.go:468 +0x100

goroutine 1 [chan receive]:
github.com/aspect-build/silo/cli/core/gazelle/js.(*typeScriptLang).addProjectRule(0x1400010a910, 0x14000bfb0e0?, {0x140001a4840, {0x14001dcca80, 0x2d}, {0x14002563c10, 0x10}, 0x140016c57c0, {0x14001ef94a0, 0x2, ...}, ...}, ...)
	cli/core/gazelle/js/generate.go:353 +0x14c
github.com/aspect-build/silo/cli/core/gazelle/js.(*typeScriptLang).addSourceRules(0x1400010a910, 0x14000bfb0e0, {0x140001a4840, {0x14001dcca80, 0x2d}, {0x14002563c10, 0x10}, 0x140016c57c0, {0x14001ef94a0, 0x2, ...}, ...}, ...)
	cli/core/gazelle/js/generate.go:160 +0x728
github.com/aspect-build/silo/cli/core/gazelle/js.(*typeScriptLang).GenerateRules(0x14000010140?, {0x140001a4840, {0x14001dcca80, 0x2d}, {0x14002563c10, 0x10}, 0x140016c57c0, {0x14001ef94a0, 0x2, 0x2}, ...})
	cli/core/gazelle/js/generate.go:70 +0x260
main.runFixUpdate.func1({0x14001dcca80, 0x2d}, {0x14002563c10, 0x10}, 0x140001a4840, 0x1?, 0x140016c57c0, {0x14001ef94a0, 0x2, 0x2}, ...)
	external/bazel_gazelle/cmd/gazelle/fix-update.go:330 +0x370
github.com/bazelbuild/bazel-gazelle/walk.Walk.func1(0x140001a4cc0, {0x14001dcca80, 0x2d}, {0x14002563c10, 0x10}, 0x1)
	external/bazel_gazelle/walk/walk.go:176 +0x72c
github.com/bazelbuild/bazel-gazelle/walk.Walk.func1(0x140001a4300, {0x14001e4b7d0, 0x23}, {0x140015d1988, 0x6}, 0x1)
	external/bazel_gazelle/walk/walk.go:169 +0x600
github.com/bazelbuild/bazel-gazelle/walk.Walk.func1(0x140001a4300, {0x14000025c20, 0x1c}, {0x0, 0x0}, 0x0)
	external/bazel_gazelle/walk/walk.go:169 +0x600
github.com/bazelbuild/bazel-gazelle/walk.Walk(0x140001a4300, {0x1400012f800?, 0x8, 0x8}, {0x1400020c770, 0x1, 0x1}, 0x0, 0x1400018f668)
	external/bazel_gazelle/walk/walk.go:179 +0x184
main.runFixUpdate({0x14000024024, 0x1c}, 0x1c?, {0x14000020270, 0x0, 0x0})
	external/bazel_gazelle/cmd/gazelle/fix-update.go:307 +0xad4
main.run({0x14000024024?, 0x19?}, {0x14000020270?, 0x140000021a0?, 0x14000056768?})
	external/bazel_gazelle/cmd/gazelle/gazelle.go:95 +0x220
main.main()
	external/bazel_gazelle/cmd/gazelle/gazelle.go:72 +0xd0

goroutine 219 [runnable]:
syscall.syscall(0x140000678b8?, 0x102e13e00?, 0x800000?, 0x7ffff800000?)
	GOROOT/src/runtime/sys_darwin.go:23 +0x58
syscall.read(0x140026f6720?, {0x1400107e488?, 0x10aec5ed8?, 0x102d69acc?})
	GOROOT/src/syscall/zsyscall_darwin_arm64.go:1209 +0x48
syscall.Read(...)
	GOROOT/src/syscall/syscall_unix.go:178
internal/poll.ignoringEINTRIO(...)
	GOROOT/src/internal/poll/fd_unix.go:794
internal/poll.(*FD).Read(0x140026f6720?, {0x1400107e488?, 0x1?, 0x1?})
	GOROOT/src/internal/poll/fd_unix.go:163 +0x224
os.(*File).read(...)
	GOROOT/src/os/file_posix.go:31
os.(*File).Read(0x14001182080, {0x1400107e488?, 0x0?, 0x0?})
	GOROOT/src/os/file.go:118 +0x5c
os.ReadFile({0x14002c38bd0?, 0x2?})
	GOROOT/src/os/file.go:704 +0x17c
github.com/aspect-build/silo/cli/core/gazelle/js.parseSourceFile({0x14000025c20, 0x1c}, {0x140020c4f60, 0x53})
	cli/core/gazelle/js/generate.go:540 +0xcc
github.com/aspect-build/silo/cli/core/gazelle/js.(*typeScriptLang).collectImports(0x1400010a910, 0x0?, {0x14000025c20?, 0x0?}, {0x140020c4f60, 0x53})
	cli/core/gazelle/js/generate.go:497 +0x64
github.com/aspect-build/silo/cli/core/gazelle/js.(*typeScriptLang).parseFiles.func1()
	cli/core/gazelle/js/generate.go:472 +0xa8
created by github.com/aspect-build/silo/cli/core/gazelle/js.(*typeScriptLang).parseFiles
	cli/core/gazelle/js/generate.go:468 +0x100

goroutine 222 [runnable]:
github.com/smacker/go-tree-sitter._Cfunc_free(0x113810000)
	_cgo_gotypes.go:367 +0x30
github.com/smacker/go-tree-sitter.(*Parser).ParseCtx.func4(0x14002ee11a0?)
	aspect_silo/external/com_github_smacker_go_tree_sitter/bindings.go:122 +0x40
github.com/smacker/go-tree-sitter.(*Parser).ParseCtx(0x1400063d278, {0x10345e7f8?, 0x140000263e0}, 0x103049cf0?, {0x1400137a800, 0x3f5, 0x400})
	aspect_silo/external/com_github_smacker_go_tree_sitter/bindings.go:122 +0x124
github.com/aspect-build/silo/cli/core/gazelle/js/parser/treesitter.(*TreeSitterParser).parseTypeScript(0x14000b35b30, 0x140001c8360?, {0x1400137a800, 0x3f5, 0x400})
	cli/core/gazelle/js/parser/treesitter/parser_treesitter.go:188 +0x68
github.com/aspect-build/silo/cli/core/gazelle/js/parser/treesitter.(*TreeSitterParser).ParseSource(0x140026c2cb0?, {0x14002a3d400, 0x4b}, {0x1400137a400, 0x3f5})
	cli/core/gazelle/js/parser/treesitter/parser_treesitter.go:84 +0x1bc
github.com/aspect-build/silo/cli/core/gazelle/js.parseSourceFile({0x14000025c20, 0x1c}, {0x14002a3d400, 0x4b})
	cli/core/gazelle/js/generate.go:546 +0x190
github.com/aspect-build/silo/cli/core/gazelle/js.(*typeScriptLang).collectImports(0x1400010a910, 0x0?, {0x14000025c20?, 0x0?}, {0x14002a3d400, 0x4b})
	cli/core/gazelle/js/generate.go:497 +0x64
github.com/aspect-build/silo/cli/core/gazelle/js.(*typeScriptLang).parseFiles.func1()
	cli/core/gazelle/js/generate.go:472 +0xa8
created by github.com/aspect-build/silo/cli/core/gazelle/js.(*typeScriptLang).parseFiles
	cli/core/gazelle/js/generate.go:468 +0x100

goroutine 223 [runnable]:
github.com/smacker/go-tree-sitter._Cfunc_ts_query_cursor_delete(0x600002b20630)
	_cgo_gotypes.go:1014 +0x30
github.com/smacker/go-tree-sitter.(*QueryCursor).Close.func1(0x14000f195f8?)
	aspect_silo/external/com_github_smacker_go_tree_sitter/bindings.go:980 +0x50
github.com/smacker/go-tree-sitter.(*QueryCursor).Close(0x140023e6440)
	aspect_silo/external/com_github_smacker_go_tree_sitter/bindings.go:980 +0x28
github.com/aspect-build/silo/cli/core/gazelle/js/parser/treesitter.queryImports(0x1030e5d67?, {0x14002d982d0, 0x30}, {0x1400097c880, 0x7f, 0x80}, 0x14000630778?)
	cli/core/gazelle/js/parser/treesitter/parser_treesitter.go:216 +0x284
github.com/aspect-build/silo/cli/core/gazelle/js/parser/treesitter.(*TreeSitterParser).ParseSource(0x14002a3d4a0?, {0x14002d982d0, 0x30}, {0x1400097c780, 0x7f})
	cli/core/gazelle/js/parser/treesitter/parser_treesitter.go:122 +0x954
github.com/aspect-build/silo/cli/core/gazelle/js.parseSourceFile({0x14000025c20, 0x1c}, {0x14002d982d0, 0x30})
	cli/core/gazelle/js/generate.go:546 +0x190
github.com/aspect-build/silo/cli/core/gazelle/js.(*typeScriptLang).collectImports(0x1400010a910, 0x140005199e0?, {0x14000025c20?, 0x14000097ef8?}, {0x14002d982d0, 0x30})
	cli/core/gazelle/js/generate.go:497 +0x64
github.com/aspect-build/silo/cli/core/gazelle/js.(*typeScriptLang).parseFiles.func1()
	cli/core/gazelle/js/generate.go:472 +0xa8
created by github.com/aspect-build/silo/cli/core/gazelle/js.(*typeScriptLang).parseFiles
	cli/core/gazelle/js/generate.go:468 +0x100

goroutine 218 [runnable]:
github.com/smacker/go-tree-sitter._Cfunc_free(0x60000283c500)
	_cgo_gotypes.go:367 +0x30
github.com/smacker/go-tree-sitter.(*Parser).ParseCtx.func4(0x14002c55920?)
	aspect_silo/external/com_github_smacker_go_tree_sitter/bindings.go:122 +0x40
github.com/smacker/go-tree-sitter.(*Parser).ParseCtx(0x14002527710, {0x10345e7f8?, 0x140000263e0}, 0x103049cf0?, {0x14000f42d20, 0x9a, 0xa0})
	aspect_silo/external/com_github_smacker_go_tree_sitter/bindings.go:122 +0x124
github.com/aspect-build/silo/cli/core/gazelle/js/parser/treesitter.(*TreeSitterParser).parseTypeScript(0x14000632b30, 0x140001c8360?, {0x14000f42d20, 0x9a, 0xa0})
	cli/core/gazelle/js/parser/treesitter/parser_treesitter.go:188 +0x68
github.com/aspect-build/silo/cli/core/gazelle/js/parser/treesitter.(*TreeSitterParser).ParseSource(0x14001b39180?, {0x140005dbce0, 0x1d}, {0x14000f42c80, 0x9a})
	cli/core/gazelle/js/parser/treesitter/parser_treesitter.go:84 +0x1bc
github.com/aspect-build/silo/cli/core/gazelle/js.parseSourceFile({0x14000025c20, 0x1c}, {0x140005dbce0, 0x1d})
	cli/core/gazelle/js/generate.go:546 +0x190
github.com/aspect-build/silo/cli/core/gazelle/js.(*typeScriptLang).collectImports(0x1400010a910, 0x0?, {0x14000025c20?, 0x0?}, {0x140005dbce0, 0x1d})
	cli/core/gazelle/js/generate.go:497 +0x64
github.com/aspect-build/silo/cli/core/gazelle/js.(*typeScriptLang).parseFiles.func1()
	cli/core/gazelle/js/generate.go:472 +0xa8
created by github.com/aspect-build/silo/cli/core/gazelle/js.(*typeScriptLang).parseFiles
	cli/core/gazelle/js/generate.go:468 +0x100

goroutine 224 [chan send]:
github.com/aspect-build/silo/cli/core/gazelle/js.(*typeScriptLang).parseFiles.func2()
	cli/core/gazelle/js/generate.go:481 +0xa4
created by github.com/aspect-build/silo/cli/core/gazelle/js.(*typeScriptLang).parseFiles
	cli/core/gazelle/js/generate.go:478 +0x234

goroutine 220 [runnable]:
syscall.syscall(0x140006c7788?, 0x102d69acc?, 0x140030589c0?, 0xd0?)
	GOROOT/src/runtime/sys_darwin.go:23 +0x58
syscall.Fstat(0x10ad191b8?, 0x103868108?)
	GOROOT/src/syscall/zsyscall_darwin_arm64.go:1896 +0x38
internal/poll.(*FD).Fstat.func1(...)
	GOROOT/src/internal/poll/fd_unix.go:687
internal/poll.ignoringEINTR(...)
	GOROOT/src/internal/poll/fd_posix.go:74
internal/poll.(*FD).Fstat(0x14002e31b00, 0x140030589f8)
	GOROOT/src/internal/poll/fd_unix.go:686 +0x120
os.(*File).Stat(0x1400071a1d8)
	GOROOT/src/os/stat_unix.go:20 +0x4c
os.ReadFile({0x14002a2d0c0?, 0x3?})
	GOROOT/src/os/file.go:682 +0x74
github.com/aspect-build/silo/cli/core/gazelle/js/typescript.parseTsConfigJSONFile(0x1400020c6f0, {0x14000025c20, 0x1c}, {0x14002563c10, 0x10}, {0x1030e7758, 0xd})
	cli/core/gazelle/js/typescript/tsconfig.go:102 +0xf8
github.com/aspect-build/silo/cli/core/gazelle/js/typescript.(*TsWorkspace).GetTsConfigFile(0x14000010150, {0x14002a3d310, 0x10})
	cli/core/gazelle/js/typescript/config.go:63 +0xd0
github.com/aspect-build/silo/cli/core/gazelle/js/typescript.(*TsWorkspace).getConfig(0x14000010150, {0x14002a3d310?, 0x6343c87b28?})
	cli/core/gazelle/js/typescript/config.go:86 +0xd4
github.com/aspect-build/silo/cli/core/gazelle/js/typescript.(*TsWorkspace).ExpandPaths(0x14002a3d310?, {0x14002a3d310, 0x4a}, {0x1400149b040, 0xf})
	cli/core/gazelle/js/typescript/config.go:109 +0x34
github.com/aspect-build/silo/cli/core/gazelle/js.(*typeScriptLang).collectImports(0x1400010a910, 0x0?, {0x14000025c20?, 0x0?}, {0x14002a3d310, 0x4a})
	cli/core/gazelle/js/generate.go:512 +0x250
github.com/aspect-build/silo/cli/core/gazelle/js.(*typeScriptLang).parseFiles.func1()
	cli/core/gazelle/js/generate.go:472 +0xa8
created by github.com/aspect-build/silo/cli/core/gazelle/js.(*typeScriptLang).parseFiles
	cli/core/gazelle/js/generate.go:468 +0x100

goroutine 225 [semacquire]:
sync.runtime_Semacquire(0x0?)
	GOROOT/src/runtime/sema.go:62 +0x2c
sync.(*WaitGroup).Wait(0x14000a2d2a0)
	GOROOT/src/sync/waitgroup.go:116 +0x78
github.com/aspect-build/silo/cli/core/gazelle/js.(*typeScriptLang).parseFiles.func3()
	cli/core/gazelle/js/generate.go:489 +0x28
created by github.com/aspect-build/silo/cli/core/gazelle/js.(*typeScriptLang).parseFiles
	cli/core/gazelle/js/generate.go:488 +0x288

Version

Development (host) and target OS/architectures:

Output of bazel --version:

Version of the Aspect rules, or other relevant rules from your
WORKSPACE or MODULE.bazel file:

Language(s) and/or frameworks involved:

How to reproduce

No response

Any other information?

No response