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


##########
be/src/io/fs/s3_file_writer.cpp:
##########
@@ -275,9 +311,9 @@ Status S3FileWriter::_close_impl() {
     }
 
     if (_pending_buf != nullptr) { // there is remaining data in buffer need 
to be uploaded
-        _countdown_event.add_count();
-        RETURN_IF_ERROR(FileBuffer::submit(std::move(_pending_buf)));
+        auto st = _submit_upload_buffer(_pending_buf);

Review Comment:
   Blocking: this error return lets async close complete before previously 
submitted upload buffers have drained. A multipart writer can submit one or 
more full buffers from `appendv()`, and those `UploadFileBuffer` callbacks 
capture this writer. If the async close worker then fails to submit the final 
`_pending_buf`, `_close_impl()` clears `_pending_buf` and returns here without 
reaching `_complete()` and its `_wait_until_finish()` call. The close lambda 
immediately fulfills `_async_close_pack->promise`, and the destructor path for 
an outstanding async close waits only on that future. Destroying the writer 
after this future is ready can therefore leave earlier upload tasks running 
with callbacks that still dereference the freed `S3FileWriter`. Please make 
this error path drain `_countdown_event` before completing the async close, or 
otherwise preserve the writer until all earlier upload tasks have finished.



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