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

Method Finalize

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

Source from the content-addressed store, hash-verified

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