This is an automated email from the ASF dual-hosted git repository.
apitrou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/main by this push:
new ea74dd941e GH-44695: [C++] Add S3 option to ignore SIGPIPE signals
(#44735)
ea74dd941e is described below
commit ea74dd941e424f5e0835c58987a6a19539b3ff50
Author: Antoine Pitrou <[email protected]>
AuthorDate: Thu Nov 21 09:27:24 2024 +0100
GH-44695: [C++] Add S3 option to ignore SIGPIPE signals (#44735)
### Rationale for this change
Described in the added option docstring.
This is mostly convenience for people who don't want to install their own
signal handler, though the SDK will also log incoming signals.
### Are these changes tested?
No, they are not reasonably testable.
### Are there any user-facing changes?
No.
* GitHub Issue: #44695
Authored-by: Antoine Pitrou <[email protected]>
Signed-off-by: Antoine Pitrou <[email protected]>
---
cpp/src/arrow/filesystem/s3fs.cc | 1 +
cpp/src/arrow/filesystem/s3fs.h | 12 ++++++++++++
2 files changed, 13 insertions(+)
diff --git a/cpp/src/arrow/filesystem/s3fs.cc b/cpp/src/arrow/filesystem/s3fs.cc
index ee47e1c702..b6a928ecdd 100644
--- a/cpp/src/arrow/filesystem/s3fs.cc
+++ b/cpp/src/arrow/filesystem/s3fs.cc
@@ -3517,6 +3517,7 @@ struct AwsInstance {
// This configuration options is only available with AWS SDK 1.9.272 and
later.
aws_options_.httpOptions.compliantRfc3986Encoding = true;
#endif
+ aws_options_.httpOptions.installSigPipeHandler =
options.install_sigpipe_handler;
Aws::InitAPI(aws_options_);
}
diff --git a/cpp/src/arrow/filesystem/s3fs.h b/cpp/src/arrow/filesystem/s3fs.h
index ac6342f26a..f8dacd520f 100644
--- a/cpp/src/arrow/filesystem/s3fs.h
+++ b/cpp/src/arrow/filesystem/s3fs.h
@@ -389,7 +389,9 @@ class ARROW_EXPORT S3FileSystem : public FileSystem {
enum class S3LogLevel : int8_t { Off, Fatal, Error, Warn, Info, Debug, Trace };
struct ARROW_EXPORT S3GlobalOptions {
+ /// The log level for S3-originating messages.
S3LogLevel log_level;
+
/// The number of threads to configure when creating AWS' I/O event loop
///
/// Defaults to 1 as recommended by AWS' doc when the # of connections is
@@ -398,6 +400,16 @@ struct ARROW_EXPORT S3GlobalOptions {
/// For more details see Aws::Crt::Io::EventLoopGroup
int num_event_loop_threads = 1;
+ /// Whether to install a process-wide SIGPIPE handler
+ ///
+ /// The AWS SDK may sometimes emit SIGPIPE signals for certain errors;
+ /// by default, they would abort the current process.
+ /// This option, if enabled, will install a process-wide signal handler
+ /// that logs and otherwise ignore incoming SIGPIPE signals.
+ ///
+ /// This option has no effect on Windows.
+ bool install_sigpipe_handler = false;
+
/// \brief Initialize with default options
///
/// For log_level, this method first tries to extract a suitable value from
the