# Buggy code
def __new__(cls, socket_path, io_loop=None):
    io_loop = io_loop or tornado.ioloop.IOLoop.current()
    if io_loop not in IPCClient.instance_map:
        IPCClient.instance_map[io_loop] = weakref.WeakValueDictionary()
    loop_instance_map = IPCClient.instance_map[io_loop]

    # FIXME
    key = socket_path

    if key not in loop_instance_map:
        log.debug("Initializing new IPCClient for path: {0}".format(key))
        new_client = object.__new__(cls)
        # FIXME
        new_client.__singleton_init__(io_loop=io_loop, socket_path=socket_path)
        loop_instance_map[key] = new_client
    else:
        log.debug("Re-using IPCClient for {0}".format(key))
    return loop_instance_map[key]


# Traceback (SaltReqTimeoutError)
# minion log
2015-07-24 23:28:05,411 [salt.fileclient  ][INFO    ][1676] Fetching file from saltenv 'base', ** done ** u'win/repo/salt-winrepo.git/filezilla.sls'
2015-07-24 23:28:05,442 [salt.fileclient  ][DEBUG   ][1676] In saltenv 'base', looking at rel_path u'win/repo/salt-winrepo.git/firefox.sls' to resolve u'salt://win/repo/salt-winrepo.git/firefox.sls'
2015-07-24 23:28:05,442 [salt.fileclient  ][DEBUG   ][1676] In saltenv 'base', ** considering ** path u'c:\\salt\\var\\cache\\salt\\minion\\files\\base\\win/repo/salt-winrepo.git/firefox.sls' to resolve u'salt://win/repo/salt-winrepo.git/firefox.sls'
2015-07-24 23:28:05,442 [salt.fileclient  ][DEBUG   ][1676] Fetching file from saltenv 'base', ** attempting ** u'salt://win/repo/salt-winrepo.git/firefox.sls'
2015-07-24 23:28:05,442 [salt.fileclient  ][DEBUG   ][1676] No dest file found
2015-07-24 23:28:05,505 [salt.minion      ][INFO    ][1676] User root Executing command saltutil.find_job with jid 20150724172736012184
2015-07-24 23:28:05,505 [salt.minion      ][DEBUG   ][1676] Command details {'tgt_type': 'glob', 'jid': '20150724172736012184', 'tgt': 'jmoney-windows-12', 'ret': '', 'user': 'root', 'arg': ['20150724172730999547'], 'fun': 'saltutil.find_job'}
2015-07-24 23:28:05,505 [salt.minion      ][INFO    ][1676] Starting a new job with PID 1676
2015-07-24 23:28:05,551 [salt.fileclient  ][INFO    ][1676] Fetching file from saltenv 'base', ** done ** u'win/repo/salt-winrepo.git/firefox.sls'
2015-07-24 23:28:05,583 [salt.utils.lazy  ][DEBUG   ][1676] LazyLoaded saltutil.find_job
2015-07-24 23:28:05,583 [salt.minion      ][INFO    ][1676] Returning information for job: 20150724172736012184
2015-07-24 23:28:05,583 [salt.transport.tcp][DEBUG   ][1676] Re-using AsyncTCPReqChannel for ('c:\\salt\\conf\\pki\\minion', 'jmoney-windows-12', 'tcp://23.253.230.82:4506', 'aes')
2015-07-24 23:28:05,614 [salt.fileclient  ][DEBUG   ][1676] In saltenv 'base', looking at rel_path u'win/repo/salt-winrepo.git/firefox_x86.sls' to resolve u'salt://win/repo/salt-winrepo.git/firefox_x86.sls'
2015-07-24 23:28:05,614 [salt.fileclient  ][DEBUG   ][1676] In saltenv 'base', ** considering ** path u'c:\\salt\\var\\cache\\salt\\minion\\files\\base\\win/repo/salt-winrepo.git/firefox_x86.sls' to resolve u'salt://win/repo/salt-winrepo.git/firefox_x86.sls'
2015-07-24 23:28:05,614 [salt.fileclient  ][DEBUG   ][1676] Fetching file from saltenv 'base', ** attempting ** u'salt://win/repo/salt-winrepo.git/firefox_x86.sls'
2015-07-24 23:28:05,614 [salt.fileclient  ][DEBUG   ][1676] No dest file found
2015-07-24 23:29:05,605 [tornado.application][ERROR   ][1676] Future exception was never retrieved: Traceback (most recent call last):
File "C:\salt\bin\lib\site-packages\tornado\gen.py", line 876, in run
yielded = self.gen.throw(*exc_info)
File "C:\salt\bin\lib\site-packages\salt\transport\tcp.py", line 181, in send
ret = yield self._crypted_transfer(load, tries=tries, timeout=timeout)
File "C:\salt\bin\lib\site-packages\tornado\gen.py", line 870, in run
value = future.result()
File "C:\salt\bin\lib\site-packages\tornado\concurrent.py", line 215, in result
raise_exc_info(self._exc_info)
File "C:\salt\bin\lib\site-packages\tornado\gen.py", line 876, in run
yielded = self.gen.throw(*exc_info)
File "C:\salt\bin\lib\site-packages\salt\transport\tcp.py", line 161, in _crypted_transfer
ret = yield _do_transfer()
File "C:\salt\bin\lib\site-packages\tornado\gen.py", line 870, in run
value = future.result()
File "C:\salt\bin\lib\site-packages\tornado\concurrent.py", line 215, in result
raise_exc_info(self._exc_info)
File "C:\salt\bin\lib\site-packages\tornado\gen.py", line 876, in run
yielded = self.gen.throw(*exc_info)
File "C:\salt\bin\lib\site-packages\salt\transport\tcp.py", line 148, in _do_transfer
timeout=timeout,
File "C:\salt\bin\lib\site-packages\tornado\gen.py", line 870, in run
value = future.result()
File "C:\salt\bin\lib\site-packages\tornado\concurrent.py", line 215, in result
raise_exc_info(self._exc_info)
File "<string>", line 3, in raise_exc_info
SaltReqTimeoutError: Message timed out
2015-07-24 23:29:05,605 [salt.minion      ][WARNING ][1676] The minion function caused an exception
Traceback (most recent call last):
File "C:\salt\bin\lib\site-packages\salt\minion.py", line 1037, in _thread_return
return_data = func(*args, **kwargs)
File "C:\salt\bin\lib\site-packages\salt\modules\win_pkg.py", line 375, in refresh_db
cached_files = __salt__['cp.cache_dir'](repo, saltenv, include_pat='*.sls')
File "C:\salt\bin\lib\site-packages\salt\modules\cp.py", line 444, in cache_dir
path, saltenv, include_empty, include_pat, exclude_pat
File "C:\salt\bin\lib\site-packages\salt\fileclient.py", line 232, in cache_dir
fn_ = self.cache_file(salt.utils.url.create(fn_), saltenv)
File "C:\salt\bin\lib\site-packages\salt\fileclient.py", line 154, in cache_file
return self.get_url(path, '', True, saltenv)
File "C:\salt\bin\lib\site-packages\salt\fileclient.py", line 539, in get_url
return self.get_file(url, dest, makedirs, saltenv)
File "C:\salt\bin\lib\site-packages\salt\fileclient.py", line 1056, in get_file
data = self.channel.send(load)
File "C:\salt\bin\lib\site-packages\salt\utils\async.py", line 77, in wrap
ret = self._block_future(ret)
File "C:\salt\bin\lib\site-packages\salt\utils\async.py", line 87, in _block_future
return future.result()
File "C:\salt\bin\lib\site-packages\tornado\concurrent.py", line 216, in result
self._check_done()
File "C:\salt\bin\lib\site-packages\tornado\concurrent.py", line 294, in _check_done
raise Exception("DummyFuture does not support blocking for results")
Exception: DummyFuture does not support blocking for results
2015-07-24 23:29:05,621 [salt.utils.event ][DEBUG   ][1676] SaltEvent PUB socket URI: tcp://127.0.0.1:4510
2015-07-24 23:29:05,621 [salt.utils.event ][DEBUG   ][1676] SaltEvent PULL socket URI: tcp://127.0.0.1:4511
2015-07-24 23:29:05,621 [salt.utils.event ][DEBUG   ][1676] Sending event - data = {'message': u'The minion function caused an exception', 'args': ('The minion function caused an exception',), '_stamp': '2015-07-24T23:29:05.621000'}
2015-07-24 23:29:05,621 [salt.minion      ][DEBUG   ][1676] Handling event "_salt_error\n\n\x83\xa7message\xda\x00'The minion function caused an exception\xa4args\x91\xda\x00'The minion function caused an exception\xa6_stamp\xba2015-07-24T23:29:05.621000"
2015-07-24 23:29:05,621 [salt.minion      ][DEBUG   ][1676] Forwarding salt error event tag=_salt_error
2015-07-24 23:29:05,621 [salt.transport.tcp][DEBUG   ][1676] Re-using AsyncTCPReqChannel for ('c:\\salt\\conf\\pki\\minion', 'jmoney-windows-12', 'tcp://23.253.230.82:4506', 'aes')
2015-07-24 23:29:05,621 [salt.minion      ][INFO    ][1676] fire_master failed: Traceback (most recent call last):
File "C:\salt\bin\lib\site-packages\salt\minion.py", line 926, in _fire_master
result = channel.send(load, timeout=timeout)
File "C:\salt\bin\lib\site-packages\salt\utils\async.py", line 77, in wrap
ret = self._block_future(ret)
File "C:\salt\bin\lib\site-packages\salt\utils\async.py", line 87, in _block_future
return future.result()
File "C:\salt\bin\lib\site-packages\tornado\concurrent.py", line 216, in result
self._check_done()
File "C:\salt\bin\lib\site-packages\tornado\concurrent.py", line 294, in _check_done
raise Exception("DummyFuture does not support blocking for results")
Exception: DummyFuture does not support blocking for results

2015-07-24 23:29:05,652 [salt.minion      ][INFO    ][1676] Returning information for job: 20150724172730999547
2015-07-24 23:29:05,652 [salt.transport.tcp][DEBUG   ][1676] Re-using AsyncTCPReqChannel for ('c:\\salt\\conf\\pki\\minion', 'jmoney-windows-12', 'tcp://23.253.230.82:4506', 'aes')

# Fixed code
def __new__(cls, socket_path, io_loop=None):
    io_loop = io_loop or tornado.ioloop.IOLoop.current()
    if io_loop not in IPCClient.instance_map:
        IPCClient.instance_map[io_loop] = weakref.WeakValueDictionary()
    loop_instance_map = IPCClient.instance_map[io_loop]

    # FIXME
    key = str(socket_path)

    if key not in loop_instance_map:
        log.debug("Initializing new IPCClient for path: {0}".format(key))
        new_client = object.__new__(cls)
        # FIXME
        new_client.__singleton_init__(io_loop=io_loop, socket_path=socket_path)
        loop_instance_map[key] = new_client
    else:
        log.debug("Re-using IPCClient for {0}".format(key))
    return loop_instance_map[key]