Skip to content

Commit ce6ce76

Browse files
committed
internal/lsp/regtest: increase the time allowed for shutdown
Now that we await ongoing work during shutdown, we are seeing regtest flakes simply due to outstanding go command invocations. Allow more time for cleanup. If this is insufficient, we can be more aggressive about terminating go command processes when context is cancelled. For golang/go#53820 Change-Id: I3df3c5510dae34cb14a6efeb02c2963a71e64f3a Reviewed-on: https://go-review.googlesource.com/c/tools/+/417583 gopls-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dylan Le <dungtuanle@google.com> Run-TryBot: Robert Findley <rfindley@google.com>
1 parent 32129bf commit ce6ce76

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

internal/lsp/regtest/runner.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,9 +341,13 @@ func (r *Runner) Run(t *testing.T, files string, test TestFunc, opts ...RunOptio
341341
}
342342
// For tests that failed due to a timeout, don't fail to shutdown
343343
// because ctx is done.
344-
closeCtx, cancel := context.WithTimeout(xcontext.Detach(ctx), 5*time.Second)
344+
//
345+
// golang/go#53820: now that we await the completion of ongoing work in
346+
// shutdown, we must allow a significant amount of time for ongoing go
347+
// command invocations to exit.
348+
ctx, cancel := context.WithTimeout(xcontext.Detach(ctx), 30*time.Second)
345349
defer cancel()
346-
if err := env.Editor.Close(closeCtx); err != nil {
350+
if err := env.Editor.Close(ctx); err != nil {
347351
pprof.Lookup("goroutine").WriteTo(os.Stderr, 1)
348352
t.Errorf("closing editor: %v", err)
349353
}

0 commit comments

Comments
 (0)