modelmat / sphinxcontrib-drawio

Sphinx extension for including draw.io files.
MIT License
39 stars 17 forks source link

Xvfb Inifinite Loop #68

Open jdillard opened 2 years ago

jdillard commented 2 years ago

I recently ran into an issue where someone had permission issues with Xvfb and it couldn't start up. It seems this line caused an infinite loop in that case, but it was hard to tell what the issue was at first: https://github.com/modelmat/sphinxcontrib-drawio/blob/1f6d77cf63e6bbe2be7f6d7661f91163fb8e6d62/sphinxcontrib/drawio/__init__.py#L298-L299

I'm not quite sure the best approach, but do you think it would be a good idea to add a counter in the loop and output a "Xvfb is having difficulty starting" log message if it goes over a generous amount? I also don't know if it's possible (or a good idea) to kill the Sphinx process at the same time.

modelmat commented 2 years ago

Does Xvfb stay running when there is a permission error? The lines above it should be failing it if it fails to start up.

jdillard commented 2 years ago

I'm not sure the best way to tell if Xvfb is running or not (so maybe it was running, but there was a different issue due to permissions). This was the error when just running Xvfb in the CLI:

_XSERVTransmkdir: Mode of /tmp/.X11-unix should be set to 1777
_XSERVTransmkdir: this may cause subsequent errors
_XSERVTransSocketCreateListener: failed to bind listener
_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: failed to create listener for unix

Setting the permissions of /tmp/.X11-unix to 1777 ended up fixing the issue once I found that out.