Skip to content

Commit cfe70a7

Browse files
committed
runtime: use slightly lower UDS path limit for mac reasons
The max length of a unix domain socket path is slightly lower on mac than it is on linux, and it keeps causing me issues during testing. If a path ended up being between 105-107 characters long, it would not get hashed (shortened) on mac, which causes the runtime to fail. This tweaks our existing hacky workaround to make things more reliable on mac, without significantly changing the behavior on linux. This is sort of like adding duct tape over top of chewing gum, I know, but it makes local testing on mac far less frustrating.
1 parent 03b3c91 commit cfe70a7

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

go/bindings/task_service.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,14 @@ func NewTaskService(
8181
}
8282
}
8383

84-
// Unix sockets are limited to 108 characters in length.
84+
// Unix sockets are limited to 104 characters in length on mac. Linux allows 107, but we
85+
// respect the slightly lower limit here instead of having separate limits per OS.
8586
// TODO(johnny): Remove hashing after pet-set migration, when we know there's a bound on directory length.
86-
if len(config.UdsPath) > 107 {
87+
if len(config.UdsPath) > 104 {
8788
config.UdsPath = path.Join(os.TempDir(), fmt.Sprintf("task-svc-%x", md5.Sum([]byte(config.UdsPath))))
88-
89+
// 107 is intentional here. If we're on mac and the path is still longer than 104, we'll still raise
90+
// an error from the rust runtime. But we tend to have paths that are still very close to the limit,
91+
// so this ensures that we don't return errors unnecessarily on linux.
8992
if len(config.UdsPath) > 107 {
9093
return nil, fmt.Errorf("config.UdsPath still too long after hashing: %s", config.UdsPath)
9194
}

0 commit comments

Comments
 (0)