Commit a53a88bb authored by Chris Harris's avatar Chris Harris
Browse files

vtkWeb: Cleanup python processes that timeout on startup

If the python process started by the launcher fails to startup
within the timeout perform the necessary cleanup.

Change-Id: If1c77abb89a47fbe6fb4d22c02cb7396f6043d7a
parent 3ce7a5ee
......@@ -445,7 +445,8 @@ class LauncherResource(resource.Resource, object):
if not d:
d = defer.Deferred()
if not self.process_manager.isReady(session, count + 1):
if not 'startTimedOut' in session and \
not self.process_manager.isReady(session, count + 1):
reactor.callLater(1, self._waitForReady, session, request, count + 1, d)
else:
d.callback(request)
......@@ -465,6 +466,10 @@ class LauncherResource(resource.Resource, object):
request.setResponseCode(http.OK)
else:
request.write(json.dumps({"error": "Session did not start before timeout expired. Check session logs."}))
# Mark the session as timed out and clean up the process
session['startTimedOut'] = True
self.session_manager.deleteSession(session['id'])
self.process_manager.stopProcess(session['id'])
request.setResponseCode(http.SERVICE_UNAVAILABLE)
request.finish()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment