mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-30 12:11:32 +08:00
Handle failure to read JSON waiting for server start
If the test controller tries to read the file while the server it has started is in the middle of writing it, it gets invalid JSON and fails. This just loops again until we have valid JSON to read.
This commit is contained in:
parent
79b8ecd9c9
commit
e26140c435
@ -274,8 +274,14 @@ class JSController(TestController):
|
||||
if self.server.poll() is not None:
|
||||
return self._failed_to_start()
|
||||
if os.path.exists(self.server_info_file):
|
||||
self._load_server_info()
|
||||
return
|
||||
try:
|
||||
self._load_server_info()
|
||||
except ValueError:
|
||||
# If the server is halfway through writing the file, we may
|
||||
# get invalid JSON; it should be ready next iteration.
|
||||
pass
|
||||
else:
|
||||
return
|
||||
time.sleep(0.1)
|
||||
print("Notebook server-info file never arrived: %s" % self.server_info_file,
|
||||
file=sys.stderr
|
||||
|
Loading…
Reference in New Issue
Block a user