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

Unified Diff: telemetry/telemetry/internal/backends/chrome/desktop_browser_finder.py

Issue 2868703002: Retry browser startup in desktop_browser_finder. (Closed)
Patch Set: Stop fetching tab. Clarify retry messages. Created 3 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: telemetry/telemetry/internal/backends/chrome/desktop_browser_finder.py
diff --git a/telemetry/telemetry/internal/backends/chrome/desktop_browser_finder.py b/telemetry/telemetry/internal/backends/chrome/desktop_browser_finder.py
index e2cedb744857bbd6886669a9f69166f38ed0d018..23b413f2e874311b8fafe7f72c00c8191a41e74c 100644
--- a/telemetry/telemetry/internal/backends/chrome/desktop_browser_finder.py
+++ b/telemetry/telemetry/internal/backends/chrome/desktop_browser_finder.py
@@ -60,12 +60,36 @@ class PossibleDesktopBrowser(possible_browser.PossibleBrowser):
self._InitPlatformIfNeeded()
- browser_backend = desktop_browser_backend.DesktopBrowserBackend(
- self._platform_backend,
- finder_options.browser_options, self._local_executable,
- self._flash_path, self._is_content_shell, self._browser_directory)
- return browser.Browser(
- browser_backend, self._platform_backend, self._credentials_path)
+ num_retries = 3
+ for x in range(0, num_retries):
+ returned_browser = None
+ try:
+ returned_browser = None
+
+ browser_backend = desktop_browser_backend.DesktopBrowserBackend(
+ self._platform_backend,
+ finder_options.browser_options, self._local_executable,
+ self._flash_path, self._is_content_shell, self._browser_directory)
+
+ returned_browser = browser.Browser(
+ browser_backend, self._platform_backend, self._credentials_path)
+
+ return returned_browser
+ except Exception:
+ report = 'Browser creation failed (attempt %d of %d)' % (
+ (x + 1), num_retries)
+ if x < num_retries - 1:
+ report += ', retrying'
+ logging.warning(report)
+ # Attempt to clean up things left over from the failed browser startup.
+ try:
+ if returned_browser:
+ returned_browser.Close()
+ except Exception:
+ pass
+ # Re-raise the exception the last time through.
+ if x == num_retries - 1:
+ raise
def SupportsOptions(self, browser_options):
if ((len(browser_options.extensions_to_load) != 0)
« 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