Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Unified Diff: remoting/host/linux/linux_me2me_host.py

Issue 1138613002: Handle exception writing to Chromoting host's stdin. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/linux/linux_me2me_host.py
diff --git a/remoting/host/linux/linux_me2me_host.py b/remoting/host/linux/linux_me2me_host.py
index b615e9523fdf50a2340c02615e0502e21abb353f..75a68ea241211002e198311431d26b8b15fd9b11 100755
--- a/remoting/host/linux/linux_me2me_host.py
+++ b/remoting/host/linux/linux_me2me_host.py
@@ -509,8 +509,19 @@ class Desktop:
logging.info(args)
if not self.host_proc.pid:
raise Exception("Could not start Chrome Remote Desktop host")
- self.host_proc.stdin.write(json.dumps(host_config.data))
- self.host_proc.stdin.close()
+
+ try:
+ self.host_proc.stdin.write(json.dumps(host_config.data))
+ self.host_proc.stdin.flush()
+ except IOError as e:
+ # This can occur in rare situations, for example, if the machine is
+ # heavily loaded and the host process dies quickly (maybe if the X
+ # connection failed), the host process might be gone before this code
+ # writes to the host's stdin. Catch and log the exception, allowing
+ # the process to be retried instead of exiting the script completely.
+ logging.error("Failed writing to host's stdin: " + str(e))
+ finally:
+ self.host_proc.stdin.close()
def get_daemon_proc():
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698