BiteTheDDDDt commented on code in PR #62691:
URL: https://github.com/apache/doris/pull/62691#discussion_r3123622279


##########
be/src/runtime/thread_context.cpp:
##########
@@ -25,6 +25,35 @@ namespace doris {
 class MemTracker;
 
 void AttachTask::init(const std::shared_ptr<ResourceContext>& rc) {
+    // Validate the ResourceContext chain before mutating any thread-local
+    // or signal state. If any link is null we throw immediately, so the
+    // caller's stack-unwind sees a clean state (no thread-local handle is
+    // acquired and no signal task id is set). Without these the previous
+    // code would silently propagate a null mem_tracker into
+    // ThreadMemTrackerMgr and crash much later inside the allocator.
+    if (UNLIKELY(rc == nullptr)) {

Review Comment:
   不是问题,本来npe也会挂,现在这样报错信息更明确



-- 
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]

Reply via email to