mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-09-20 13:30:46 +02:00
pb: stop exiting the process on malformed server addresses
ServerToGrpcAddress and GrpcAddressToServerAddress called glog.Fatalf when hostAndPort could not parse the port, which os.Exit(255)ed the whole process. A caller-supplied copy or tail source address reached this path synchronously in the serving goroutine, so one anonymous VolumeCopy with a non-numeric port terminated the volume server. Log the parse error and return the input unchanged instead: the dial or request that consumes the address then fails as an ordinary error.
This commit is contained in:
@@ -551,7 +551,8 @@ func ServerToGrpcAddress(server string) (serverGrpcAddress string) {
|
||||
|
||||
host, port, parseErr := hostAndPort(server)
|
||||
if parseErr != nil {
|
||||
glog.Fatalf("server address %s parse error: %v", server, parseErr)
|
||||
glog.Errorf("server address %s parse error: %v", server, parseErr)
|
||||
return server
|
||||
}
|
||||
|
||||
grpcPort := int(port) + 10000
|
||||
@@ -562,7 +563,8 @@ func ServerToGrpcAddress(server string) (serverGrpcAddress string) {
|
||||
func GrpcAddressToServerAddress(grpcAddress string) (serverAddress string) {
|
||||
host, grpcPort, parseErr := hostAndPort(grpcAddress)
|
||||
if parseErr != nil {
|
||||
glog.Fatalf("server grpc address %s parse error: %v", grpcAddress, parseErr)
|
||||
glog.Errorf("server grpc address %s parse error: %v", grpcAddress, parseErr)
|
||||
return grpcAddress
|
||||
}
|
||||
|
||||
port := int(grpcPort) - 10000
|
||||
|
||||
Reference in New Issue
Block a user