Commit b6f06831 authored by tonyg@chromium.org's avatar tonyg@chromium.org

[Telemetry] Fix a few more potential deadlocks.

This builds on https://codereview.chromium.org/385653002/ .

Many functions in Python's logging module grab a lock internally. Some
appear to do so before converting the provided message to a string via
its __str__ method.

Calling an object's __str__ method before calling a logging funciton
allows anything called by the __str__ method to log without the risk of
hitting a deadlock.

BUG=392869

Review URL: https://codereview.chromium.org/383793002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282485 0039d316-1c4b-4281-b951-d872f2087c98
parent fee637a4
...@@ -127,7 +127,7 @@ class Benchmark(command_line.Command): ...@@ -127,7 +127,7 @@ class Benchmark(command_line.Command):
'If you believe you have credentials, follow the ' 'If you believe you have credentials, follow the '
'instructions below.', 'instructions below.',
generated_profile_archive_path) generated_profile_archive_path)
logging.error(e) logging.error(str(e))
sys.exit(-1) sys.exit(-1)
# Unzip profile directory. # Unzip profile directory.
......
...@@ -90,7 +90,7 @@ def FindAllAvailableBrowsers(finder_options): ...@@ -90,7 +90,7 @@ def FindAllAvailableBrowsers(finder_options):
except urllib2.URLError as e: except urllib2.URLError as e:
logging.debug('Error communicating with devices over %s.' logging.debug('Error communicating with devices over %s.'
% IOS_WEBKIT_DEBUG_PROXY) % IOS_WEBKIT_DEBUG_PROXY)
logging.debug(e) logging.debug(str(e))
return [] return []
# TODO(baxley): Move to ios-webkit-debug-proxy command class, similar # TODO(baxley): Move to ios-webkit-debug-proxy command class, similar
......
...@@ -93,7 +93,7 @@ class LinuxPlatformBackend( ...@@ -93,7 +93,7 @@ class LinuxPlatformBackend(
changed |= cloud_storage.GetIfChanged( changed |= cloud_storage.GetIfChanged(
ipfw_mod, cloud_storage.INTERNAL_BUCKET) ipfw_mod, cloud_storage.INTERNAL_BUCKET)
except cloud_storage.CloudStorageError, e: except cloud_storage.CloudStorageError, e:
logging.error(e) logging.error(str(e))
logging.error('You may proceed by manually installing dummynet. See: ' logging.error('You may proceed by manually installing dummynet. See: '
'http://info.iet.unipi.it/~luigi/dummynet/') 'http://info.iet.unipi.it/~luigi/dummynet/')
sys.exit(1) sys.exit(1)
...@@ -114,7 +114,7 @@ class LinuxPlatformBackend( ...@@ -114,7 +114,7 @@ class LinuxPlatformBackend(
cloud_storage.GetIfChanged(bin_path, cloud_storage.INTERNAL_BUCKET) cloud_storage.GetIfChanged(bin_path, cloud_storage.INTERNAL_BUCKET)
os.chmod(bin_path, 0755) os.chmod(bin_path, 0755)
except cloud_storage.CloudStorageError, e: except cloud_storage.CloudStorageError, e:
logging.error(e) logging.error(str(e))
if fallback_package: if fallback_package:
logging.error('You may proceed by manually installing %s via:\n' logging.error('You may proceed by manually installing %s via:\n'
'sudo apt-get install %s' % (bin_name, fallback_package)) 'sudo apt-get install %s' % (bin_name, fallback_package))
......
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