From 9f6413aed6c264120d496f01bb3949efa6c10444 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 14 Jun 2024 22:04:25 +0000 Subject: [PATCH] Increase removal timeout when uninstall (#4921) (#4927) On particularly slow machines 30 seconds might be still not enough to release the agent binary, so we're able to remove it on uninstall. This change doubles the timeout to 60 seconds. (cherry picked from commit 1f3ddcdb250f3dceaf8616809bd19261052dfd73) Co-authored-by: Denis --- changelog/fragments/1718268915-increase-remove-timeout.yaml | 3 +++ internal/pkg/agent/install/uninstall.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelog/fragments/1718268915-increase-remove-timeout.yaml diff --git a/changelog/fragments/1718268915-increase-remove-timeout.yaml b/changelog/fragments/1718268915-increase-remove-timeout.yaml new file mode 100644 index 00000000000..46369d8749c --- /dev/null +++ b/changelog/fragments/1718268915-increase-remove-timeout.yaml @@ -0,0 +1,3 @@ +kind: bug-fix +summary: Increase removal timeout when uninstall +component: "elastic-agent" diff --git a/internal/pkg/agent/install/uninstall.go b/internal/pkg/agent/install/uninstall.go index f333e8c49a5..48667154a40 100644 --- a/internal/pkg/agent/install/uninstall.go +++ b/internal/pkg/agent/install/uninstall.go @@ -168,7 +168,7 @@ func checkForUnprivilegedVault(ctx context.Context, opts ...vault.OptionFunc) (b // to an ERROR_SHARING_VIOLATION. RemovePath will retry up to 2 // seconds if it keeps getting that error. func RemovePath(path string) error { - const arbitraryTimeout = 30 * time.Second + const arbitraryTimeout = 60 * time.Second start := time.Now() var lastErr error for time.Since(start) <= arbitraryTimeout {