Skip to content

fix: warehouse source empty jobs - #6204

Merged
achettyiitr merged 3 commits into
release/1.56.xfrom
fix.warehouse-source-insert-jobs-empty
Aug 1, 2025
Merged

achettyiitr merged 3 commits into
release/1.56.xfrom
fix.warehouse-source-insert-jobs-empty

Conversation

@achettyiitr

@achettyiitr achettyiitr commented Jul 31, 2025 •

Copy link
Copy Markdown
Member

Description

  • While inserting source jobs, in case of empty tables or jobs, return an error instead of silently succeeding it.
goroutine 62670 [running]:
github.com/rudderlabs/rudder-go-kit/logger.(*logger).Fataln(0x4000805680, {0x480acd4, 0x27}, {0x40028db808, 0x7, 0x3?})
\t/go/pkg/mod/github.com/rudderlabs/[email protected]/logger/logger.go:381 +0x234
github.com/rudderlabs/rudder-server/utils/crash.(*panicLogger).Handler.func1.(*panicLogger).Notify.1.1()
\t/rudder-server/utils/crash/logger.go:33 +0x57c
sync.(*Once).doSlow(0x16?, 0x25?)
\t/usr/local/go/src/sync/once.go:78 +0xf0
sync.(*Once).Do(0x4006826bd8?, 0x4fa9c?)
\t/usr/local/go/src/sync/once.go:69 +0x24
github.com/rudderlabs/rudder-server/utils/crash.(*panicLogger).Handler.func1.(*panicLogger).Notify.1()
\t/rudder-server/utils/crash/logger.go:32 +0x90
panic({0x43fe800?, 0x4083180b10?})
\t/usr/local/go/src/runtime/panic.go:792 +0x124
github.com/rudderlabs/rudder-server/warehouse/internal/repo.(*Source).Insert(0x400082b650, {0x509cf78, 0x4005449a10}, {0x7e4f280, 0x0, 0x0})
\t/rudder-server/warehouse/internal/repo/source.go:54 +0x2e8
github.com/rudderlabs/rudder-server/warehouse/source.(*Manager).InsertJobs(0x4000a9c6c0, {0x509cf78, 0x4005449a10}, {{0x4082e86da0, 0x1b}, {0x4082e86dc0, 0x1b}, {{0x0, 0xee01da36a, 0x0}}, ...})
\t/rudder-server/warehouse/source/source.go:112 +0x7d0
github.com/rudderlabs/rudder-server/warehouse/source.(*Manager).InsertJobHandler(0x4000a9c6c0, {0x5092510, 0x4083193308}, 0x40010b7680)
\t/rudder-server/warehouse/source/http.go:37 +0x33c
net/http.HandlerFunc.ServeHTTP(0x400082b9e0?, {0x5092510?, 0x4083193308?}, 0x0?)
\t/usr/local/go/src/net/http/server.go:2294 +0x38
github.com/rudderlabs/rudder-server/warehouse/api.(*Api).addMasterEndpoints.func1.1.(*Api).logMiddleware.3({0x5092510, 0x4083193308}, 0x40010b7680)
\t/rudder-server/warehouse/api/http.go:460 +0x58
net/http.HandlerFunc.ServeHTTP(0x4043b52c30?, {0x5092510?, 0x4083193308?}, 0x400e4ccba4?)
\t/usr/local/go/src/net/http/server.go:2294 +0x38
github.com/go-chi/chi/v5.(*Mux).routeHTTP(0x400c4c0120, {0x5092510, 0x4083193308}, 0x40010b7680)
\t/go/pkg/mod/github.com/go-chi/chi/[email protected]/mux.go:478 +0x280
net/http.Hand","stack":"goroutine 62670 [running]:
runtime/debug.Stack()
\t/usr/local/go/src/runtime/debug/stack.go:26 +0x64
github.com/rudderlabs/rudder-server/utils/crash.(*panicLogger).Handler.func1.(*panicLogger).Notify.1.1()
\t/rudder-server/utils/crash/logger.go:34 +0x4c
sync.(*Once).doSlow(0x16?, 0x25?)
\t/usr/local/go/src/sync/once.go:78 +0xf0
sync.(*Once).Do(0x4006826bd8?, 0x4fa9c?)
\t/usr/local/go/src/sync/once.go:69 +0x24
github.com/rudderlabs/rudder-server/utils/crash.(*panicLogger).Handler.func1.(*panicLogger).Notify.1()
\t/rudder-server/utils/crash/logger.go:32 +0x90
panic({0x43fe800?, 0x4083180b10?})
\t/usr/local/go/src/runtime/panic.go:792 +0x124
github.com/rudderlabs/rudder-server/warehouse/internal/repo.(*Source).Insert(0x400082b650, {0x509cf78, 0x4005449a10}, {0x7e4f280, 0x0, 0x0})
\t/rudder-server/warehouse/internal/repo/source.go:54 +0x2e8
github.com/rudderlabs/rudder-server/warehouse/source.(*Manager).InsertJobs(0x4000a9c6c0, {0x509cf78, 0x4005449a10}, {{0x4082e86da0, 0x1b}, {0x4082e86dc0, 0x1b}, {{0x0, 0xee01da36a, 0x0}}, ...})
\t/rudder-server/warehouse/source/source.go:112 +0x7d0
github.com/rudderlabs/rudder-server/warehouse/source.(*Manager).InsertJobHandler(0x4000a9c6c0, {0x5092510, 0x4083193308}, 0x40010b7680)
\t/rudder-server/warehouse/source/http.go:37 +0x33c
net/http.HandlerFunc.ServeHTTP(0x400082b9e0?, {0x5092510?, 0x4083193308?}, 0x0?)
\t/usr/local/go/src/net/http/server.go:2294 +0x38
github.com/rudderlabs/rudder-server/warehouse/api.(*Api).addMasterEndpoints.func1.1.(*Api).logMiddleware.3({0x5092510, 0x4083193308}, 0x40010b7680)

runtime error: index out of range [0] with length 0

Linear Ticket

  • Resolves WAR-993

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 Jul 31, 2025 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.93%. Comparing base (11e930c) to head (025149e).
⚠️ Report is 2 commits behind head on release/1.56.x.

Files with missing lines Patch % Lines
warehouse/internal/repo/source.go 0.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@                Coverage Diff                 @@
##           release/1.56.x    #6204      +/-   ##
==================================================
- Coverage           77.02%   76.93%   -0.10%     
==================================================
  Files                 511      511              
  Lines               70205    70023     -182     
==================================================
- Hits                54077    53870     -207     
- Misses              13227    13260      +33     
+ Partials             2901     2893       -8     

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

Comment thread warehouse/source/source.go Resolved
@vyeshwanth

vyeshwanth commented Aug 1, 2025 •

Copy link
Copy Markdown
Contributor
defer (*repo)(s).TimerStat("insert", stats.Tags{
		"sourceId":    sourceJobs[0].SourceID,
		"destId":      sourceJobs[0].DestinationID,
		"workspaceId": sourceJobs[0].WorkspaceID,
	})()

This is still the problem, We should check for the length here before trying to reference the first source job.

@achettyiitr

Copy link
Copy Markdown
Member Author
defer (*repo)(s).TimerStat("insert", stats.Tags{
		"sourceId":    sourceJobs[0].SourceID,
		"destId":      sourceJobs[0].DestinationID,
		"workspaceId": sourceJobs[0].WorkspaceID,
	})()

This is still the problem, We should check for the length here before trying to reference the first source job.

There is already a check on the caller, why is it still a problem? I can add a check here as well if required?

@vyeshwanth

vyeshwanth commented Aug 1, 2025 •

Copy link
Copy Markdown
Contributor
defer (*repo)(s).TimerStat("insert", stats.Tags{
		"sourceId":    sourceJobs[0].SourceID,
		"destId":      sourceJobs[0].DestinationID,
		"workspaceId": sourceJobs[0].WorkspaceID,
	})()

This is still the problem, We should check for the length here before trying to reference the first source job.

There is already a check on the caller, why is it still a problem? I can add a check here as well if required?

we better add a check here and return early if len is 0. Problem is we use this repo method elsewhere, results in panic again

@achettyiitr
achettyiitr merged commit e27b8c0 into release/1.56.x Aug 1, 2025
@achettyiitr
achettyiitr deleted the fix.warehouse-source-insert-jobs-empty branch August 1, 2025 07:43
achettyiitr pushed a commit that referenced this pull request Aug 1, 2025
🤖 I have created a release *beep* *boop*
---


##
[1.56.1](v1.56.0...v1.56.1)
(2025-08-01)


### Bug Fixes

* warehouse source empty jobs
([#6204](#6204))
([e27b8c0](e27b8c0))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
mihir20 pushed a commit that referenced this pull request Aug 1, 2025
# Description

Syncing patch release v1.56.1 to main branch

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

BEGIN_COMMIT_OVERRIDE
fix: warehouse source empty jobs (#6204)
END_COMMIT_OVERRIDE

---------

Co-authored-by: Akash Chetty <[email protected]>
mihir20 pushed a commit that referenced this pull request Aug 18, 2025
🤖 I have created a release *beep* *boop*
---


##
[1.57.0-rc.1](v1.56.0...v1.57.0-rc.1)
(2025-08-18)


### Features

* add support for manual sync mode in warehouse
([#6199](#6199))
([6f87119](6f87119))
* **router:** support different throttler per event type
([#6181](#6181))
([12254bb](12254bb))
* warehouse grpc API to get namespace mappings of a destination
([#6200](#6200))
([9613236](9613236))


### Bug Fixes

* adaptive throttling not applying dynamic throttling limits
consistently
([#6219](#6219))
([478b2e1](478b2e1))
* error extractor to handle nested JSON responses
([#6209](#6209))
([ffc0d7a](ffc0d7a))
* getting occasional unauthenticated errors from googlepubsub
([#6228](#6228))
([cc39306](cc39306))
* handle snowpipe service restarts in destination polling logic
([#6236](#6236))
([b76bc7f](b76bc7f))
* handling empty schema for table level schemas
([#6233](#6233))
([cc39306](cc39306))
* histogram buckets for schema snapshots
([#6234](#6234))
([cc39306](cc39306))
* warehouse source empty jobs
([#6204](#6204))
([42f5ae4](42f5ae4))


### Miscellaneous

* bump the go-dependencies group with 12 updates
([#6189](#6189))
([e6e2bcd](e6e2bcd))
* enforcing non-sugared logger
([#6066](#6066))
([b24ded8](b24ded8))
* force new MTU metrics from 1st September 2025 onwards
([#6227](#6227))
([154d2c3](154d2c3))
* implement configurable deduplication mirror mode
([#6224](#6224))
([c97ad7a](c97ad7a))
* refactor Google Pub/Sub to add retry logic for auth errors
([#6229](#6229))
([cc39306](cc39306))
* remove enableV2NotifierJob flag support
([#6196](#6196))
([8be54bf](8be54bf))
* remove event blocking flag
([#6240](#6240))
([e668e14](e668e14))
* remove queryWithUploadId flag support for load files
([#6192](#6192))
([e6e2bcd](e6e2bcd))
* revert "fix: snowpipe events getting duplicated if status API fails"
([#6211](#6211))
([777b08e](777b08e))
* skip warehouse destinations from version deprecation error extraction
([#6226](#6226))
([87c3320](87c3320))
* stop collecting errors in proc_error jobsdb
([#6232](#6232))
([c600968](c600968))
* throttler should emit no warning if not enabled
([#6223](#6223))
([0773168](0773168))
* update keydb dependency
([#6222](#6222))
([d1d64bc](d1d64bc))
* use harbor to pull docker images
([#6210](#6210))
([6c324cf](6c324cf))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
ItsSudip pushed a commit that referenced this pull request Aug 19, 2025
🤖 I have created a release *beep* *boop*
---


##
[1.57.0-rc.2](v1.56.0...v1.57.0-rc.2)
(2025-08-19)


### Features

* add support for manual sync mode in warehouse
([#6199](#6199))
([6f87119](6f87119))
* enable oauthV2 by removing oauthV2enabled variable
([#6175](#6175))
([caad8f0](caad8f0))
* **router:** support different throttler per event type
([#6181](#6181))
([12254bb](12254bb))
* warehouse grpc API to get namespace mappings of a destination
([#6200](#6200))
([9613236](9613236))


### Bug Fixes

* adaptive throttling not applying dynamic throttling limits
consistently
([#6219](#6219))
([478b2e1](478b2e1))
* error extractor to handle nested JSON responses
([#6209](#6209))
([ffc0d7a](ffc0d7a))
* getting occasional unauthenticated errors from googlepubsub
([#6228](#6228))
([cc39306](cc39306))
* handle snowpipe service restarts in destination polling logic
([#6236](#6236))
([b76bc7f](b76bc7f))
* handling empty schema for table level schemas
([#6233](#6233))
([cc39306](cc39306))
* histogram buckets for schema snapshots
([#6234](#6234))
([cc39306](cc39306))
* warehouse source empty jobs
([#6204](#6204))
([42f5ae4](42f5ae4))


### Miscellaneous

* bump the go-dependencies group with 12 updates
([#6189](#6189))
([e6e2bcd](e6e2bcd))
* enforcing non-sugared logger
([#6066](#6066))
([b24ded8](b24ded8))
* force new MTU metrics from 1st September 2025 onwards
([#6227](#6227))
([154d2c3](154d2c3))
* implement configurable deduplication mirror mode
([#6224](#6224))
([c97ad7a](c97ad7a))
* refactor Google Pub/Sub to add retry logic for auth errors
([#6229](#6229))
([cc39306](cc39306))
* remove enableV2NotifierJob flag support
([#6196](#6196))
([8be54bf](8be54bf))
* remove event blocking flag
([#6240](#6240))
([e668e14](e668e14))
* remove queryWithUploadId flag support for load files
([#6192](#6192))
([e6e2bcd](e6e2bcd))
* revert "fix: snowpipe events getting duplicated if status API fails"
([#6211](#6211))
([777b08e](777b08e))
* skip warehouse destinations from version deprecation error extraction
([#6226](#6226))
([87c3320](87c3320))
* stop collecting errors in proc_error jobsdb
([#6232](#6232))
([c600968](c600968))
* throttler should emit no warning if not enabled
([#6223](#6223))
([0773168](0773168))
* update keydb dependency
([#6222](#6222))
([d1d64bc](d1d64bc))
* use harbor to pull docker images
([#6210](#6210))
([6c324cf](6c324cf))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
mihir20 pushed a commit that referenced this pull request Aug 19, 2025
🤖 I have created a release *beep* *boop*
---


##
[1.57.0](v1.56.0...v1.57.0)
(2025-08-19)


### Features

* add support for manual sync mode in warehouse
([#6199](#6199))
([6f87119](6f87119))
* enable oauthV2 by removing oauthV2enabled variable
([#6175](#6175))
([caad8f0](caad8f0))
* **router:** support different throttler per event type
([#6181](#6181))
([12254bb](12254bb))
* warehouse grpc API to get namespace mappings of a destination
([#6200](#6200))
([9613236](9613236))


### Bug Fixes

* adaptive throttling not applying dynamic throttling limits
consistently
([#6219](#6219))
([478b2e1](478b2e1))
* error extractor to handle nested JSON responses
([#6209](#6209))
([ffc0d7a](ffc0d7a))
* getting occasional unauthenticated errors from googlepubsub
([#6228](#6228))
([cc39306](cc39306))
* handle snowpipe service restarts in destination polling logic
([#6236](#6236))
([b76bc7f](b76bc7f))
* handling empty schema for table level schemas
([#6233](#6233))
([cc39306](cc39306))
* histogram buckets for schema snapshots
([#6234](#6234))
([cc39306](cc39306))
* warehouse source empty jobs
([#6204](#6204))
([42f5ae4](42f5ae4))


### Miscellaneous

* bump the go-dependencies group with 12 updates
([#6189](#6189))
([e6e2bcd](e6e2bcd))
* enforcing non-sugared logger
([#6066](#6066))
([b24ded8](b24ded8))
* force new MTU metrics from 1st September 2025 onwards
([#6227](#6227))
([154d2c3](154d2c3))
* implement configurable deduplication mirror mode
([#6224](#6224))
([c97ad7a](c97ad7a))
* refactor Google Pub/Sub to add retry logic for auth errors
([#6229](#6229))
([cc39306](cc39306))
* remove enableV2NotifierJob flag support
([#6196](#6196))
([8be54bf](8be54bf))
* remove event blocking flag
([#6240](#6240))
([e668e14](e668e14))
* remove queryWithUploadId flag support for load files
([#6192](#6192))
([e6e2bcd](e6e2bcd))
* revert "fix: snowpipe events getting duplicated if status API fails"
([#6211](#6211))
([777b08e](777b08e))
* skip warehouse destinations from version deprecation error extraction
([#6226](#6226))
([87c3320](87c3320))
* stop collecting errors in proc_error jobsdb
([#6232](#6232))
([c600968](c600968))
* throttler should emit no warning if not enabled
([#6223](#6223))
([0773168](0773168))
* update keydb dependency
([#6222](#6222))
([d1d64bc](d1d64bc))
* use harbor to pull docker images
([#6210](#6210))
([6c324cf](6c324cf))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
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