From 41f263b0df5379df1f38149c15b1e4b32ef5d0e6 Mon Sep 17 00:00:00 2001 From: nfuden Date: Tue, 26 Dec 2023 15:45:18 -0500 Subject: [PATCH] back: proto timeout --- changelog/v0.26.3/proto-import-timeout.yaml | 5 +++++ codegen/collector/extractor.go | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 changelog/v0.26.3/proto-import-timeout.yaml diff --git a/changelog/v0.26.3/proto-import-timeout.yaml b/changelog/v0.26.3/proto-import-timeout.yaml new file mode 100644 index 000000000..09818b69e --- /dev/null +++ b/changelog/v0.26.3/proto-import-timeout.yaml @@ -0,0 +1,5 @@ +changelog: + - type: NON_USER_FACING + description: > + Bump time before declaring a deadlock when processing proto imports to 15s instead of 5s. + Backport of https://github.com/solo-io/skv2/commit/38333ccb2e5e779973ad94354ec499932749fed0 \ No newline at end of file diff --git a/codegen/collector/extractor.go b/codegen/collector/extractor.go index 9117345e2..b05607183 100644 --- a/codegen/collector/extractor.go +++ b/codegen/collector/extractor.go @@ -87,9 +87,10 @@ func (i *synchronizedImportsExtractor) FetchImportsForFile(protoFile string, imp i.activeRequestsMu.Unlock() select { - case <-time.After(5 * time.Second): - // We should never reach this. This can only occur if we deadlock on file imports - // which only happens with cyclic dependencies + case <-time.After(15 * time.Second): + // We should never reach this in an ideal scenario. If we do, it means that + // we either have a deadlock or golang is being very slow. + // The deadlock occurs on file imports with cyclic dependencies. // Perhaps a safer alternative to erroring is just to execute the importsFetcher: // return importsFetcher(protoFile) return nil, FetchImportsTimeout(protoFile)