Skip to content

fix: server getting stuck during startup while initializing rsources - #6943

Merged
atzoum merged 1 commit into
masterfrom
fix.rsourcesSetupTimeout
May 14, 2026
Merged

atzoum merged 1 commit into
masterfrom
fix.rsourcesSetupTimeout

Conversation

@atzoum

@atzoum atzoum commented May 9, 2026 •

Copy link
Copy Markdown
Contributor

🔒 Scanned for secrets using gitleaks 8.30.1

Description

The rsources init step performs a DDL (CREATE TABLE/INDEX/PUBLICATION/SUBSCRIPTION) under an advisory lock during server startup. It used context.TODO(), so a stuck socket read inside lib/pq could block startup indefinitely.

To address this:

  • We add a configurable timeout for rsources init (Rsources.setupTimeout, default 60s) so a hung DB call fails fast instead of blocking startup.
  • Propagating the parent context through NewRsourcesService and NewJobService so shutdown also cancels in-flight setup.

Linear Ticket

resolves PIPE-2930

Security

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

@codecov

codecov Bot commented May 11, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 79.67%. Comparing base (5e67a45) to head (7d42b7e).

Files with missing lines Patch % Lines
app/apphandlers/processorAppHandler.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6943      +/-   ##
==========================================
- Coverage   79.72%   79.67%   -0.05%     
==========================================
  Files         565      565              
  Lines       63671    63672       +1     
==========================================
- Hits        50762    50732      -30     
- Misses       9914     9934      +20     
- Partials     2995     3006      +11     

☔ View full report in Codecov by Sentry.
📢 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.

@atzoum
atzoum force-pushed the fix.rsourcesSetupTimeout branch from 385c38d to 7d1a84f Compare May 12, 2026 09:53
Wrap rsources init with a configurable timeout (default 60s,
Rsources.setupTimeout) and propagate the parent context through
NewRsourcesService and NewJobService so a stuck DB socket read can
no longer block startup indefinitely.

Co-Authored-By: Claude Opus 4.7 <[email protected]>

🔒 Scanned for secrets using gitleaks 8.30.1
@atzoum
atzoum force-pushed the fix.rsourcesSetupTimeout branch from 7d1a84f to 7d42b7e Compare May 13, 2026 12:49

@mihir20 mihir20 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

require.NoError(t, err, "should create stats")

service, err = rsources.NewJobService(config, sts)
service, err = rsources.NewJobService(context.Background(), config, sts)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
service, err = rsources.NewJobService(context.Background(), config, sts)
service, err = rsources.NewJobService(t.Context(), config, sts)

require.NoError(t, err, "should create stats")

service, err := NewJobService(JobServiceConfig{
service, err := NewJobService(context.Background(), JobServiceConfig{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
service, err := NewJobService(context.Background(), JobServiceConfig{
service, err := NewJobService(t.Context(), JobServiceConfig{

require.NoError(t, err, "should create stats")

service, err := NewJobService(JobServiceConfig{
service, err := NewJobService(context.Background(), JobServiceConfig{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
service, err := NewJobService(context.Background(), JobServiceConfig{
service, err := NewJobService(t.Context(), JobServiceConfig{

@atzoum
atzoum merged commit 62791fa into master May 14, 2026
73 checks passed
@atzoum
atzoum deleted the fix.rsourcesSetupTimeout branch May 14, 2026 06:28
This was referenced May 25, 2026
mihir20 pushed a commit that referenced this pull request May 25, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.76.0-rc.1](v1.75.0...v1.76.0-rc.1)
(2026-05-25)


### Features

* per-workspace PyT routing + cold-start handling
([#6978](#6978))
([d81e175](d81e175))
* periodic cleanup of rsources shared db tables
([#6945](#6945))
([ed0dfe7](ed0dfe7))


### Bug Fixes

* **batchrouter:** preserve prior LastJobStatus error on drain
([#6958](#6958))
([af31e62](af31e62))
* **batchrouter:** preserve prior LastJobStatus error on drain
([#6958](#6958))
([193f797](193f797))
* clickhouse quarter partition type
([#6965](#6965))
([af31e62](af31e62))
* continuous backend config cache cause postgres disk bloat
([#6983](#6983))
([f45aa06](f45aa06))
* ignore failed messages when source job run id exists
([#6981](#6981))
([045fdc0](045fdc0))
* server getting stuck during startup while initializing rsources
([#6943](#6943))
([62791fa](62791fa))
* snowpipe streaming bulk status offset
([#6966](#6966))
([af31e62](af31e62))


### Miscellaneous

* **ci:** workflow cleanup (SEC-284)
([#6949](#6949))
([516ba5b](516ba5b))
* **deps:** bump actions/upload-artifact from 7.0.0 to 7.0.1
([#6892](#6892))
([866f04d](866f04d))
* **deps:** bump aws-actions/amazon-ecr-login from 2.0.1 to 2.1.4
([#6956](#6956))
([89f1168](89f1168))
* **deps:** bump docker/login-action from 4.0.0 to 4.1.0
([#6881](#6881))
([5bca875](5bca875))
* **deps:** bump rudderlabs/build-scan-push-action from 1.8.2 to 2.2.0
([#6955](#6955))
([78cc895](78cc895))
* **deps:** bump step-security/harden-runner from 2.16.0 to 2.19.1
([#6957](#6957))
([cc5b578](cc5b578))
* **jobsdb:** disable no results cache state filter optimization
([#6964](#6964))
([c20dad2](c20dad2))
* **jobsdb:** release dsList read lock early during store
([#6963](#6963))
([a172404](a172404))
* pyt contracts for ipc and multi threading
([#6942](#6942))
([d570865](d570865))
* remove unused sed deletion method from GZIPLocalFileHandler
([#6974](#6974))
([d788760](d788760))
* replace deprecated WithCredentialsJSON with WithAuthCredentialsJSON
([#6986](#6986))
([8395174](8395174))
* sync release v1.75.0 to main branch
([#6954](#6954))
([f16fe93](f16fe93))

---
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 May 26, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.76.0](v1.75.0...v1.76.0)
(2026-05-25)


### Features

* per-workspace PyT routing + cold-start handling
([#6978](#6978))
([d81e175](d81e175))
* periodic cleanup of rsources shared db tables
([#6945](#6945))
([ed0dfe7](ed0dfe7))


### Bug Fixes

* **batchrouter:** preserve prior LastJobStatus error on drain
([#6958](#6958))
([af31e62](af31e62))
* **batchrouter:** preserve prior LastJobStatus error on drain
([#6958](#6958))
([193f797](193f797))
* clickhouse quarter partition type
([#6965](#6965))
([af31e62](af31e62))
* continuous backend config cache cause postgres disk bloat
([#6983](#6983))
([f45aa06](f45aa06))
* ignore failed messages when source job run id exists
([#6981](#6981))
([045fdc0](045fdc0))
* server getting stuck during startup while initializing rsources
([#6943](#6943))
([62791fa](62791fa))
* snowpipe streaming bulk status offset
([#6966](#6966))
([af31e62](af31e62))


### Miscellaneous

* **ci:** workflow cleanup (SEC-284)
([#6949](#6949))
([516ba5b](516ba5b))
* **deps:** bump actions/upload-artifact from 7.0.0 to 7.0.1
([#6892](#6892))
([866f04d](866f04d))
* **deps:** bump aws-actions/amazon-ecr-login from 2.0.1 to 2.1.4
([#6956](#6956))
([89f1168](89f1168))
* **deps:** bump docker/login-action from 4.0.0 to 4.1.0
([#6881](#6881))
([5bca875](5bca875))
* **deps:** bump rudderlabs/build-scan-push-action from 1.8.2 to 2.2.0
([#6955](#6955))
([78cc895](78cc895))
* **deps:** bump step-security/harden-runner from 2.16.0 to 2.19.1
([#6957](#6957))
([cc5b578](cc5b578))
* **jobsdb:** disable no results cache state filter optimization
([#6964](#6964))
([c20dad2](c20dad2))
* **jobsdb:** release dsList read lock early during store
([#6963](#6963))
([a172404](a172404))
* pyt contracts for ipc and multi threading
([#6942](#6942))
([d570865](d570865))
* remove unused sed deletion method from GZIPLocalFileHandler
([#6974](#6974))
([d788760](d788760))
* replace deprecated WithCredentialsJSON with WithAuthCredentialsJSON
([#6986](#6986))
([8395174](8395174))
* sync release v1.75.0 to main branch
([#6954](#6954))
([f16fe93](f16fe93))

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