Skip to content

Commit 2ba7fc4

Browse files
committed
apacheGH-44695: [C++] Add S3 option to ignore SIGPIPE signals
This is mostly convenience for people who don't want to install their own signal handler, though the SDK will also log incoming signals.
1 parent 474c675 commit 2ba7fc4

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

cpp/src/arrow/filesystem/s3fs.cc

+1
Original file line numberDiff line numberDiff line change
@@ -3517,6 +3517,7 @@ struct AwsInstance {
35173517
// This configuration options is only available with AWS SDK 1.9.272 and later.
35183518
aws_options_.httpOptions.compliantRfc3986Encoding = true;
35193519
#endif
3520+
aws_options_.httpOptions.installSigPipeHandler = options.install_sigpipe_handler;
35203521
Aws::InitAPI(aws_options_);
35213522
}
35223523

cpp/src/arrow/filesystem/s3fs.h

+12
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,9 @@ class ARROW_EXPORT S3FileSystem : public FileSystem {
389389
enum class S3LogLevel : int8_t { Off, Fatal, Error, Warn, Info, Debug, Trace };
390390

391391
struct ARROW_EXPORT S3GlobalOptions {
392+
/// The log level for S3-originating messages.
392393
S3LogLevel log_level;
394+
393395
/// The number of threads to configure when creating AWS' I/O event loop
394396
///
395397
/// Defaults to 1 as recommended by AWS' doc when the # of connections is
@@ -398,6 +400,16 @@ struct ARROW_EXPORT S3GlobalOptions {
398400
/// For more details see Aws::Crt::Io::EventLoopGroup
399401
int num_event_loop_threads = 1;
400402

403+
/// Whether to install a process-wide SIGPIPE handler
404+
///
405+
/// The AWS SDK may sometimes emit SIGPIPE signals for certain errors;
406+
/// by default, they would abort the current process.
407+
/// This option, if enabled, will install a process-wide signal handler
408+
/// that logs and otherwise ignore incoming SIGPIPE signals.
409+
///
410+
/// This option has no effect on Windows.
411+
bool install_sigpipe_handler = false;
412+
401413
/// \brief Initialize with default options
402414
///
403415
/// For log_level, this method first tries to extract a suitable value from the

0 commit comments

Comments
 (0)