You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "westonpace (via GitHub)" <gi...@apache.org> on 2023/06/13 16:35:26 UTC

[GitHub] [arrow] westonpace commented on issue #35876: [C++] Problem when used from "qlora", huggingface. Does not clean up, and dumps core.

westonpace commented on issue #35876:
URL: https://github.com/apache/arrow/issues/35876#issuecomment-1589658833

   > I looked at the arrow code, and it is not clear to me where this should happen.
   
   As I said, you must call it once before your application exits.
   
   > Putting the call before the connection is severed did not fix the problem.
   
   I'm sorry.  I don't understand what this means.
   
   For example, this is valid:
   
   ```
   int main() {
     if (!arrow::fs::EnsureS3Initialized().ok()) {
       std::cerr << "Failed to initialize S3" << std::endl;
       return 1;
     }
     // Your program goes here...
     if (!arrow::fs::EnsureS3Finalized().ok()) {
       std::cerr << "Failed to finalize S3" << std::endl;
       return 1;
     }
     return 0;
   }
   ```
   
   This is not valid:
   
   ```
   struct GlobalS3Filesystem {
     GlobalS3Filesystem() {
       if (!arrow::fs::EnsureS3Initialized().ok()) {
         // handle error
         return;
       }
       arrow::Result<std::shared_ptr<arrow::fs::S3FileSystem>> maybe_s3fs =
           arrow::fs::S3FileSystem::Make({});
       if (!maybe_s3fs.ok()) {
         // handle error
         return;
       }
       s3fs = maybe_s3fs.MoveValueUnsafe();
     }
     ~GlobalS3Filesystem() {
       if (!arrow::fs::EnsureS3Finalized().ok()) {
         // handle error
       }
     }
     std::shared_ptr<arrow::fs::FileSystem> s3fs;
   };
   
   std::shared_ptr<arrow::fs::FileSystem> GetGlobalS3Filesystem() {
     static GlobalS3Filesystem global_s3fs;
     return global_s3fs.s3fs;
   }
   ```


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org