async
async copied to clipboard
possible race condition: Unable to open connection to server on socket
In a script where I'm doing this:
S="/$TMP/async_socket"
async -s="$S" server --start -j40
$async -s="$S" cmd -- bash -c "echo hello"
... I'm sometimes running into this:
Error: Unable to open connection to server on socket
sources-combined> Caused by IO error: No such file or directory (os error 2)
My guess is, that the async --start command doesn't ensure the socket file exists when exiting and only creates it shortly after.
If cmd is issued too quickly, it will not find the socket and error out.
A sleep 1 after the start command, seems to resolve the issue.
But this should better not be necessary.
this happens almost every time for me. tried to async wait for the server to start, but it also fails to connect to the socket before the server comes up.
this makes it unusable for me.