Skip to content

fix: detect server-side snowpipe channel failures via per-channel status at stuck threshold - #7166

Merged
shekhar-rudder merged 1 commit into
masterfrom
fix/int-6530-snowpipe-use-per-channel-status-checks-to-detect-server-side
Jul 9, 2026
Merged

shekhar-rudder merged 1 commit into
masterfrom
fix/int-6530-snowpipe-use-per-channel-status-checks-to-detect-server-side

Conversation

@shekhar-rudder

Copy link
Copy Markdown
Member

Description

The Snowflake Ingest SDK has a bug (snowflake-ingest-java#1154) where the batch channel-status method silently ignores server-side failure status codes (e.g. status_code=35) and reports channels as valid=true even when Snowflake has flagged them broken.

Our snowpipe-streaming consumer polls channel status via the bulk-status endpoint. When a channel is silently broken, bulk-status keeps returning valid=true, so the consumer never enters its normal invalid-channel recovery path. Instead it keeps polling until the 15-minute stuck-pipeline threshold trips, at which point it logs "Stuck snowpipe pipeline detected" (an alert) and fails all in-progress jobs — a 15-minute delay, misreported as a stuck pipeline.

Change

At the stuck-pipeline threshold in Manager.Poll, each still-in-progress channel is re-checked via the single-channel status endpoint (GetStatus), which correctly surfaces server-side failures (the per-channel method throws, and the snowpipe service returns success=false/valid=false).

  • Confirmed invalid channels (!Valid || !Success) are failed through the normal failed-import path (channel deleted, jobs retried next batch) without the "Stuck snowpipe pipeline detected" alert.
  • Genuinely stuck channels (single-channel check still reports valid) keep the existing alert + "events still in progress after threshold…" failure reason.
  • Inconclusive checks (the GetStatus call itself errors) are treated as stuck — fail-safe: the alert is suppressed only on a positive invalid confirmation.

This re-wires GetStatus back into the api interface and apiAdapter (the reverse of #6992, which had removed the per-channel path when bulk-status became the default). The lower-level internal/api/api.go GetStatus was kept intact by that commit, so no new client code is needed. No change is required in rudder-snowpipe-clients — its single-channel /channels/{id}/status endpoint already surfaces broken channels. Once the upstream SDK fix ships, this per-channel recheck can be removed.

Tests

  • Re-added mockAPI.GetStatus + getStatusOutputMap.
  • Updated the existing "marks in-progress imports as failed after threshold" test so the single-channel check reports valid (genuinely-stuck path unchanged).
  • Added "recovers invalid channel at threshold without stuck-pipeline alert" (invalid → per-channel-invalid reason, no alert).
  • Added "treats inconclusive single-channel check at threshold as stuck" (GetStatus errors → stuck reason, fail-safe).

Verified with go build, full-package go test, gofmt, and go vet.

Linear Ticket

  • Resolves INT-6530

Security

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

🤖 Generated with Claude Code

…tus at stuck threshold

The bulk-status endpoint can silently report a server-side broken Snowpipe
channel as valid=true (snowflake-ingest-java#1154), so a stuck channel is
only failed after the 15-minute stuck-pipeline threshold, and the recovery
is misreported as a stuck pipeline.

At the threshold, re-check each still-in-progress channel via the
single-channel status endpoint, which surfaces the failure. Channels
confirmed invalid are failed through the normal failed-import path without
raising the "Stuck snowpipe pipeline detected" alert; genuinely stuck or
inconclusive (status check errored) channels keep the existing alert and
failure behaviour (fail-safe: only suppress the alert on a positive invalid
confirmation).

Re-wires GetStatus into the api interface and apiAdapter (reverse of #6992).

Resolves INT-6530

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 72.72727% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.66%. Comparing base (7672f96) to head (eae9848).

Files with missing lines Patch % Lines
...destinationmanager/snowpipestreaming/apiadapter.go 0.00% 12 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #7166   +/-   ##
=======================================
  Coverage   79.66%   79.66%           
=======================================
  Files         595      595           
  Lines       66097    66133   +36     
=======================================
+ Hits        52653    52688   +35     
+ Misses      10329    10320    -9     
- Partials     3115     3125   +10     

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

@shekhar-rudder

shekhar-rudder commented Jul 9, 2026 •

Copy link
Copy Markdown
Member Author

✅ End-to-end verification (real Snowflake)

Verified this change end-to-end — not just the unit tests — by running the PR image through a full local stack and driving all three Manager.Poll threshold branches against real infrastructure.

Setup

  • rudder-server from the CI image rudderlabs/develop-rudder-server:pr-7166, full data plane in rudder-mini.
  • JS source → SNOWPIPE_STREAMING destination with real Snowflake key-pair creds.
  • Real rudder-snowpipe-clients + real Snowflake: channels created and rows actually inserted (blobs uploaded + registered; "All events flushed successfully").
  • SDK bug (snowflakedb/snowflake-ingest-java#1154)'s status divergence (which a healthy backend won't produce on demand) reproduced with a small fault-injection proxy between rudder-server and the real snowpipe-clients: it forwards create/insert/delete untouched, forces bulk-status to report in-progress, and rewrites only the single-channel /status per scenario. stuckPipelineThresholdInMinutes=0 so the recheck fires on the first stuck poll.

Results — each branch exercised through the real running server (real apiAdapter.GetStatus + HTTP path, which the mocked unit tests don't cover):

Scenario single-channel /status Observed
Confirmed invalid valid:false WARN "Channel reported invalid at stuck threshold; recovering without stuck-pipeline alert"; job reason channel reported invalid by per-channel status check after threshold; Stuck snowpipe pipeline detected count = 0 ✅
Genuinely stuck valid:true WARN "Stuck snowpipe pipeline detected" + reason events still in progress after threshold: 10s > 0s ✅
Inconclusive HTTP 500 (errors) WARN "Failed to get single-channel status at stuck threshold; treating as stuck" (after retries) → then stuck alert + stuck reason ✅

Fail-safe confirmed: the alert is suppressed only on a positive valid:false — an errored/unavailable GetStatus still raises the stuck alert.

Notes for anyone reproducing

  • Vault stores the privateKey with literal \n; convert to real newlines or Snowflake rejects it as invalid PEM.
  • The destination's warehouse must reach the data plane via the config-backend API (a raw DB edit won't recompute the namespace config); CREATE SCHEMA/TABLE needs USAGE on a warehouse.

The rudder-snowpipe-clients service + this verification recipe are being added to rudder-mini so this is turnkey next time.

🤖 Generated with Claude Code

@shekhar-rudder
shekhar-rudder merged commit 581410c into master Jul 9, 2026
75 checks passed
@shekhar-rudder
shekhar-rudder deleted the fix/int-6530-snowpipe-use-per-channel-status-checks-to-detect-server-side branch July 9, 2026 07:23
This was referenced Jul 20, 2026
mihir20 pushed a commit that referenced this pull request Jul 20, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.81.0-rc.1](v1.80.0...v1.81.0-rc.1)
(2026-07-20)


### Features

* run python transformation tests on ephemeral per-request pyt
deployments
([#7177](#7177))
([1008ae7](1008ae7))
* support partition migration job fanout per jobsdb
([#7141](#7141))
([be42e48](be42e48))


### Bug Fixes

* abort snowpipe events on channel bad request
([#7118](#7118))
([6c08584](6c08584))
* avoid redundant transformer statTags unmarshalling
([#7182](#7182))
([c3c283c](c3c283c))
* classify reverse-ETL sources from config for MAR metering
([#7159](#7159))
([fa7870f](fa7870f))
* detect server-side snowpipe channel failures via per-channel status at
stuck threshold
([#7166](#7166))
([581410c](581410c))
* kafkamanager compilation error
([#7189](#7189))
([1fb7f6e](1fb7f6e))
* **kafka:** support insecure TLS skip verify config
([#7022](#7022))
([d01574f](d01574f))
* preserve order when overflowing snowpipe insert batches
([#7178](#7178))
([9c01fa0](9c01fa0))
* quote postgres warehouse ddl identifiers
([#7127](#7127))
([5aeb481](5aeb481))
* **router:** emit invalid payload metric
([#7168](#7168))
([6e2009a](6e2009a))
* update null to #N/A for salesforce bulk upload
([#7151](#7151))
([1dffd93](1dffd93))
* **warehouse:** use pod identity for rudder-storage flow; keep S3-copy
user fallback for user S3 destinations
([#7167](#7167))
([3f9aa32](3f9aa32))


### Miscellaneous

* add contract tests for test endpoints in pytransformer
([#7147](#7147))
([3b210ec](3b210ec))
* bump compose-test to v0.1.5 to remediate pgx CVE-2026-33815
([#7162](#7162))
([7672f96](7672f96))
* **deps:** bump actions/checkout from 6.0.3 to 7.0.0
([#7132](#7132))
([d453c93](d453c93))
* **deps:** bump actions/setup-go from 6.4.0 to 6.5.0
([#7150](#7150))
([75d9648](75d9648))
* **deps:** bump aws-actions/amazon-ecr-login from 2.1.5 to 2.1.6
([#7109](#7109))
([7b2a859](7b2a859))
* **deps:** bump aws-actions/configure-aws-credentials from 6.2.0 to
6.2.2 ([#7152](#7152))
([c984268](c984268))
* **deps:** bump golangci/golangci-lint-action from 9.2.1 to 9.3.0
([#7170](#7170))
([4565d25](4565d25))
* **deps:** bump the frequent group across 1 directory with 4 updates
([#6891](#6891))
([88a0ddf](88a0ddf))
* support compression in bqstream destinations
([#7142](#7142))
([0694f12](0694f12))

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


##
[1.81.0](v1.80.0...v1.81.0)
(2026-07-20)


### Features

* run python transformation tests on ephemeral per-request pyt
deployments
([#7177](#7177))
([1008ae7](1008ae7))
* support partition migration job fanout per jobsdb
([#7141](#7141))
([be42e48](be42e48))


### Bug Fixes

* abort snowpipe events on channel bad request
([#7118](#7118))
([6c08584](6c08584))
* avoid redundant transformer statTags unmarshalling
([#7182](#7182))
([c3c283c](c3c283c))
* classify reverse-ETL sources from config for MAR metering
([#7159](#7159))
([fa7870f](fa7870f))
* detect server-side snowpipe channel failures via per-channel status at
stuck threshold
([#7166](#7166))
([581410c](581410c))
* kafkamanager compilation error
([#7189](#7189))
([1fb7f6e](1fb7f6e))
* **kafka:** support insecure TLS skip verify config
([#7022](#7022))
([d01574f](d01574f))
* preserve order when overflowing snowpipe insert batches
([#7178](#7178))
([9c01fa0](9c01fa0))
* quote postgres warehouse ddl identifiers
([#7127](#7127))
([5aeb481](5aeb481))
* **router:** emit invalid payload metric
([#7168](#7168))
([6e2009a](6e2009a))
* update null to #N/A for salesforce bulk upload
([#7151](#7151))
([1dffd93](1dffd93))
* **warehouse:** use pod identity for rudder-storage flow; keep S3-copy
user fallback for user S3 destinations
([#7167](#7167))
([3f9aa32](3f9aa32))


### Miscellaneous

* add contract tests for test endpoints in pytransformer
([#7147](#7147))
([3b210ec](3b210ec))
* bump compose-test to v0.1.5 to remediate pgx CVE-2026-33815
([#7162](#7162))
([7672f96](7672f96))
* **deps:** bump actions/checkout from 6.0.3 to 7.0.0
([#7132](#7132))
([d453c93](d453c93))
* **deps:** bump actions/setup-go from 6.4.0 to 6.5.0
([#7150](#7150))
([75d9648](75d9648))
* **deps:** bump aws-actions/amazon-ecr-login from 2.1.5 to 2.1.6
([#7109](#7109))
([7b2a859](7b2a859))
* **deps:** bump aws-actions/configure-aws-credentials from 6.2.0 to
6.2.2 ([#7152](#7152))
([c984268](c984268))
* **deps:** bump golangci/golangci-lint-action from 9.2.1 to 9.3.0
([#7170](#7170))
([4565d25](4565d25))
* **deps:** bump the frequent group across 1 directory with 4 updates
([#6891](#6891))
([88a0ddf](88a0ddf))
* support compression in bqstream destinations
([#7142](#7142))
([0694f12](0694f12))

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