Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions r/src/filesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,17 @@ std::shared_ptr<fs::S3FileSystem> fs___S3FileSystem__create(
bool check_directory_existence_before_creation = false, double connect_timeout = -1,
double request_timeout = -1) {
// We need to ensure that S3 is initialized before we start messing with the
// options
StopIfNotOk(fs::EnsureS3Initialized());
// options. We use InitializeS3() rather than EnsureS3Initialized() so we can
// enable the SIGPIPE handler - without it, stale connections in the SDK's
// connection pool can trigger SIGPIPE during Aws::ShutdownAPI(), which causes
// R's signal handler to longjmp out of the teardown and segfault (GH-50009).
fs::S3GlobalOptions options = fs::S3GlobalOptions::Defaults();
options.install_sigpipe_handler = true;
auto status = fs::InitializeS3(options);
// InitializeS3 returns Invalid if already initialized - that's fine
if (!status.ok() && !fs::IsS3Initialized()) {
StopIfNotOk(status);
}
Comment on lines 294 to +305
fs::S3Options s3_opts;
// Handle auth (anonymous, keys, default)
// (validation/internal coherence handled in R)
Expand Down
Loading