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

morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new e4a0f76db42 [fix](outfile)Fixed orcOutputStream.close() throwing an 
exception during destruction causing the program to hang. (#34243)
e4a0f76db42 is described below

commit e4a0f76db42cd9647886eae9f7684f6e44c5ee45
Author: daidai <[email protected]>
AuthorDate: Sun Apr 28 19:54:07 2024 +0800

    [fix](outfile)Fixed orcOutputStream.close() throwing an exception during 
destruction causing the program to hang. (#34243)
    
    sql:
    ```
    select * from outfile_exception_test t ORDER BY user_id
    into outfile "s3://test-outfile-exception-no-exists/test_outfile/exp_"
    format as orc
    properties(
        "s3.endpoint" = "xxxxxxxx",
        "s3.region" = "xxxx",
        "s3.access_key"= "xx",
        "s3.secret_key" = "xxx"
    );
    ```
    
    When the sql is executed normally, the close() function of 
`VOrcOutputStream` will be called first, and then the destructor will be 
called. If there is a problem with SQL, the close function will throw an 
exception to return the error to the user. If the task is canceled, the 
destructor will be called directly, and then the close() function will be 
executed, causing the system to hang.
---
 be/src/vec/runtime/vorc_transformer.cpp | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/be/src/vec/runtime/vorc_transformer.cpp 
b/be/src/vec/runtime/vorc_transformer.cpp
index a07f734acac..3bf3d8cea70 100644
--- a/be/src/vec/runtime/vorc_transformer.cpp
+++ b/be/src/vec/runtime/vorc_transformer.cpp
@@ -62,7 +62,16 @@ VOrcOutputStream::VOrcOutputStream(doris::io::FileWriter* 
file_writer)
 
 VOrcOutputStream::~VOrcOutputStream() {
     if (!_is_closed) {
-        close();
+        try {
+            close();
+        } catch (...) {
+            /*
+         * Under normal circumstances, close() will be called first, and then 
the destructor will be called.
+         * If the task is canceled, close() will not be executed, but the 
destructor will be called directly,
+         * which will cause the be core.When the task is canceled, since the 
log file has been written during
+         * close(), no operation is performed here.
+         */
+        }
     }
 }
 


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

Reply via email to