Refine sigpipe handling (#24862)

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
pull/24884/head v2.2.10
congqixia 2023-06-13 21:28:38 +08:00 committed by GitHub
parent 9f3e421427
commit f11b3174ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View File

@ -5,6 +5,8 @@ import (
"fmt"
"io"
"os"
"os/signal"
"syscall"
"go.uber.org/zap"
@ -50,6 +52,9 @@ func (c *run) execute(args []string, flags *flag.FlagSet) {
c.serverType = args[2]
c.formatFlags(args, flags)
// make go ignore SIGPIPE when all cgo thread set mask SIGPIPE
signal.Ignore(syscall.SIGPIPE)
var local = false
role := roles.MilvusRoles{}
switch c.serverType {

View File

@ -49,13 +49,18 @@ std::mutex MinioChunkManager::client_mutex_;
static void
SwallowHandler(int signal) {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-result"
switch (signal) {
case SIGPIPE:
LOG_SERVER_WARNING_ << "SIGPIPE Swallowed" << std::endl;
// cannot use log or stdio
write(1, "SIGPIPE Swallowed\n", 18);
break;
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) {
};
}
#endif
sdk_options_.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Info;
Aws::InitAPI(sdk_options_);
}
}