Skip to content

fix: mid-run pod deaths under concurrent test runs - #7212

Merged
mihir20 merged 8 commits into
release/1.81.xfrom
mihir/add-obs-pyt-test
Jul 27, 2026
Merged

mihir20 merged 8 commits into
release/1.81.xfrom
mihir/add-obs-pyt-test

Conversation

@mihir20

@mihir20 mihir20 commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fixes a mid-run pod-death bug in concurrent ephemeral pyt test runs, adds per-operation observability to the processor's CP-facing Forward RPC (Python transformation tests), and makes the ephemeral pyt
deployer's timing knobs configurable.

Bug fix: mid-run pod deaths under concurrent test runs

Concurrent ephemeral test runs for the same workspace carried identical label sets, so every run's Service selected every run's pods. A request forwarded through run A's Service could land on run B's
pod — which run B deletes the moment it finishes, killing A's request mid-flight ("Subprocess died (exit code -15)").

Each run's Deployment selector, pod template labels, and Service selector now also carry a per-run name label (rudderstack.com/run = the unique pyt-test-<suffix> name), making concurrent runs
label-disjoint: each Service selects only its own run's pods. Covered by a test asserting two same-workspace runs produce Services that select their own pods and not each other's.

New metrics

Metric Type Tags What it measures
processor_pyt_forward_rpc_time timer op, route, workspaceId The whole Forward RPC: deployment setup + readiness wait + request
processor_pyt_request_handle_time timer op, route, workspaceId Just the HTTP request to the pyt pod
processor_pyt_readiness_wait_time timer workspaceId, success Time spent waiting for the ephemeral Deployment to report ready
processor_pyt_cleanup_failure_count count workspaceId Best-effort delete failures (work leaked to the reaper)
  • route distinguishes the three forwarding paths: ephemeral (fresh pyt deployment), production (config-flagged workspaces), static (AST ops).
  • On the ephemeral route, forward_rpc_time − request_handle_time tells you how much of a slow test was setup vs. actual execution; the readiness-wait timer breaks the setup portion down further.
    success:false readiness samples cluster at the configured timeout, making timeouts visible.
  • processor_pyt_request_handle_time is only emitted when a request was actually made — a deployer failure before forwarding records no sample. Rejected requests (invalid op/workspaceId) emit nothing.
  • Histogram buckets for all three timers are registered in runner/buckets.go.
  • The cold-start / retry counters in user_transformer.forwardTest now carry a path tag so retries can be attributed per pyt endpoint.

New config keys (Processor.pytDeployer.*)

Key Default Notes
pytTestReadinessPollInterval 250ms Reloadable; was a hardcoded constant
pytTestDeleteTimeout 15s Reloadable; bounds best-effort cleanup, was a hardcoded constant
pytTestRunIDLength 8 Random suffix length for ephemeral resource names; clamped to keep pyt-test-<suffix> a valid DNS-1035 label

Implementation notes

  • pytdeployer.New now takes stats.Stats; cpservice.Service retains the stats handle it already received.
  • The three routes in Forward share a single timedForward closure that emits the request timer itself, so no forward ⇒ no sample, with no extra bookkeeping.

Linear Ticket

Security

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

@mihir20 mihir20 changed the title mihir/add-obs-pyt-test fix: mid-run pod deaths under concurrent test runs Jul 24, 2026
mihir20 added 5 commits July 24, 2026 12:54
…ding for runIDLength, readinessPollInterval, and deleteTimeout

🔒 Scanned for secrets using gitleaks 8.28.0
…rd time and readiness wait metrics

🔒 Scanned for secrets using gitleaks 8.28.0
…t handling

🔒 Scanned for secrets using gitleaks 8.28.0
🔒 Scanned for secrets using gitleaks 8.28.0
…nt stability

🔒 Scanned for secrets using gitleaks 8.28.0
@mihir20
mihir20 force-pushed the mihir/add-obs-pyt-test branch from fe13593 to 3945149 Compare July 24, 2026 07:24
@mihir20
mihir20 marked this pull request as ready for review July 24, 2026 07:34
@mihir20
mihir20 requested review from fracasula and ktgowtham July 24, 2026 07:34
…rtions

🔒 Scanned for secrets using gitleaks 8.28.0
@codecov

codecov Bot commented Jul 24, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.48485% with 1 line in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (release/1.81.x@2d4ab7b). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...l/transformer/user_transformer/user_transformer.go 66.66% 1 Missing ⚠️
Additional details and impacted files
@@                Coverage Diff                @@
##             release/1.81.x    #7212   +/-   ##
=================================================
  Coverage                  ?   79.78%           
=================================================
  Files                     ?      596           
  Lines                     ?    66477           
  Branches                  ?        0           
=================================================
  Hits                      ?    53038           
  Misses                    ?    10319           
  Partials                  ?     3120           

☔ 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.

Comment thread processor/cpservice/forward.go Outdated
route := "static"
if isExecutionOp {
if s.isProdRouted(req.WorkspaceId) {
route = "production"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use constants for these?

Comment thread processor/internal/pytdeployer/k8s.go Outdated
defer cancel()

ticker := time.NewTicker(readinessPollInterval)
ticker := time.NewTicker(d.config.readinessPollInterval.Load())

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm not mistaken tickers panic with anything <= 0, bringing down the whole processor. Beware of feeding reloadable vars directly here.

Comment thread processor/cpservice/forward.go Outdated
timedForward := func(ctx context.Context, baseURL string) (int, []byte, error) {
execStart := time.Now()
statusCode, body, err := forward(ctx, baseURL, req.WorkspaceId, req.Payload)
s.stat.NewTaggedStat("processor_pyt_request_handle_time", stats.TimerType, tags).Since(execStart)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't we emit this even on failures like readiness timeouts or deployer failures? We might want to add a success label to tell them apart.

// from starting on an out-of-range value.
func runIDLength(conf *config.Config) int {
const prefixLen = len("pyt-test-")
length := conf.GetIntVar(8, 1, "Processor.pytDeployer.pytTestRunIDLength")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we need this configurable at all. A configured value of 1 to 3 is accepted silently (~32–~32³ possible names). Under concurrent load two different runs can then generate the same name and we would get AlreadyExists (which is assumed as "our own retry succeeded").

This means that both runs share one Deployment/Service. Any thoughts?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have kept the default value of 8, Ideally we should not see collisions on 8 but just to be on a safer side I made this configurable.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you still want it to be configurable then let's make sure it is at least 8 and no less? Wdyt? The problem is misconfiguration here. If you pass 1 somehow then you get a nasty silent bug.

🔒 Scanned for secrets using gitleaks 8.28.0
@mihir20
mihir20 requested a review from fracasula July 24, 2026 10:09

@fracasula fracasula left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks mostly good, left another comment on the metrics because I think that it could cause confusion and make things hard to understand when looking at the dashboards.

Comment thread processor/internal/pytdeployer/k8s.go Outdated
// a forward error, or success alike. It never changes the response
// returned to the caller; a failed delete is only logged.
defer d.delete(ctx, name)
defer d.delete(ctx, name, workspaceID)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just move this up and you can delete the repetition in the above if.

err := d.waitReady(ctx, name)
// Emitted on both outcomes: the success:false series makes readiness
// timeouts visible and clusters at the configured readiness timeout.
d.stat.NewTaggedStat("processor_pyt_readiness_wait_time", stats.TimerType, stats.Tags{

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On a Deployment/Service Create failure (ephemeral route), RunOnEphemeral returns before readyStart, so processor_pyt_readiness_wait_time is never emitted, and the forward closure is never invoked so processor_pyt_request_handle_time isn't either.

The real problem though it's that basically if that were to happen, the single
metric for that failed RPC is processor_pyt_forward_rpc_time. This means that there would be no way to tell it apart from a slow success.

🔒 Scanned for secrets using gitleaks 8.28.0
@mihir20
mihir20 merged commit cf89256 into release/1.81.x Jul 27, 2026
73 checks passed
@mihir20
mihir20 deleted the mihir/add-obs-pyt-test branch July 27, 2026 07:16
mihir20 pushed a commit that referenced this pull request Jul 27, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.81.2](v1.81.1...v1.81.2)
(2026-07-27)


### Bug Fixes

* mid-run pod deaths under concurrent test runs
([#7212](#7212))
([cf89256](cf89256))

---
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 Jul 27, 2026
# Description

Syncing patch release v1.81.2 to main branch

**↓↓ Please review and edit commit overrides before merging ↓↓**

BEGIN_COMMIT_OVERRIDE
fix: mid-run pod deaths under concurrent test runs (#7212)
END_COMMIT_OVERRIDE

---------

Co-authored-by: Mahesh Kutty <[email protected]>
Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
Co-authored-by: Mihir Gandhi <[email protected]>
mihir20 added a commit that referenced this pull request Jul 27, 2026
# Description

Syncing patch release v1.81.3 to main branch

**↓↓ Please review and edit commit overrides before merging ↓↓**

BEGIN_COMMIT_OVERRIDE
fix: use correct JSON tag for adjustedConversionTime in bing-ads (#7204)
fix: mid-run pod deaths under concurrent test runs (#7212)
fix: apply configured client QPS and Burst settings in restConfig
(#7220)
END_COMMIT_OVERRIDE

---------

Co-authored-by: Mahesh Kutty <[email protected]>
Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
Co-authored-by: Mihir Gandhi <[email protected]>
itsmihir pushed a commit that referenced this pull request Aug 3, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.82.0-rc.1](v1.81.0...v1.82.0-rc.1)
(2026-08-03)


### Features

* **processor:** fork event processing for configured isolated
destinations
([#7207](#7207))
([6eb91b4](6eb91b4))
* **processor:** isolated destination processing pipeline
([#7202](#7202))
([a684641](a684641))
* **router:** detect and classify transformer-proxy contract breaches
(INT-6839)
([#7184](#7184))
([c7a15a8](c7a15a8))
* **router:** gate 296 delivered-with-warning behind per-workspace
rollout
([#7217](#7217))
([1d772a1](1d772a1))


### Bug Fixes

* apply configured client QPS and Burst settings in restConfig
([#7220](#7220))
([762bc06](762bc06))
* gcs manager allows non-service account credentials and warehouse ssl
keys can escape their containing path
([#7227](#7227))
([3e126b2](3e126b2))
* mid-run pod deaths under concurrent test runs
([#7212](#7212))
([5279b64](5279b64))
* normalize null BingAds offline conversion fields
([#7236](#7236))
([678f130](678f130))
* use correct JSON tag for adjustedConversionTime in bing-ads
([#7204](#7204))
([50df0f7](50df0f7))


### Miscellaneous

* add new readme logo
([#7200](#7200))
([ab86afd](ab86afd))
* **deps:** bump the go-deps group across 1 directory with 32 updates
([#7199](#7199))
([0eaa833](0eaa833))
* **jobsdb:** graceful shutdown of addNewDSLoop and refreshDSListLoop
([#7210](#7210))
([78e104c](78e104c))
* remove archiveInPreProcess processor toggle
([#7205](#7205))
([f471b1d](f471b1d))

---
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>
itsmihir pushed a commit that referenced this pull request Aug 4, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.82.0](v1.81.0...v1.82.0)
(2026-08-03)


### Features

* **processor:** fork event processing for configured isolated
destinations
([#7207](#7207))
([6eb91b4](6eb91b4))
* **processor:** isolated destination processing pipeline
([#7202](#7202))
([a684641](a684641))
* **router:** detect and classify transformer-proxy contract breaches
(INT-6839)
([#7184](#7184))
([c7a15a8](c7a15a8))
* **router:** gate 296 delivered-with-warning behind per-workspace
rollout
([#7217](#7217))
([1d772a1](1d772a1))


### Bug Fixes

* apply configured client QPS and Burst settings in restConfig
([#7220](#7220))
([762bc06](762bc06))
* gcs manager allows non-service account credentials and warehouse ssl
keys can escape their containing path
([#7227](#7227))
([3e126b2](3e126b2))
* mid-run pod deaths under concurrent test runs
([#7212](#7212))
([5279b64](5279b64))
* normalize null BingAds offline conversion fields
([#7236](#7236))
([678f130](678f130))
* use correct JSON tag for adjustedConversionTime in bing-ads
([#7204](#7204))
([50df0f7](50df0f7))


### Miscellaneous

* add new readme logo
([#7200](#7200))
([ab86afd](ab86afd))
* **deps:** bump the go-deps group across 1 directory with 32 updates
([#7199](#7199))
([0eaa833](0eaa833))
* **jobsdb:** graceful shutdown of addNewDSLoop and refreshDSListLoop
([#7210](#7210))
([78e104c](78e104c))
* remove archiveInPreProcess processor toggle
([#7205](#7205))
([f471b1d](f471b1d))

---
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.

3 participants