Skip to content

fix(batchrouter): retry failed async manager initialization - #7374

Merged
achettyiitr merged 14 commits into
masterfrom
harness/PIPE-3356-fix-batchrouter-retry-failed-as-e5eca5ed
Sep 15, 2026
Merged

achettyiitr merged 14 commits into
masterfrom
harness/PIPE-3356-fix-batchrouter-retry-failed-as-e5eca5ed

Conversation

@rudder-devbox

@rudder-devbox rudder-devbox Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds self-healing retry behavior for async batch router destinations whose manager constructor fails transiently.

Failed async manager initialization now records FailedAt. The existing backend config refresh path calls refreshDestination, and that path now retries an unchanged destination only when its current manager is an InvalidManager and BatchRouter.invalidManagerRetryInterval has elapsed. The retry interval defaults to 15 minutes and remains reloadable through the existing config system. Healthy same-revision managers still skip re-initialization, and RevisionID changes still reinitialize immediately.

This keeps the change scoped to async manager lifecycle handling. There is no separate retry goroutine, no async upload-path rewrite, and no warehouse test change in the final PR diff.

Eloqua login/base-endpoint errors now include request context, non-200 status/body diagnostics, parse failures with response body, and an explicit missing urls.base error.

Linear Ticket

PIPE-3356

Security

  • The code changed/added as part of this pull request won't create any security issues with how the software is being used.

Validation

  • make -C /workspace/rudder-server fmt - passed
  • go test -count 1 -run 'Test.*InvalidManager|Test.*RefreshDestination|TestAsyncDestinationManager|TestGetBaseEndpoint' ./router/batchrouter/... - passed
  • go test -count 1 ./router/batchrouter - passed
  • Earlier make -C /workspace/rudder-server lint reached golangci-lint/actionlint successfully but failed in the sec step on pre-existing unrelated gitleaks findings.

Known Issues

  • make lint fails in the sec step because gitleaks reports existing leaks unrelated to this change, including backend-config/testdata/sample_namespace.json, processor/processorBenchmark_test.go, regulation-worker/cmd/main_test.go, router/batchrouter/testdata/brtIsolationTestTemplate.json.tpl, rudder-docker.yml, services/debugger/source/eventUploader_test.go, services/streammanager/googlesheets/googlesheetsmanager_test.go, services/streammanager/streammanager_suite_test.go, utils/misc/misc_test.go, warehouse/internal/api/testdata/process_request_missing_schema.json, warehouse/utils/utils.go, and warehouse/utils/utils_test.go.

@rudder-devbox

rudder-devbox Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

👋 I'm rudder-devbox. I opened this PR from a Linear ticket.

Mention @devbox or @rudder-devbox and I'll act on it — on a top-level PR comment,
in a review summary, or on an inline comment on the diff. Without a mention I won't see it.

@codecov

codecov Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.29630% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 80.35%. Comparing base (4d743db) to head (f9f412e).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...tchrouter/asyncdestinationmanager/eloqua/eloqua.go 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7374      +/-   ##
==========================================
+ Coverage   79.93%   80.35%   +0.41%     
==========================================
  Files         619      620       +1     
  Lines       69465    69508      +43     
==========================================
+ Hits        55528    55850     +322     
+ Misses      10688    10389     -299     
- Partials     3249     3269      +20     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rudder-devbox

rudder-devbox Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

I fixed the CI failure and pushed the change.

Root cause from the failed job log: warehouse/integrations/tunnelling TestConnect failed at connect_test.go:41 because the Docker SSH test helper hit toomanyrequests: retry-after: 503.063µs, allowed: 44000/minute while starting its SSH server image; cleanup then repanicked in github.com/ory/dockertest/v3.(*Pool).Purge with a nil resource.

Fix: TestConnect no longer depends on the external LinuxServer SSH container. It now starts a small in-process SSH direct-tcpip forwarder and still tests the real Connect path against a real Postgres container, so the unit test keeps coverage without registry throttling or the nil cleanup path.

Validation:

  • go test -race -count 1 -run TestConnect ./warehouse/integrations/tunnelling passed.
  • go test -race -count 1 ./warehouse/integrations/tunnelling passed.
  • A broader go test -p=1 -failfast -shuffle=on -race -count 1 ./warehouse/... got past warehouse/integrations/tunnelling successfully, then later timed out in unrelated existing warehouse/internal/repo TestUploadsRepo Docker Postgres setup.

Commit: 8851e5a

@rudder-devbox

rudder-devbox Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

Knowledge distillation completed

@rudder-devbox

rudder-devbox Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

I fixed the verify failures and pushed the follow-up commit.

Root cause from the logs:

  • Correct generated files ran go mod tidy, then git diff --exit-code go.mod showed golang.org/x/crypto v0.55.0 needed to move from indirect to direct because the new tunnel test imports golang.org/x/crypto/ssh directly.
  • lint failed on warehouse/integrations/tunnelling/connect_test.go:199 with nilnil: the SSH public-key callback returned nil, nil on success.

Fix:

  • Committed the go mod tidy-required go.mod classification change.
  • Changed the successful SSH public-key callback return to &ssh.Permissions{}, nil.

Validation:

  • GOTOOLCHAIN=local go test -race -count 1 -run TestConnect ./warehouse/integrations/tunnelling passed.
  • GOTOOLCHAIN=local go run github.com/golangci/golangci-lint/v2/cmd/[email protected] run ./warehouse/integrations/tunnelling -v passed with 0 issues.

Commit: 96b82ae

@rudder-devbox

rudder-devbox Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

Knowledge distillation completed

@rudder-devbox

rudder-devbox Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

I fixed the generated-files verify failure and pushed the change.

Root cause from the log: the Correct generated files job ran make fmt, specifically go fix ./..., and then git diff --exit-code showed warehouse/integrations/tunnelling/connect_test.go changed. The concrete diff rewrote manual sync.WaitGroup Add(1) + go func(){ defer Done() ... }() blocks to wg.Go(...).

Fix: applied the same go fix rewrite to the tunnel test helper and committed it.

Validation:

  • GOTOOLCHAIN=local go fix ./warehouse/integrations/tunnelling plus gofumpt/gci on connect_test.go produced no further changes beyond the committed diff.
  • GOTOOLCHAIN=local go mod tidy left go.mod/go.sum clean.
  • GOTOOLCHAIN=local go test -race -count 1 -run TestConnect ./warehouse/integrations/tunnelling passed.

Commit: a3ba29b

@rudder-devbox

rudder-devbox Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

Knowledge distillation completed

@achettyiitr
achettyiitr marked this pull request as ready for review September 11, 2026 04:18
Comment thread router/batchrouter/handle.go Resolved
Comment thread router/batchrouter/handle.go Resolved
@rudder-devbox

rudder-devbox Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

I fixed the lint failure and pushed the change.

Root cause from the log: golangci-lint failed with staticcheck ST1005 at router/batchrouter/asyncdestinationmanager/eloqua/eloqua.go:59:14: error strings should not be capitalized. The offending string was Unable to parse eloqua login response....

Fix: lowercased that Eloqua parse error string and updated the focused test expectation to match.

Validation:

  • GOTOOLCHAIN=local go run github.com/golangci/golangci-lint/v2/cmd/[email protected] run ./router/batchrouter/asyncdestinationmanager/eloqua -v passed with 0 issues.
  • GOTOOLCHAIN=local go test -count 1 ./router/batchrouter/asyncdestinationmanager/eloqua passed.

Commit: f9f412e

@rudder-devbox

rudder-devbox Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

Knowledge distillation completed

@achettyiitr
achettyiitr merged commit 974d383 into master Sep 15, 2026
76 checks passed
@achettyiitr
achettyiitr deleted the harness/PIPE-3356-fix-batchrouter-retry-failed-as-e5eca5ed branch September 15, 2026 06:35
This was referenced Sep 15, 2026
atzoum pushed a commit that referenced this pull request Sep 15, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.87.0-rc.4](v1.86.0...v1.87.0-rc.4)
(2026-09-15)


### Features

* backend config shadow mode
([#7340](#7340))
([4898165](4898165))
* bump rudder-go-kit and go modules to Go 1.27.1
([#7345](#7345))
([8d95c68](8d95c68))
* **router:** read transformerProxy from transformer features before env
([#7337](#7337))
([e8f0ea6](e8f0ea6))


### Bug Fixes

* **batchrouter:** retry failed async manager initialization
([#7374](#7374))
([974d383](974d383))
* **router:** redact credentials from destination URLs in failure
responses
([#7372](#7372))
([14659bf](14659bf))
* **router:** request fails with unexpected use of stub RoundTripper
error ([#7386](#7386))
([2ff491f](2ff491f))
* singer-protocol sources filtered destination config for source type
cloud instead of cloudSource
([#7389](#7389))
([f48c997](f48c997))
* **warehouse:** instrument the clickhouse v2 load path
([#7355](#7355))
([4d743db](4d743db))
* **warehouse:** pass temporary credentials to the clickhouse v2 s3 copy
engine
([#7353](#7353))
([4d743db](4d743db))
* **warehouse:** retire idle clickhouse v2 connections
([#7352](#7352))
([4d743db](4d743db))
* **warehouse:** retry a failed clickhouse v2 block
([#7354](#7354))
([4d743db](4d743db))


### Miscellaneous

* log the candidate error when a backend config shadow sample fails to
fetch ([#7383](#7383))
([eaa9b61](eaa9b61))
* **processor:** assemble side-PU report metrics at end of preprocess
stage ([#7346](#7346))
([4540876](4540876))
* sync release v1.86.0 to main branch
([#7356](#7356))
([6868c6c](6868c6c))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
atzoum pushed a commit that referenced this pull request Sep 15, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.87.0](v1.86.0...v1.87.0)
(2026-09-15)


### Features

* backend config shadow mode
([#7340](#7340))
([4898165](4898165))
* bump rudder-go-kit and go modules to Go 1.27.1
([#7345](#7345))
([8d95c68](8d95c68))
* **router:** read transformerProxy from transformer features before env
([#7337](#7337))
([e8f0ea6](e8f0ea6))


### Bug Fixes

* **batchrouter:** retry failed async manager initialization
([#7374](#7374))
([974d383](974d383))
* **router:** redact credentials from destination URLs in failure
responses
([#7372](#7372))
([14659bf](14659bf))
* **router:** request fails with unexpected use of stub RoundTripper
error ([#7386](#7386))
([2ff491f](2ff491f))
* singer-protocol sources filtered destination config for source type
cloud instead of cloudSource
([#7389](#7389))
([f48c997](f48c997))
* **warehouse:** instrument the clickhouse v2 load path
([#7355](#7355))
([4d743db](4d743db))
* **warehouse:** pass temporary credentials to the clickhouse v2 s3 copy
engine
([#7353](#7353))
([4d743db](4d743db))
* **warehouse:** retire idle clickhouse v2 connections
([#7352](#7352))
([4d743db](4d743db))
* **warehouse:** retry a failed clickhouse v2 block
([#7354](#7354))
([4d743db](4d743db))


### Miscellaneous

* log the candidate error when a backend config shadow sample fails to
fetch ([#7383](#7383))
([eaa9b61](eaa9b61))
* **processor:** assemble side-PU report metrics at end of preprocess
stage ([#7346](#7346))
([4540876](4540876))
* sync release v1.86.0 to main branch
([#7356](#7356))
([6868c6c](6868c6c))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants