You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "BiteTheDDDDt (via GitHub)" <gi...@apache.org> on 2026/04/24 09:07:45 UTC
[PR] [fix](pipeline) guard CountedFinishDependency::sub() against counter underflow [doris]
BiteTheDDDDt opened a new pull request, #62815:
URL: https://github.com/apache/doris/pull/62815
Related PR: N/A
Problem Summary:
`CountedFinishDependency::sub()` decrements an unsigned `uint32_t _counter`
without checking that the counter is greater than zero. The contract is that
each `sub()` is balanced by a prior `add()`, but if the protocol is ever
violated (e.g. a duplicated `sync_filter_size` RPC from FE, double callback
on the BE side, or any future bug) the `0--` silently underflows to
`UINT32_MAX`. The condition `if (!_counter) set_ready();` is then never true
and the dependency stays blocked forever, hanging the entire query with no
log line and no crash, making the bug very hard to diagnose.
This is especially relevant because there are multiple callers of `sub()`:
- `SyncSizeCallback::call()` on RPC failure
- `SyncSizeCallback::call()` on RPC success but error response status
- `RuntimeFilterProducer::set_synced_size()` triggered by FE
Any imbalance between these and the single `add()` in
`RuntimeFilterProducer::set_dependency()` would produce the silent hang.
Add an explicit check at the top of `sub()` that throws an
`Exception(ErrorCode::INTERNAL_ERROR, ...)` carrying `debug_string()` when
`_counter == 0`. This matches the project convention of asserting
correctness and failing fast rather than letting the process limp along in
a corrupt state.
### Release note
Fix a potential silent query hang caused by an unbalanced
`CountedFinishDependency::sub()` call underflowing the counter. Such cases
now throw an explicit `INTERNAL_ERROR` instead.
### Check List (For Author)
- Test:
- [x] Unit Test: added `CountedFinishDependencyTest` in
`be/test/exec/runtime_filter/sync_size_callback_test.cpp` covering
sub() on a fresh counter, sub() after balanced add/sub, and the happy
path of multiple add() / sub() reaching ready. All pass.
- [x] Existing `SyncSizeCallbackTest.*` re-run, no regression.
- Behavior changed: No (the only observable change is converting an existing
silent failure into a loud error when the contract is violated)
- Does this need documentation: No
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [fix](pipeline) guard CountedFinishDependency::sub() against counter underflow [doris]
Posted by "BiteTheDDDDt (via GitHub)" <gi...@apache.org>.
BiteTheDDDDt commented on PR #62815:
URL: https://github.com/apache/doris/pull/62815#issuecomment-4322045048
run buildall
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [fix](pipeline) guard CountedFinishDependency::sub() against counter underflow [doris]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #62815:
URL: https://github.com/apache/doris/pull/62815#issuecomment-4323715485
PR approved by at least one committer and no changes requested.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [fix](pipeline) guard CountedFinishDependency::sub() against counter underflow [doris]
Posted by "BiteTheDDDDt (via GitHub)" <gi...@apache.org>.
BiteTheDDDDt merged PR #62815:
URL: https://github.com/apache/doris/pull/62815
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [fix](pipeline) guard CountedFinishDependency::sub() against counter underflow [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #62815:
URL: https://github.com/apache/doris/pull/62815#issuecomment-4323974937
# BE Regression && UT Coverage Report
Increment line coverage `100.00% (4/4)` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/62815_6fd59de16c356bccea3480b3417ed23929ec025e_merge/increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/62815_6fd59de16c356bccea3480b3417ed23929ec025e_merge/report/index.html)
| Category | Coverage |
|-------------------|--------------------|
| Function Coverage | 73.89% (27695/37483) |
| Line Coverage | 57.62% (299621/519968) |
| Region Coverage | 54.85% (249466/454785) |
| Branch Coverage | 56.40% (107942/191380) |
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [fix](pipeline) guard CountedFinishDependency::sub() against counter underflow [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #62815:
URL: https://github.com/apache/doris/pull/62815#issuecomment-4322233230
# BE UT Coverage Report
Increment line coverage `100.00% (4/4)` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/6fd59de16c356bccea3480b3417ed23929ec025e_6fd59de16c356bccea3480b3417ed23929ec025e/increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/6fd59de16c356bccea3480b3417ed23929ec025e_6fd59de16c356bccea3480b3417ed23929ec025e/report/index.html)
| Category | Coverage |
|-------------------|--------------------|
| Function Coverage | 53.34% (20406/38258) |
| Line Coverage | 36.89% (192281/521263) |
| Region Coverage | 33.20% (149551/450459) |
| Branch Coverage | 34.32% (65430/190650) |
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [fix](pipeline) guard CountedFinishDependency::sub() against counter underflow [doris]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #62815:
URL: https://github.com/apache/doris/pull/62815#issuecomment-4323715589
PR approved by anyone and no changes requested.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [fix](pipeline) guard CountedFinishDependency::sub() against counter underflow [doris]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #62815:
URL: https://github.com/apache/doris/pull/62815#discussion_r3136657143
##########
be/src/exec/pipeline/dependency.h:
##########
@@ -194,6 +194,13 @@ class CountedFinishDependency final : public Dependency {
void sub() {
std::unique_lock<std::mutex> l(_mtx);
+ // _counter is unsigned: a stray sub() when counter is already 0 would
+ // underflow to UINT32_MAX and the dependency would never become ready,
+ // hanging the query forever. Fail loudly instead.
+ if (_counter == 0) [[unlikely]] {
+ throw Exception(ErrorCode::INTERNAL_ERROR,
+ "CountedFinishDependency::sub() underflow on {}", debug_string());
+ }
Review Comment:
`CountedFinishDependency::sub()` now throws `doris::Exception` / uses `ErrorCode::INTERNAL_ERROR` in an inline method, but `dependency.h` doesn’t include the header that defines them. Please add the appropriate include (e.g. `common/exception.h`) here so this header compiles standalone and doesn’t rely on transitive includes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [fix](pipeline) guard CountedFinishDependency::sub() against counter underflow [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #62815:
URL: https://github.com/apache/doris/pull/62815#issuecomment-4311965076
Thank you for your contribution to Apache Doris.
Don't know what should be done next? See [How to process your PR](https://cwiki.apache.org/confluence/display/DORIS/How+to+process+your+PR).
Please clearly describe your PR:
1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
3. What features were added. Why was this function added?
4. Which code was refactored and why was this part of the code refactored?
5. Which functions were optimized and what is the difference before and after the optimization?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [fix](pipeline) guard CountedFinishDependency::sub() against counter underflow [doris]
Posted by "BiteTheDDDDt (via GitHub)" <gi...@apache.org>.
BiteTheDDDDt commented on PR #62815:
URL: https://github.com/apache/doris/pull/62815#issuecomment-4322044934
/review
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [fix](pipeline) guard CountedFinishDependency::sub() against counter underflow [doris]
Posted by "BiteTheDDDDt (via GitHub)" <gi...@apache.org>.
BiteTheDDDDt commented on PR #62815:
URL: https://github.com/apache/doris/pull/62815#issuecomment-4312037791
/review
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [fix](pipeline) guard CountedFinishDependency::sub() against counter underflow [doris]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #62815:
URL: https://github.com/apache/doris/pull/62815#issuecomment-4322260390
OpenCode automated review failed and did not complete.
Error: Review step was failure (possibly timeout or cancelled)
Workflow run: https://github.com/apache/doris/actions/runs/24956846557
Please inspect the workflow logs and rerun the review after the underlying issue is resolved.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [fix](pipeline) guard CountedFinishDependency::sub() against counter underflow [doris]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #62815:
URL: https://github.com/apache/doris/pull/62815#issuecomment-4312736112
OpenCode automated review failed and did not complete.
Error: Review step was failure (possibly timeout or cancelled)
Workflow run: https://github.com/apache/doris/actions/runs/24882151710
Please inspect the workflow logs and rerun the review after the underlying issue is resolved.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [fix](pipeline) guard CountedFinishDependency::sub() against counter underflow [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #62815:
URL: https://github.com/apache/doris/pull/62815#issuecomment-4322387252
# BE Regression && UT Coverage Report
Increment line coverage `100.00% (4/4)` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/62815_6fd59de16c356bccea3480b3417ed23929ec025e_merge/increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/62815_6fd59de16c356bccea3480b3417ed23929ec025e_merge/report/index.html)
| Category | Coverage |
|-------------------|--------------------|
| Function Coverage | 73.89% (27696/37483) |
| Line Coverage | 57.62% (299629/519968) |
| Region Coverage | 54.85% (249459/454785) |
| Branch Coverage | 56.40% (107929/191380) |
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org