Skip to content

Commit

Permalink
[Backport release-2.18] Add setting to disable install_sigpipe_handle…
Browse files Browse the repository at this point in the history
…r on S3. (#4574)

Backport b4f920d from #4573.

Co-authored-by: KiterLuc <[email protected]>
  • Loading branch information
github-actions[bot] and KiterLuc authored Dec 13, 2023
1 parent 9ae6e1a commit 8143a7d
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 2 deletions.
4 changes: 4 additions & 0 deletions test/src/unit-capi-config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ void check_save_to_file() {
ss << "vfs.s3.connect_max_tries 5\n";
ss << "vfs.s3.connect_scale_factor 25\n";
ss << "vfs.s3.connect_timeout_ms 10800\n";
ss << "vfs.s3.install_sigpipe_handler true\n";
ss << "vfs.s3.logging_level Off\n";
ss << "vfs.s3.max_parallel_ops " << std::thread::hardware_concurrency()
<< "\n";
Expand Down Expand Up @@ -739,6 +740,7 @@ TEST_CASE("C API: Test config iter", "[capi][config]") {
all_param_values["vfs.s3.proxy_username"] = "";
all_param_values["vfs.s3.verify_ssl"] = "true";
all_param_values["vfs.s3.no_sign_request"] = "false";
all_param_values["vfs.s3.install_sigpipe_handler"] = "true";
all_param_values["vfs.hdfs.username"] = "stavros";
all_param_values["vfs.hdfs.kerb_ticket_cache_path"] = "";
all_param_values["vfs.hdfs.name_node_uri"] = "";
Expand Down Expand Up @@ -811,6 +813,7 @@ TEST_CASE("C API: Test config iter", "[capi][config]") {
vfs_param_values["s3.bucket_canned_acl"] = "NOT_SET";
vfs_param_values["s3.object_canned_acl"] = "NOT_SET";
vfs_param_values["s3.config_source"] = "auto";
vfs_param_values["s3.install_sigpipe_handler"] = "true";
vfs_param_values["hdfs.username"] = "stavros";
vfs_param_values["hdfs.kerb_ticket_cache_path"] = "";
vfs_param_values["hdfs.name_node_uri"] = "";
Expand Down Expand Up @@ -875,6 +878,7 @@ TEST_CASE("C API: Test config iter", "[capi][config]") {
s3_param_values["bucket_canned_acl"] = "NOT_SET";
s3_param_values["object_canned_acl"] = "NOT_SET";
s3_param_values["config_source"] = "auto";
s3_param_values["install_sigpipe_handler"] = "true";

// Create an iterator and iterate over all parameters
tiledb_config_iter_t* config_iter = nullptr;
Expand Down
2 changes: 1 addition & 1 deletion test/src/unit-cppapi-config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ TEST_CASE("C++ API: Config iterator", "[cppapi][config]") {
names.push_back(it->first);
}
// Check number of VFS params in default config object.
CHECK(names.size() == 64);
CHECK(names.size() == 65);
}

TEST_CASE("C++ API: Config Environment Variables", "[cppapi][config]") {
Expand Down
4 changes: 4 additions & 0 deletions tiledb/api/c_api/config/config_api_external.h
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,10 @@ TILEDB_EXPORT void tiledb_config_free(tiledb_config_t** config) TILEDB_NOEXCEPT;
* from config files with support for web tokens, commonly used by EKS/ECS).
* **Default**: auto
* <br>
* - `vfs.s3.install_sigpipe_handler` <br>
* When set to `true`, the S3 SDK uses a handler that ignores SIGPIPE
* signals.
* **Default**: "true"
* - `vfs.hdfs.name_node_uri"` <br>
* Name node for HDFS. <br>
* **Default**: ""
Expand Down
4 changes: 4 additions & 0 deletions tiledb/sm/config/config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ const std::string Config::VFS_S3_NO_SIGN_REQUEST = "false";
const std::string Config::VFS_S3_BUCKET_CANNED_ACL = "NOT_SET";
const std::string Config::VFS_S3_OBJECT_CANNED_ACL = "NOT_SET";
const std::string Config::VFS_S3_CONFIG_SOURCE = "auto";
const std::string Config::VFS_S3_INSTALL_SIGPIPE_HANDLER = "true";
const std::string Config::VFS_HDFS_KERB_TICKET_CACHE_PATH = "";
const std::string Config::VFS_HDFS_NAME_NODE_URI = "";
const std::string Config::VFS_HDFS_USERNAME = "";
Expand Down Expand Up @@ -474,6 +475,9 @@ const std::map<std::string, std::string> default_config_values = {
std::make_pair(
"vfs.s3.object_canned_acl", Config::VFS_S3_OBJECT_CANNED_ACL),
std::make_pair("vfs.s3.config_source", Config::VFS_S3_CONFIG_SOURCE),
std::make_pair(
"vfs.s3.install_sigpipe_handler",
Config::VFS_S3_INSTALL_SIGPIPE_HANDLER),
std::make_pair("vfs.hdfs.name_node_uri", Config::VFS_HDFS_NAME_NODE_URI),
std::make_pair("vfs.hdfs.username", Config::VFS_HDFS_USERNAME),
std::make_pair(
Expand Down
6 changes: 6 additions & 0 deletions tiledb/sm/config/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,12 @@ class Config {
/** Force making an unsigned request to s3 (false). */
static const std::string VFS_S3_NO_SIGN_REQUEST;

/**
* When set to `true`, the S3 SDK uses a handler that ignores SIGPIPE
* signals.
*/
static const std::string VFS_S3_INSTALL_SIGPIPE_HANDLER;

/** HDFS default kerb ticket cache path. */
static const std::string VFS_HDFS_KERB_TICKET_CACHE_PATH;

Expand Down
4 changes: 4 additions & 0 deletions tiledb/sm/cpp_api/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,10 @@ class Config {
* from config files with support for web tokens, commonly used by EKS/ECS).
* **Default**: auto
* <br>
* - `vfs.s3.install_sigpipe_handler` <br>
* When set to `true`, the S3 SDK uses a handler that ignores SIGPIPE
* signals.
* **Default**: "true"
* - `vfs.hdfs.name_node_uri"` <br>
* Name node for HDFS. <br>
* **Default**: ""
Expand Down
3 changes: 2 additions & 1 deletion tiledb/sm/filesystem/s3.cc
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,8 @@ S3::S3(
// the AWS SDK to set its own signal handler to ignore SIGPIPE signals. A
// SIGPIPE may be raised from the socket library when the peer disconnects
// unexpectedly.
options_.httpOptions.installSigPipeHandler = true;
options_.httpOptions.installSigPipeHandler =
config.get<bool>("vfs.s3.install_sigpipe_handler", Config::must_find);

// Initialize the library once per process.
if (!s3_params_.skip_init_)
Expand Down

0 comments on commit 8143a7d

Please sign in to comment.