From 8aaf3004914ced39dee6a61584cd7008dd49eb8a Mon Sep 17 00:00:00 2001 From: Albert Santoni Date: Mon, 23 Feb 2015 18:22:16 -0500 Subject: [PATCH] Attempt a workaround for unicode hostname resolution deadlock in the analyzer --- .../airtime_analyzer/cloud_storage_uploader.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/python_apps/airtime_analyzer/airtime_analyzer/cloud_storage_uploader.py b/python_apps/airtime_analyzer/airtime_analyzer/cloud_storage_uploader.py index f6fa27ee9..2ec91cdb5 100644 --- a/python_apps/airtime_analyzer/airtime_analyzer/cloud_storage_uploader.py +++ b/python_apps/airtime_analyzer/airtime_analyzer/cloud_storage_uploader.py @@ -93,6 +93,12 @@ class CloudStorageUploader: # turning into deadlocks, we explicitly set the global default timeout period here: socket.setdefaulttimeout(SOCKET_TIMEOUT) + # Crazy workaround for a deadlock inside Python 2.7 where unicode hostname resolution can + # cause a deadlock because the import spins up a separate thread: + # http://emptysqua.re/blog/weird-green-bug/ + # https://jira.mongodb.org/browse/PYTHON-607 + unicode('foo').encode('idna') + conn = S3Connection(self._api_key, self._api_key_secret, host=self._host) bucket = conn.get_bucket(self._bucket)