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
I’ll trace
Program.SingleThreadedand the snapshot-update construction path, then patch the invariant violation and run the focused Go tests. - Assistant
The crash comes from an invalidated lazy cache: the augmented command line is cleared, but its
sync.Onceremains spent. A second program rebuild in the same snapshot can therefore pass a nil config intoNewProgram, andSingleThreadedis the first dereference. I’m centralizing cache invalidation so both the value and guard reset together, with a regression test for repeated updates. - Assistant
The fix now resets the lazy guard whenever its cached command line becomes obsolete, including ATA typing-file changes. The focused project test suite is compiling/running; after that I’ll run the broader affected packages and race-sensitive checks if practical.
- Assistant
The normal focused suite and compiler checks pass. I’m completing a race-enabled project run because the defect involves a reused
sync.Once; this verifies the reset stays within the project’s existing synchronization model.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.