{"action":"closed","issue":{"url":"https://api.github.com/repos/subuser-security/subuser/issues/224","labels_url":"https://api.github.com/repos/subuser-security/subuser/issues/224/labels{/name}","comments_url":"https://api.github.com/repos/subuser-security/subuser/issues/224/comments","events_url":"https://api.github.com/repos/subuser-security/subuser/issues/224/events","html_url":"https://github.com/subuser-security/subuser/issues/224","id":109653488,"number":224,"title":"Xpra client connects too early, before server is ready","user":{"login":"ruipgpinheiro","id":11169970,"avatar_url":"https://avatars.githubusercontent.com/u/11169970?v=3","gravatar_id":"","url":"https://api.github.com/users/ruipgpinheiro","html_url":"https://github.com/ruipgpinheiro","followers_url":"https://api.github.com/users/ruipgpinheiro/followers","following_url":"https://api.github.com/users/ruipgpinheiro/following{/other_user}","gists_url":"https://api.github.com/users/ruipgpinheiro/gists{/gist_id}","starred_url":"https://api.github.com/users/ruipgpinheiro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruipgpinheiro/subscriptions","organizations_url":"https://api.github.com/users/ruipgpinheiro/orgs","repos_url":"https://api.github.com/users/ruipgpinheiro/repos","events_url":"https://api.github.com/users/ruipgpinheiro/events{/privacy}","received_events_url":"https://api.github.com/users/ruipgpinheiro/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/subuser-security/subuser/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-04T00:25:06Z","updated_at":"2015-10-05T16:14:49Z","closed_at":"2015-10-05T16:14:49Z","body":"I've been noticing that, under my current VM, especially for a few minutes after booting, if I try to run my firefox sandbox, I sometimes get this:\r\n\r\n    No protocol specified\r\n    Error: cannot open display: unix:100\r\n\r\nAfter some time, that stops happening until next boot. I was able to track it down to the fact that, upon launching the Xpra client, the Xpra server might still not be ready. For some reason (heavy load?) this happens mostly during the first ~10 minutes during boot.\r\n\r\nBy waiting 5 seconds before the waitForServerContainerToLaunch() method returns, this is no longer reproducible in my current setup:\r\n\r\n    def waitForServerContainerToLaunch(self):\r\n        while True:\r\n          if os.path.exists(os.path.join(self.getServerSideX11Path(),\"X100\")) and os.path.exists(self.getXpraSocket()):\r\n            time.sleep(5)\r\n            return\r\n          time.sleep(0.05)\r\n\r\nI also tried to reduce it to 3 seconds, but then it still happened more or less once per boot, if I try to run a sandbox right after booting and logging in. Of course, waiting 5 seconds on every launch isn't exactly efficient, so this isn't a real fix.\r\n\r\nWith Xpra debugging active, I've noticed that the following line should appear on the console before launching the client, or it will very likely fail with the above error.\r\n\r\n    xpra is ready.\r\n\r\nA solution might be to listen to the Xpra server's stdout until it outputs that line, and only then launch the client, instead of basing this decision off the existence of the pipes. I might find some time to look into it a bit more myself, but Python isn't my best language, and I'm not really familiar with the code base or with docker. From a cursory glance there doesn't seem to be an easy way in the current code base to \"listen\" to a runtime, though, so my suggested fix might not be at all simple."}}