Repository navigation
Shash sriv/stream 1807 discard tasks from incorrect applications #803
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ShashSriv
merged 7 commits into
main
from
ShashSriv/stream-1807-discard-tasks-from-incorrect-applications
Oct 5, 2026
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
34ac651
feat(consumer): Discard activations from applications a pool cannot run
ShashSriv 275fb4b
test(consumer): Cover the deadletter publish for discarded activations
ShashSriv 137904b
ref(consumer): Trim comments on the application check
ShashSriv 7bf2633
Merge branch 'main' into ShashSriv/stream-1807-discard-tasks-from-inc…
ShashSriv 11f866e
fix(consumer): Address review findings on the application check
ShashSriv 8ca96db
fix(grpc): Count and log requests for unserved applications
ShashSriv 91b86dd
Updating to KafkaProducer
ShashSriv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,6 +43,25 @@ impl ConsumerService for TaskbrokerServer { | |
| let application = &request.get_ref().application; | ||
| let namespace = &request.get_ref().namespace; | ||
|
|
||
| // Worker pointed at the wrong pool fails | ||
| if let Some(application) = application | ||
| && !self.config.applications.admits(application) | ||
| { | ||
| metrics::counter!( | ||
| "grpc_server.unserved_application", | ||
| "method" => "get_task", | ||
| ) | ||
| .increment(1); | ||
| error!( | ||
| application, | ||
| "Requested application is not served by this pool" | ||
| ); | ||
|
|
||
| return Err(Status::failed_precondition(format!( | ||
|
sentry[bot] marked this conversation as resolved.
Resolved
|
||
| "Broker does not serve application '{application}'" | ||
| ))); | ||
| } | ||
|
|
||
|
cursor[bot] marked this conversation as resolved.
Resolved
|
||
| let inflight = self | ||
| .store | ||
| .claim_activation_for_pull(application.as_deref(), namespace.as_deref()) | ||
|
|
@@ -177,6 +196,24 @@ impl ConsumerService for TaskbrokerServer { | |
| return Ok(Response::new(SetTaskStatusResponse { task: None })); | ||
| }; | ||
|
|
||
| // Same check as get_task. Returning an error here would make the worker | ||
| // re-send the status update, so an unserved application just gets no task. | ||
| if let Some(application) = application | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This check should not fail silently. It should log a metric and/or log an error. |
||
| && !self.config.applications.admits(application) | ||
| { | ||
| metrics::counter!( | ||
| "grpc_server.unserved_application", | ||
| "method" => "fetch_next_task", | ||
| ) | ||
|
ShashSriv marked this conversation as resolved.
Resolved
|
||
| .increment(1); | ||
| error!( | ||
| application, | ||
| "Requested application is not served by this pool" | ||
| ); | ||
|
|
||
| return Ok(Response::new(SetTaskStatusResponse { task: None })); | ||
| } | ||
|
|
||
| let start_time = Instant::now(); | ||
|
|
||
| let res = match self | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.