Fatal crash in (*Program).SingleThreaded on snapshot update [code] Interface No new…
- User
Fatal crash in
(*Program).SingleThreadedon snapshot updatecodeinternal/compiler.(*Program).SingleThreaded() internal/compiler/program.go:416 internal/compiler.NewProgram() internal/compiler/program.go:274 internal/project.(*Project).CreateProgram() internal/project/project.go:376 internal/project.(*ProjectCollectionBuilder).updateProgram.func2.1() internal/project/projectcollectionbuilder.go:1055 internal/project/dirty.(*Box[...]).Change() internal/project/dirty/box.go:41 internal/project.(*ProjectCollectionBuilder).updateProgram.func2() internal/project/projectcollectionbuilder.go:1052 internal/project/dirty.(*Box[...]).Locked() internal/project/dirty/box.go:57 internal/project.(*ProjectCollectionBuilder).updateProgram() internal/project/projectcollectionbuilder.go:1051 internal/project.(*ProjectCollectionBuilder).DidRequestFile() internal/project/projectcollectionbuilder.go:397 internal/project.(*Snapshot).Clone() internal/project/snapshot.go:353 internal/project.(*Session).updateSnapshot() internal/project/session.go:1101 internal/project.(*Session).getSnapshot() internal/project/session.go:819 internal/project.(*Session).getSnapshotAndDefaultProject() internal/project/session.go:877 internal/project.(*Session).GetLanguageService() internal/project/session.go:890 internal/lsp.init.func1.registerLanguageServiceDocumentRequestHandler[...].13() internal/lsp/server.go:826 internal/lsp.(*Server).handleRequestOrNotification() internal/lsp/server.go:669Interface
No new interfaces are introduced.
- Assistant
Now let me look at the ATA change handler and how
Changeinteracts: - Assistant
Now remove the unused
syncimport: - Assistant
Now build and run the relevant tests:
- Assistant
Now let me write a regression test reproducing the crash. First, let me check how
DidCloseFileand the session flow work: - Assistant
The test passes with the fix. Now let me verify it actually reproduces the crash against the unfixed code:
- Assistant
The test doesn't crash on old code — my sequence prediction was off. Let me trace the actual pass order in
Snapshot.Clone: - Assistant
Passes with the fix. Now verify it crashes on the old code:
- Assistant
All tests pass, vet and gofmt are clean. Final diff:
- Assistant
Fixed. Summary of the crash and the fix:
Root cause
Project.getCommandLineWithTypingsFiles()guarded its lazy computation with async.Once(commandLineWithTypingsFilesOnce), but the builder invalidates the cache by settingcommandLineWithTypingsFiles = nil(inupdateInferredProjectRootsand configured-project config changes) — and async.Oncecan never fire again on the same instance.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.