BiteTheDDDDt opened a new pull request, #62691: URL: https://github.com/apache/doris/pull/62691
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. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
