This is an automated email from the ASF dual-hosted git repository.
isapego pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git
The following commit(s) were added to refs/heads/main by this push:
new ca1454974f6 IGNITE-27914 C++: Ignore SIGPIPE and use MSG_NOSIGNAL
(#7632)
ca1454974f6 is described below
commit ca1454974f659b0b2a900f451a4394734d860341
Author: Dmitriy Zabotlin <[email protected]>
AuthorDate: Thu Feb 19 19:14:43 2026 +0200
IGNITE-27914 C++: Ignore SIGPIPE and use MSG_NOSIGNAL (#7632)
Co-authored-by: dzabotlin <[email protected]>
---
.../cpp/ignite/network/detail/linux/linux_async_client.cpp | 2 +-
modules/platforms/cpp/ignite/network/detail/linux/sockets.cpp | 7 +++++++
modules/platforms/cpp/tests/client-test/main.cpp | 4 ++++
modules/platforms/cpp/tests/compatibility-tests/main.cpp | 4 ++++
modules/platforms/cpp/tests/fake_server/main.cpp | 4 ++++
modules/platforms/cpp/tests/odbc-test/main.cpp | 4 ++++
6 files changed, 24 insertions(+), 1 deletion(-)
diff --git
a/modules/platforms/cpp/ignite/network/detail/linux/linux_async_client.cpp
b/modules/platforms/cpp/ignite/network/detail/linux/linux_async_client.cpp
index f9ac4ae1287..9faa3284852 100644
--- a/modules/platforms/cpp/ignite/network/detail/linux/linux_async_client.cpp
+++ b/modules/platforms/cpp/ignite/network/detail/linux/linux_async_client.cpp
@@ -89,7 +89,7 @@ bool linux_async_client::send_next_packet_locked() {
auto &packet = m_send_packets.front();
auto dataView = packet.get_bytes_view();
- ssize_t ret = ::send(m_fd, dataView.data(), dataView.size(), 0);
+ ssize_t ret = ::send(m_fd, dataView.data(), dataView.size(), MSG_NOSIGNAL);
if (ret < 0)
return false;
diff --git a/modules/platforms/cpp/ignite/network/detail/linux/sockets.cpp
b/modules/platforms/cpp/ignite/network/detail/linux/sockets.cpp
index a13be584012..54881efefe2 100644
--- a/modules/platforms/cpp/ignite/network/detail/linux/sockets.cpp
+++ b/modules/platforms/cpp/ignite/network/detail/linux/sockets.cpp
@@ -87,6 +87,13 @@ void try_set_socket_options(int socket_fd, int buf_size,
bool no_delay, bool out
setsockopt(socket_fd, SOL_SOCKET, SO_SNDBUF, reinterpret_cast<char
*>(&buf_size), sizeof(buf_size));
setsockopt(socket_fd, SOL_SOCKET, SO_RCVBUF, reinterpret_cast<char
*>(&buf_size), sizeof(buf_size));
+ // Set an option to not raise SIGPIPE. This should be done before we may
return from this function if we cannot
+ // configure keepalive options
+#ifdef __APPLE__
+ int no_sigpipe_opt = 1;
+ setsockopt(socket_fd, SOL_SOCKET, SO_NOSIGPIPE, reinterpret_cast<char
*>(&no_sigpipe_opt), sizeof(no_sigpipe_opt));
+#endif
+
int iNoDelay = no_delay ? 1 : 0;
setsockopt(socket_fd, IPPROTO_TCP, TCP_NODELAY, reinterpret_cast<char
*>(&iNoDelay), sizeof(iNoDelay));
diff --git a/modules/platforms/cpp/tests/client-test/main.cpp
b/modules/platforms/cpp/tests/client-test/main.cpp
index bc34324a8f5..9139c2e6119 100644
--- a/modules/platforms/cpp/tests/client-test/main.cpp
+++ b/modules/platforms/cpp/tests/client-test/main.cpp
@@ -55,6 +55,10 @@ void set_process_abort_handler(std::function<void(int)>
handler) {
signal(SIGABRT, signal_handler);
signal(SIGINT, signal_handler);
signal(SIGSEGV, signal_handler);
+
+#ifndef _WIN32
+ signal(SIGPIPE, signal_handler);
+#endif
}
int main(int argc, char **argv) {
diff --git a/modules/platforms/cpp/tests/compatibility-tests/main.cpp
b/modules/platforms/cpp/tests/compatibility-tests/main.cpp
index 7de5754b5c6..65bb61befed 100644
--- a/modules/platforms/cpp/tests/compatibility-tests/main.cpp
+++ b/modules/platforms/cpp/tests/compatibility-tests/main.cpp
@@ -54,6 +54,10 @@ void set_process_abort_handler(std::function<void(int)>
handler) {
signal(SIGABRT, signal_handler);
signal(SIGINT, signal_handler);
signal(SIGSEGV, signal_handler);
+
+#ifndef _WIN32
+ signal(SIGPIPE, signal_handler);
+#endif
}
using namespace ignite;
diff --git a/modules/platforms/cpp/tests/fake_server/main.cpp
b/modules/platforms/cpp/tests/fake_server/main.cpp
index 4e4d531e3f7..5c5475c5a5a 100644
--- a/modules/platforms/cpp/tests/fake_server/main.cpp
+++ b/modules/platforms/cpp/tests/fake_server/main.cpp
@@ -59,6 +59,10 @@ void set_process_abort_handler(std::function<void(int)>
handler) {
signal(SIGABRT, signal_handler);
signal(SIGINT, signal_handler);
signal(SIGSEGV, signal_handler);
+
+#ifndef _WIN32
+ signal(SIGPIPE, signal_handler);
+#endif
}
int main(int argc, char **argv) {
diff --git a/modules/platforms/cpp/tests/odbc-test/main.cpp
b/modules/platforms/cpp/tests/odbc-test/main.cpp
index bc34324a8f5..9139c2e6119 100644
--- a/modules/platforms/cpp/tests/odbc-test/main.cpp
+++ b/modules/platforms/cpp/tests/odbc-test/main.cpp
@@ -55,6 +55,10 @@ void set_process_abort_handler(std::function<void(int)>
handler) {
signal(SIGABRT, signal_handler);
signal(SIGINT, signal_handler);
signal(SIGSEGV, signal_handler);
+
+#ifndef _WIN32
+ signal(SIGPIPE, signal_handler);
+#endif
}
int main(int argc, char **argv) {