Bug 1576220 [wpt PR 18642] - Fix WebDriver executor to actually delete the session, add debug info, a=testonly
authorSam Sneddon <me@gsnedders.com>
Wed, 28 Aug 2019 09:54:00 +0000
changeset 490703 a40980e4179ab2459051ceedfe0d08c091c6fda4
parent 490702 46ce1c209c17ce99f3090d6dbe179e018424fea7
child 490704 1cd8c72bcdebe21f24f4d24a5d4350a62beaa6e1
push id36509
push usercsabou@mozilla.com
push dateThu, 29 Aug 2019 21:46:56 +0000
treeherdermozilla-central@5c424bc57454 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1576220, 18642
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1576220 [wpt PR 18642] - Fix WebDriver executor to actually delete the session, add debug info, a=testonly Automatic update from web-platform-tests Fix the WebDriver executor to actually delete the session webdriver.quit doesn't exist, but webdriver.end does -- Add more debug info when we timeout and when killing WebDriver -- wpt-commits: beb4659e42c41f98f21ecc22c7ed501c2b9f37f9, d746cd6ed1ec1caa0b7469d55dd3fa1a4a9305d9 wpt-pr: 18642
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/executorwebdriver.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/executorwebdriver.py
@@ -1,11 +1,12 @@
 import json
 import os
 import socket
+import sys
 import threading
 import time
 import traceback
 import urlparse
 import uuid
 from .base import (CallbackHandler,
@@ -227,20 +228,24 @@ class WebDriverProtocol(Protocol):
         capabilities = {"alwaysMatch": self.capabilities}
         self.webdriver = client.Session(host, port, capabilities=capabilities)
     def teardown(self):
         self.logger.debug("Hanging up on WebDriver session")
-            self.webdriver.quit()
-        except Exception:
-            pass
-        del self.webdriver
+            self.webdriver.end()
+        except Exception as e:
+            message = str(getattr(e, "message", ""))
+            if message:
+                message += "\n"
+            message += traceback.format_exc(e)
+            self.logger.debug(message)
+        self.webdriver = None
     def is_alive(self):
             # Get a simple property over the connection
         except (socket.timeout, client.UnknownErrorException):
             return False
         return True
@@ -272,17 +277,20 @@ class WebDriverRun(object):
         flag = self.result_flag.wait(timeout + 2 * extra_timeout)
         if self.result is None:
             if flag:
                 # flag is True unless we timeout; this *shouldn't* happen, but
                 # it can if self._run fails to set self.result due to raising
                 self.result = False, ("INTERNAL-ERROR", "self._run didn't set a result")
-                self.result = False, ("EXTERNAL-TIMEOUT", None)
+                message = "Waiting on browser:\n"
+                # get a traceback for the current stack of the executor thread
+                message += "".join(traceback.format_stack(sys._current_frames()[executor.ident]))
+                self.result = False, ("EXTERNAL-TIMEOUT", message)
         return self.result
     def _run(self):
             self.result = True, self.func(self.protocol, self.url, self.timeout)
         except (client.TimeoutException, client.ScriptTimeoutException):
             self.result = False, ("EXTERNAL-TIMEOUT", None)
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/webdriver_server.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/webdriver_server.py
@@ -76,16 +76,17 @@ class WebDriverServer(object):
                 "WebDriver was not accessible "
                 "within the timeout:\n%s" % traceback.format_exc())
         if block:
     def stop(self, force=False):
+        self.logger.debug("Stopping WebDriver")
         if self.is_alive:
             return self._proc.kill()
         return not self.is_alive
     def is_alive(self):
         return hasattr(self._proc, "proc") and self._proc.poll() is None