Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Two changes to waitforx:-
XOpenDisplay()
call can go to the network and possibly block for a long time. Instead, use the (undocumented) "unix:n" display specification, which never goes to the network, and doesn't block.We've had three reports now of
waitforx
seemingly blocking:-I've not been able to get to the bottom of any of them satisfactorily, but I got a clue when looking at the last of these.
What I think is happening is this:-
xrdp-sesman
startsXorg
Xorg
takes a while to initialise and open the UNIX socket for the displaywaitforx
runs before the socket has opened and tries to open a display of the form ":n". Let's say this is ":10".XOpenDisplay()
goes to the network to try to connect to TCP portlocalhost:6010
for the X server.localhost
or because the user has not unreasonably firewalled off X11 ports.waitforx
times out.The fix is to use a display specification of (e.g.)
unix:10
instead of:10
. This never goes to the network, and so the scenario above is avoided.However, the DISPLAY specification 'unix:n' is not documented.
It's clearly supported in the xcb code in
_xcb_open()
, which libX11 is now layered on:-https://gitlab.freedesktop.org/xorg/lib/libxcb/-/blob/master/src/xcb_util.c?ref_type=heads#L247
There's evidence of it being supported back in 2007:-
https://gitlab.freedesktop.org/xorg/lib/libxcb/-/commit/09045eaac34973662aaa820a94ca8ed66d9dcb4e
I've tried the notation for both CentOS 7 and Ubuntu 16.04, which are the oldest distros I have available. These both support it.
Are people happy with this notation being used here? Is there a better way to get the same result?