Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't run daemonded on macOS #1390

Closed
illwieckz opened this issue Oct 26, 2024 · 2 comments · Fixed by #1459
Closed

Can't run daemonded on macOS #1390

illwieckz opened this issue Oct 26, 2024 · 2 comments · Fixed by #1459

Comments

@illwieckz
Copy link
Member

illwieckz commented Oct 26, 2024

Can't run daemonded on macOS:

Warn: Could not bind singleton socket at file:
 "/var/folders/q8/0gyf99wn3ll4nldcx_kczndm0000gn/T/.unvanquished-server-794C07CE3289A50A86A103978DE9DCE5/socket",
 error: "Address already in use" 

But daemon-tty works and can host a game.

@slipher
Copy link
Member

slipher commented Oct 26, 2024

I reproduce on Mac M1 mini. Changing the homepath doesn't help either.

@slipher
Copy link
Member

slipher commented Dec 10, 2024

Apparently the original bind syscall had a name length limit of ~100 characters and no *nix maintainers have bothered to upgrade it since.

Workaround:

mkdir /tmp/fart
TMPDIR=/tmp/fart ./daemonded

slipher added a commit to slipher/Daemon that referenced this issue Dec 11, 2024
Somehow bind() has the same filename length limit from the 1970s
and there is no alternative API that can use a longer name. Recent
MacOS versions generate a long random path for TMPDIR, which causes
a fatal error for daemonded -
DaemonEngine#1390 (the server uses
a slightly longer path than the client).
slipher added a commit to slipher/Daemon that referenced this issue Dec 11, 2024
The default profile now generates a ~50-character-long $TMPDIR by
default (I assume it must have been shorter before). The singleton
socket path we generate for daemonded ends up too long for the
`bind` or `connect` APIs. (The socket path for clients is slightly
shorter and just sneaks under the limit.) Work around this by using
the Mac-specific pthread_chdir_np API to thread-safely change the
CWD to the directory with the socket, accessing it with a relative
path, then resetting the current directory to what it was before.

Fixes DaemonEngine#1390.
slipher added a commit to slipher/Daemon that referenced this issue Dec 11, 2024
The default profile now generates a ~50-character-long $TMPDIR by
default (I assume it must have been shorter before). The singleton
socket path we generate for daemonded ends up too long for the
`bind` or `connect` APIs. (The socket path for clients is slightly
shorter and just sneaks under the limit.) Work around this by using
the Mac-specific pthread_chdir_np API to thread-safely change the
CWD to the directory with the socket, accessing it with a relative
path, then resetting the current directory to what it was before.

Fixes DaemonEngine#1390.
slipher added a commit that referenced this issue Dec 13, 2024
Somehow bind() has the same filename length limit from the 1970s
and there is no alternative API that can use a longer name. Recent
MacOS versions generate a long random path for TMPDIR, which causes
a fatal error for daemonded -
#1390 (the server uses
a slightly longer path than the client).
slipher added a commit that referenced this issue Dec 13, 2024
The default profile now generates a ~50-character-long $TMPDIR by
default (I assume it must have been shorter before). The singleton
socket path we generate for daemonded ends up too long for the
`bind` or `connect` APIs. (The socket path for clients is slightly
shorter and just sneaks under the limit.) Work around this by using
the Mac-specific pthread_chdir_np API to thread-safely change the
CWD to the directory with the socket, accessing it with a relative
path, then resetting the current directory to what it was before.

Fixes #1390.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants