branch-4.1: [Chore](check) add some Sanity-check for avoid npe #62691#62807
Open
github-actions[bot] wants to merge 1 commit intobranch-4.1from
Open
branch-4.1: [Chore](check) add some Sanity-check for avoid npe #62691#62807github-actions[bot] wants to merge 1 commit intobranch-4.1from
github-actions[bot] wants to merge 1 commit intobranch-4.1from
Conversation
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
|
run buildall |
Contributor
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
7061fea to
f8bedfc
Compare
Contributor
|
run buildall |
This pull request adds comprehensive null pointer checks and improved error reporting to critical memory management and pipeline execution paths. The main goal is to catch and clearly report misuses or unexpected nulls in resource and memory tracker objects, especially in RELEASE builds where previous checks (like DCHECK) were no-ops. This should make debugging memory management and pipeline execution issues much easier by providing explicit error messages and context, rather than opaque crashes or silent failures. The most important changes are: **Memory Tracker Safety and Error Reporting:** * Added explicit null checks and detailed exception throwing in `ThreadMemTrackerMgr` methods, including `attach_limiter_tracker`, `detach_limiter_tracker`, and `limiter_mem_tracker`, to prevent propagation of null memory tracker pointers and provide clear diagnostics when misuse occurs. [[1]](diffhunk://#diff-d22d036bc75761be008a06388ac64878a0150314aad313ba63cb1e70d6b98f67R22-R39) [[2]](diffhunk://#diff-d22d036bc75761be008a06388ac64878a0150314aad313ba63cb1e70d6b98f67R68-R86) [[3]](diffhunk://#diff-65c8664db7728c5cc60ea7ae8434dc47014b2531e03072333a5989554b747029R105-R113) * Improved header includes to ensure `common/exception.h` is available where exceptions are thrown. **Resource Context Initialization and Validation:** * Added step-by-step null checks in `AttachTask` and `SwitchResourceContext` constructors to pinpoint exactly which part of the resource context chain is null, throwing a `FatalError` with clear context if any are missing. [[1]](diffhunk://#diff-2b2f9638f5ba33910b1e2325b34ad4f99d4b9da393a9458858471cd84bf4e9e6R47-R61) [[2]](diffhunk://#diff-2b2f9638f5ba33910b1e2325b34ad4f99d4b9da393a9458858471cd84bf4e9e6R82-R96) * Enhanced `ThreadContext::attach_task` to check for null `ResourceContext`, `MemoryContext`, and `mem_tracker` before attaching, with detailed error messages to aid debugging of half-initialized or misused contexts. **Pipeline Execution Robustness:** * Added sanity checks for null pointers in the `PipelineTask::execute` method before dereferencing critical objects, throwing an exception with query ID and pointer values for easier triage if any are unexpectedly null. [[1]](diffhunk://#diff-b1379f2a0e6db93d3aaeec091b10d8a13e9461322f30af2c3f4a54df5bee702fR511-R520) [[2]](diffhunk://#diff-b1379f2a0e6db93d3aaeec091b10d8a13e9461322f30af2c3f4a54df5bee702fR31) These changes collectively increase the safety and debuggability of memory and resource management in the codebase, reducing the risk of silent failures and making it easier to identify the root cause of any issues.
Contributor
|
run buildall |
f8bedfc to
dbad61b
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Cherry-picked from #62691