typescript-go
typescript-go copied to clipboard
panic concurrent map read and map write in GetDiagnosticsForFile via getSemanticDiagnosticsForFileNotFilter
Stack trace
12:26:55 PM - Project 'submodules/socket-patch/tsconfig.json' is being forcibly rebuilt
12:26:55 PM - Building project 'submodules/socket-patch/tsconfig.json'...
fatal error: concurrent map read and map write
goroutine 60863 [running]:
internal/runtime/maps.fatal({0x100997838?, 0x0?})
runtime/panic.go:1046 +0x20
github.com/microsoft/typescript-go/internal/ast.(*DiagnosticsCollection).GetDiagnosticsForFile(...)
github.com/microsoft/typescript-go/internal/ast/diagnostic.go:159
github.com/microsoft/typescript-go/internal/checker.(*Checker).GetDiagnosticsWithoutCheck(...)
github.com/microsoft/typescript-go/internal/checker/checker.go:13458
github.com/microsoft/typescript-go/internal/compiler.(*Program).getSemanticDiagnosticsForFileNotFilter.func1(0x1, 0x10042744c?)
github.com/microsoft/typescript-go/internal/compiler/program.go:1037 +0x64
github.com/microsoft/typescript-go/internal/compiler.(*checkerPool).ForEachCheckerParallel.func1()
github.com/microsoft/typescript-go/internal/compiler/checkerpool.go:99 +0xe0
github.com/microsoft/typescript-go/internal/core.(*parallelWorkGroup).Queue.func1()
github.com/microsoft/typescript-go/internal/core/workgroup.go:40 +0x24
sync.(*WaitGroup).Go.func1()
sync/waitgroup.go:239 +0x4c
created by sync.(*WaitGroup).Go in goroutine 52775
sync/waitgroup.go:237 +0x70
goroutine 1 [sync.WaitGroup.Wait]:
sync.runtime_SemacquireWaitGroup(0x140000a5920?, 0x20?)
runtime/sema.go:114 +0x38
sync.(*WaitGroup).Wait(0x1400053d280)
sync/waitgroup.go:206 +0xa8
github.com/microsoft/typescript-go/internal/core.(*parallelWorkGroup).RunAndWait(0x14000977c58?)
github.com/microsoft/typescript-go/internal/core/workgroup.go:46 +0x48
github.com/microsoft/typescript-go/internal/execute/build.(*Orchestrator).multiThreadedBuildOrClean(0x140000fc120, 0x1400056c370)
github.com/microsoft/typescript-go/internal/execute/build/orchestrator.go:344 +0xa0
github.com/microsoft/typescript-go/internal/execute/build.(*Orchestrator).buildOrClean(0x140000fc120)
github.com/microsoft/typescript-go/internal/execute/build/orchestrator.go:311 +0x140
github.com/microsoft/typescript-go/internal/execute/build.(*Orchestrator).Start(0x140000fc120)
github.com/microsoft/typescript-go/internal/execute/build/orchestrator.go:215 +0x78
github.com/microsoft/typescript-go/internal/execute.tscBuildCompilation({0x100da9538, 0x14000046840}, 0x140000fc090, {0x0, 0x0})
github.com/microsoft/typescript-go/internal/execute/tsc.go:95 +0x18c
github.com/microsoft/typescript-go/internal/execute.CommandLine({0x100da9538, 0x14000046840}, {0x140000200d0, 0x3, 0x3}, {0x0, 0x0})
github.com/microsoft/typescript-go/internal/execute/tsc.go:29 +0x218
main.runMain()
github.com/microsoft/typescript-go/cmd/tsgo/main.go:23 +0x120
main.main()
github.com/microsoft/typescript-go/cmd/tsgo/main.go:10 +0x1c
https://gist.github.com/Raynos/d1ed46e18245316c7081046403d89ab5
Steps to reproduce
- Run tsgo with incremental in a large monorepo with 40 workspaces.
Fixed in the other issue.
I saw this again in the wild
fatal error: concurrent map read and map write
goroutine 217682 [running]:
internal/runtime/maps.fatal({0x10153c2b1?, 0x140968b1998?})
runtime/panic.go:1046 +0x20
github.com/microsoft/typescript-go/internal/ast.(*DiagnosticsCollection).GetDiagnosticsForFile(...)
github.com/microsoft/typescript-go/internal/ast/diagnostic.go:159
github.com/microsoft/typescript-go/internal/checker.(*Checker).GetDiagnosticsWithoutCheck(...)
github.com/microsoft/typescript-go/internal/checker/checker.go:13460
github.com/microsoft/typescript-go/internal/compiler.(*Program).getSemanticDiagnosticsForFileNotFilter(0x14010578380, {0x1019471f0, 0x101f6b620}, 0x140a7a30c08)
github.com/microsoft/typescript-go/internal/compiler/program.go:1039 +0x1e0
github.com/microsoft/typescript-go/internal/compiler.(*Program).getSemanticDiagnosticsForFile(0x14010578380, {0x1019471f0?, 0x101f6b620?}, 0x140a7a30c08)
github.com/microsoft/typescript-go/internal/compiler/program.go:1012 +0x30
github.com/microsoft/typescript-go/internal/compiler.(*Program).getDiagnosticsHelper(0x0?, {0x1019471f0, 0x101f6b620}, 0x140a7a30c08?, 0x0?, 0x0?, 0x1403c9a1c28)
github.com/microsoft/typescript-go/internal/compiler/program.go:1209 +0xf4
github.com/microsoft/typescript-go/internal/compiler.(*Program).GetSemanticDiagnostics(0x0?, {0x1019471f0?, 0x101f6b620?}, 0x10193d130?)
github.com/microsoft/typescript-go/internal/compiler/program.go:416 +0x3c
github.com/microsoft/typescript-go/internal/compiler.GetDiagnosticsOfAnyProgram({0x1019471f0, 0x101f6b620}, {0x10194d2c0, 0x14010578380}, 0x140a7a30c08, 0x1, 0x1403c9a1d60, 0x1403c9a1d48)
github.com/microsoft/typescript-go/internal/compiler/program.go:1500 +0x364
github.com/microsoft/typescript-go/internal/compiler.HandleNoEmitOnError({0x1019471f0, 0x101f6b620}, {0x10194d2c0, 0x14010578380}, 0x140a7a30c08)
github.com/microsoft/typescript-go/internal/compiler/program.go:1457 +0x98
github.com/microsoft/typescript-go/internal/compiler.(*Program).Emit(0x14010578380, {0x1019471f0, 0x101f6b620}, {0x140a7a30c08?, 0x0?, 0x140c1f36d20?})
github.com/microsoft/typescript-go/internal/compiler/program.go:1364 +0x74
github.com/microsoft/typescript-go/internal/execute/incremental.(*emitFilesHandler).emitFilesIncremental.func1.1()
github.com/microsoft/typescript-go/internal/execute/incremental/emitfileshandler.go:124 +0x12c
github.com/microsoft/typescript-go/internal/core.(*parallelWorkGroup).Queue.func1()
github.com/microsoft/typescript-go/internal/core/workgroup.go:40 +0x24
sync.(*WaitGroup).Go.func1()
sync/waitgroup.go:239 +0x4c
created by sync.(*WaitGroup).Go in goroutine 268
sync/waitgroup.go:237 +0x70
Can you build the repo from source with npx hereby build --race and then run whatever you're getting to produce this with ./built/local/tsgo?
Please open a new issue with repro if you're still seeing this. Thanks!
I have not seen this issue recently, I switched over our team workflow to be a combination of tsc for building javascript and tsgo for Editor/IDE performance during development.