MCPcopy Create free account
hub / github.com/apache/arrow / Finalize

Method Finalize

cpp/src/arrow/filesystem/s3fs.cc:3507–3529  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3505 bool IsFinalized() { return is_finalized_; }
3506
3507 void Finalize(bool from_destructor = false) {
3508 if (is_finalized_.exchange(true)) {
3509 // Already finalized
3510 return;
3511 }
3512 if (is_initialized_.exchange(false)) {
3513 // Was initialized
3514 if (from_destructor) {
3515 ARROW_LOG(WARNING)
3516 << " arrow::fs::FinalizeS3 was not called even though S3 was initialized. "
3517 "This could lead to a segmentation fault at exit";
3518 // Leak the S3ClientFinalizer to avoid crashes when destroying remaining
3519 // S3Client instances (GH-44071).
3520 auto* leaked_shared_ptr =
3521 new std::shared_ptr<S3ClientFinalizer>(GetClientFinalizer());
3522 ARROW_UNUSED(leaked_shared_ptr);
3523 return;
3524 }
3525 GetClientFinalizer()->Finalize();
3526 EndpointProviderCache::Instance()->Reset();
3527 Aws::ShutdownAPI(aws_options_);
3528 }
3529 }
3530
3531 private:
3532 void DoInitialize(const S3GlobalOptions& options) {

Callers

nothing calls this directly

Calls 3

GetClientFinalizerFunction · 0.85
FinalizeMethod · 0.45
ResetMethod · 0.45

Tested by

no test coverage detected