@@ -81,7 +81,7 @@ def write_hosts_file(config):
8181
8282class ServoWebDriverBrowser (WebDriverBrowser ):
8383 init_timeout = 300 # Large timeout for cases where we're booting an Android emulator
84- shutdown_retry = 5
84+ shutdown_retry = 3
8585
8686 def __init__ (self , logger , binary , debug_info = None , webdriver_host = "127.0.0.1" ,
8787 server_config = None , binary_args = None ,
@@ -135,9 +135,13 @@ def is_alive(self):
135135 if not super ().is_alive ():
136136 return False
137137 try :
138- requests .get (f"http://{ self .host } :{ self .port } /status" , timeout = 5 )
139- except Exception :
140- self .logger .debug ("Servo has shut down normally." )
138+ requests .get (f"http://{ self .host } :{ self .port } /status" , timeout = 3 )
139+ except requests .exceptions .Timeout :
140+ # FIXME: This indicates a hanged browser. Reasons need to be investigated further.
141+ self .logger .debug ("Servo webdriver status request timed out." )
142+ return True
143+ except Exception as e :
144+ self .logger .debug (f"Servo has shut down normally. { e } " )
141145 return False
142146
143147 return True
@@ -149,7 +153,7 @@ def stop(self, force=False):
149153 try :
150154 requests .delete (
151155 f"http://{ self .host } :{ self .port } /session/dummy-session-id/servo/shutdown" ,
152- timeout = 5
156+ timeout = 3
153157 )
154158 except requests .exceptions .ConnectionError :
155159 self .logger .debug ("Browser already shut down (connection refused)" )
@@ -166,7 +170,7 @@ def stop(self, force=False):
166170 self .logger .debug ("Max retry exceeded." )
167171 break
168172 time .sleep (1 )
169- super ().stop (force = force )
173+ super ().stop (force )
170174
171175 def find_wpt_prefs (self , logger ):
172176 default_path = os .path .join ("resources" , "wpt-prefs.json" )
0 commit comments