aaronjanse / 3mux

Terminal multiplexer inspired by i3
MIT License
1.82k stars 46 forks source link

Waiting for server to be online... #121

Closed jenstroeger closed 2 years ago

jenstroeger commented 3 years ago

I don’t use brew so I installed 3mux using

> go get github.com/aaronjanse/3mux

and when I try to run 3mux it asks me for a session name (I entered test) and I get this:

> ./go/bin/3mux
Waiting for server to be online... (/var/folders/d5/6_9wptzx0ml6ys098gqncydm0000gn/T/3mux/92c9afcc-e1f5-4d81-5821-fad5a3ffae1e/fd.sock)
Although the server socket exists, connection to it failed: dial unix /var/folders/d5/6_9wptzx0ml6ys098gqncydm0000gn/T/3mux/92c9afcc-e1f5-4d81-5821-fad5a3ffae1e/fd.sock: connect: connection refused
See server-side logs at /var/folders/d5/6_9wptzx0ml6ys098gqncydm0000gn/T/3mux/92c9afcc-e1f5-4d81-5821-fad5a3ffae1e/logs-server.txt
To manually kill this session, run `3mux kill test`

where the log contains:

> sudo cat /var/folders/d5/6_9wptzx0ml6ys098gqncydm0000gn/T/3mux/92c9afcc-e1f5-4d81-5821-fad5a3ffae1e/logs-server.txt
2021/03/26 11:17:45 Booting...
2021/03/26 11:17:45 Detach error: listen unix /var/folders/d5/6_9wptzx0ml6ys098gqncydm0000gn/T/3mux/92c9afcc-e1f5-4d81-5821-fad5a3ffae1e/detach-server.sock: bind: invalid argument

So, my question is: what server is expected to run here?

aaronjanse commented 3 years ago

Hmm. 3mux chooses this location via ($TMPDIR or /tmp)/3mux. The temporary directory path here looks randomly generated rather than being a consistent place like /tmp/3mux.

If you create another session, is the path to /var/.../3mux different? If so, that might explain the error.

P.S. Thank you for the detailed bug report!

jenstroeger commented 3 years ago

So, I have

> echo $TMPDIR 
/var/folders/d5/6_9wptzx0ml6ys098gqncydm0000gn/T/

and when I run 3mux twice (creating different sessions) then they both open a socket

/var/folders/d5/6_9wptzx0ml6ys098gqncydm0000gn/T/3mux/{UUID}/fd.sock

with different UUIDs. The logs-server.txt then contains the above error with the respective UUID. The value of $TMPDIR seems to stay constant across multiple Terminal.app restarts and the same login session.

sikmir commented 3 years ago

I have the same issue on macos.

jenstroeger commented 3 years ago

@sikmir is that about the MacPorts ticket #62563? 😉

sikmir commented 3 years ago

@sikmir is that about the MacPorts ticket #62563? 😉

Yes, I've just tried 1.1.0 and it doesn't work for me.

PotatoParser commented 3 years ago

Generally, the detach server is supposed to run in order to keep sessions alive (making sure that background tasks don't end when you detach) after you detach from them.

aaronjanse commented 3 years ago

Maybe the path is too long? https://github.com/golang/go/issues/6895

A way to test this would be seeing if 3mux works with the environment variable $TMPDIR set to something like /tmp. If so, we'll have to figure out in 3mux how to handle longer $TMPDIR paths

sikmir commented 3 years ago

Maybe the path is too long? golang/go#6895

A way to test this would be seeing if 3mux works with the environment variable $TMPDIR set to something like /tmp. If so, we'll have to figure out in 3mux how to handle longer $TMPDIR paths

You are right! It works with TMPDIR=/tmp 3mux.

aaronjanse commented 3 years ago

@PotatoParser It sounds like $TMPDIR is long by default on macOS. Thoughts on falling back on /tmp when $TMPDIR is too long to work?

PotatoParser commented 3 years ago

That sounds like a good idea, though we could try changing the uuid generation first by shrinking it (using [a-zA-Z0-9\-_] ("base64") instead of [a-f\-0-9] ("base17") - I believe case-sensitivity is the defacto for unix systems) and then fallback to /tmp if the new paths are still too long.

jenstroeger commented 3 years ago

I believe case-sensitivity is the defacto for unix systems

Not on Mac whose HFS+ and APFS default to case _in_sensitve 🤦🏻‍♂️

monomadic commented 2 years ago

Still getting this on macos, version 1.1.0

ryepesg commented 1 year ago

I still hit this in MacOS, fixed by TMPDIR=/tmp 3mux