3mux icon indicating copy to clipboard operation
3mux copied to clipboard

Waiting for server to be online...

Open jenstroeger opened this issue 3 years ago β€’ 12 comments

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?

jenstroeger avatar Mar 26 '21 01:03 jenstroeger

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!

aaronjanse avatar Mar 26 '21 02:03 aaronjanse

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.

jenstroeger avatar Mar 26 '21 03:03 jenstroeger

I have the same issue on macos.

sikmir avatar Mar 26 '21 10:03 sikmir

@sikmir is that about the MacPorts ticket #62563? πŸ˜‰

jenstroeger avatar Mar 26 '21 10:03 jenstroeger

@sikmir is that about the MacPorts ticket #62563? πŸ˜‰

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

sikmir avatar Mar 26 '21 10:03 sikmir

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.

PotatoParser avatar Mar 26 '21 11:03 PotatoParser

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

aaronjanse avatar Mar 27 '21 22:03 aaronjanse

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.

sikmir avatar Mar 27 '21 23:03 sikmir

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

aaronjanse avatar Apr 02 '21 05:04 aaronjanse

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.

PotatoParser avatar Apr 02 '21 20:04 PotatoParser

I believe case-sensitivity is the defacto for unix systems

Not on Mac whose HFS+ and APFS default to case _in_sensitve πŸ€¦πŸ»β€β™‚οΈ

jenstroeger avatar Apr 02 '21 22:04 jenstroeger

Still getting this on macos, version 1.1.0

monomadic avatar Jul 05 '22 06:07 monomadic

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

ryepesg avatar Nov 01 '22 02:11 ryepesg