未验证 提交 f11b3174 编写于 作者: C congqixia 提交者: GitHub

Refine sigpipe handling (#24862)

Signed-off-by: NCongqi Xia <congqi.xia@zilliz.com>
上级 9f3e4214
...@@ -5,6 +5,8 @@ import ( ...@@ -5,6 +5,8 @@ import (
"fmt" "fmt"
"io" "io"
"os" "os"
"os/signal"
"syscall"
"go.uber.org/zap" "go.uber.org/zap"
...@@ -50,6 +52,9 @@ func (c *run) execute(args []string, flags *flag.FlagSet) { ...@@ -50,6 +52,9 @@ func (c *run) execute(args []string, flags *flag.FlagSet) {
c.serverType = args[2] c.serverType = args[2]
c.formatFlags(args, flags) c.formatFlags(args, flags)
// make go ignore SIGPIPE when all cgo thread set mask SIGPIPE
signal.Ignore(syscall.SIGPIPE)
var local = false var local = false
role := roles.MilvusRoles{} role := roles.MilvusRoles{}
switch c.serverType { switch c.serverType {
......
...@@ -49,13 +49,18 @@ std::mutex MinioChunkManager::client_mutex_; ...@@ -49,13 +49,18 @@ std::mutex MinioChunkManager::client_mutex_;
static void static void
SwallowHandler(int signal) { SwallowHandler(int signal) {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-result"
switch (signal) { switch (signal) {
case SIGPIPE: case SIGPIPE:
LOG_SERVER_WARNING_ << "SIGPIPE Swallowed" << std::endl; // cannot use log or stdio
write(1, "SIGPIPE Swallowed\n", 18);
break; break;
default: default:
LOG_SERVER_ERROR_ << "Unexpected signal in SIGPIPE handler: " << signal << std::endl; // cannot use log or stdio
write(2, "Unexpected signal\n", 18);
} }
#pragma GCC diagnostic pop
} }
/** /**
...@@ -104,6 +109,7 @@ MinioChunkManager::InitSDKAPI(RemoteStorageType type) { ...@@ -104,6 +109,7 @@ MinioChunkManager::InitSDKAPI(RemoteStorageType type) {
}; };
} }
#endif #endif
sdk_options_.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Info;
Aws::InitAPI(sdk_options_); Aws::InitAPI(sdk_options_);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册