Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

fix(pb): skip Unix-socket gRPC registration on Windows (#9430) (#9434)

Chris Lua64483885cf2
diff --git a/weed/pb/grpc_client_server.go b/weed/pb/grpc_client_server.go
index e26d6278b3..b3aff37a93 100644
--- a/weed/pb/grpc_client_server.go
+++ b/weed/pb/grpc_client_server.go
@@ -8,6 +8,7 @@ import (
"net"
"net/http"
"os"
+ "runtime"
"strconv"
"strings"
"sync"
@@ -81,7 +82,15 @@ func init() {
// GrpcDial to host:grpcPort (or to a loopback alias of host on the same
// port) is routed through the Unix socket. Dials to any other host on the
// same port still go over TCP.
+//
+// No-op on Windows: the /tmp/...sock paths callers pass are POSIX-only and
+// the listen/dial would fail at runtime, taking gRPC down with it (#9430).
+// Skipping registration leaves the maps empty, so ServeGrpcOnLocalSocket
+// and resolveLocalGrpcSocket short-circuit and same-host RPCs go over TCP.
func RegisterLocalGrpcSocket(host string, grpcPort int, socketPath string) {
+ if runtime.GOOS == "windows" {
+ return
+ }
localGrpcSocketsLock.Lock()
defer localGrpcSocketsLock.Unlock()
localGrpcSockets[grpcPort] = socketPath
diff --git a/weed/pb/grpc_client_server_test.go b/weed/pb/grpc_client_server_test.go
index 210578d68e..bdc3cc48bf 100644
--- a/weed/pb/grpc_client_server_test.go
+++ b/weed/pb/grpc_client_server_test.go
@@ -2,6 +2,7 @@ package pb
import (
"fmt"
+ "runtime"
"testing"
"google.golang.org/grpc/codes"
@@ -74,6 +75,9 @@ func TestIsClientSideMarshalError_RequiresGrpcStatus(t *testing.T) {
// continue out over TCP — they must NOT be hijacked into host A's local
// socket on the basis of port match alone.
func TestResolveLocalGrpcSocket_RemotePortCollision(t *testing.T) {
+ if runtime.GOOS == "windows" {
+ t.Skip("Unix-socket routing is disabled on Windows (#9430)")
+ }
// Snapshot and restore global state so the test does not leak into others.
localGrpcSocketsLock.Lock()
prevSockets := localGrpcSockets