github-actions[bot] commented on code in PR #63106:
URL: https://github.com/apache/doris/pull/63106#discussion_r3212927667


##########
be/src/exec/pipeline/pipeline_task.cpp:
##########
@@ -979,32 +991,32 @@ std::string PipelineTask::debug_string() {
     fmt::format_to(debug_string_buffer, "\nRead Dependency Information: \n");
 
     size_t i = 0;
-    for (; i < _read_dependencies.size(); i++) {
-        for (size_t j = 0; j < _read_dependencies[i].size(); j++) {
+    for (; i < read_dependencies.size(); i++) {
+        for (size_t j = 0; j < read_dependencies[i].size(); j++) {
             fmt::format_to(debug_string_buffer, "{}. {}\n", i,
-                           
_read_dependencies[i][j]->debug_string(cast_set<int>(i) + 1));
+                           
read_dependencies[i][j]->debug_string(cast_set<int>(i) + 1));
         }

Review Comment:
   This now dereferences raw `Dependency*` values after 
`_dependency_lifecycle_lock` has been released. The lock comment says it 
protects the dependency containers and the raw pointers they contain, and 
`finalize()` takes the same lock before clearing `_sink_shared_state`, 
`_op_shared_states`, and `_shared_state_map`, which own these dependencies. A 
concrete race is: `debug_string()` copies `read_dependencies` and releases the 
lock, observes the task as not finalized, then another thread runs `finalize()` 
and clears the shared states; the subsequent 
`read_dependencies[i][j]->debug_string()` can use a freed `Dependency`. Please 
keep the lifetime protection until all raw dependency pointers are no longer 
dereferenced, or snapshot owning `shared_ptr` state under the lock instead of 
raw pointers.



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