This is an automated email from the ASF dual-hosted git repository.

dataroaring pushed a commit to branch branch-3.0-preview
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-3.0-preview by this 
push:
     new 68061e33922 Pick "[bug](S3) Do resource reclamation when S3 file 
writer exceptionally quits without calling close #34867" (#34880)
68061e33922 is described below

commit 68061e33922d0cbe67ae405aa517d2fc8b2806ed
Author: AlexYue <[email protected]>
AuthorDate: Wed May 15 10:41:35 2024 +0800

    Pick "[bug](S3) Do resource reclamation when S3 file writer exceptionally 
quits without calling close #34867" (#34880)
---
 be/src/io/fs/s3_file_writer.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/be/src/io/fs/s3_file_writer.cpp b/be/src/io/fs/s3_file_writer.cpp
index 852b5258e85..993db2c37bc 100644
--- a/be/src/io/fs/s3_file_writer.cpp
+++ b/be/src/io/fs/s3_file_writer.cpp
@@ -108,6 +108,11 @@ S3FileWriter::~S3FileWriter() {
         // For thread safety
         std::ignore = _async_close_pack->future.get();
         _async_close_pack = nullptr;
+    } else {
+        // Consider one situation where the file writer is destructed after it 
submit at least one async task
+        // without calling close(), then there exists one occasion where the 
async task is executed right after
+        // the correspoding S3 file writer is already destructed
+        _wait_until_finish(fmt::format("wait s3 file {} upload to be 
finished", _path.native()));
     }
     // We won't do S3 abort operation in BE, we let s3 service do it own.
     if (closed() == FileWriterState::OPEN && !_failed) {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to