Remote readers locking inadequate

In the past I was seeing failures to read when multiple requests came in for the exact same metric and the locking around the existing connections was not adequate.

I was able to reproduce it this morning on an instance running the master branch:

Tue Sep 03 14:36:26 2013 :: Error requesting http://a.b.c.d/render/?target=%2A.carbon-daemons.%2A.%7Bcache%5B0-9%5D%2Cagger%5B0-9%5D%7D.writer.cached_datapoints&format=pickle&local=1&noCache=1&from=1378215685&until=1378218985
Traceback (most recent call last):
  File "/opt/graphite/webapp/graphite/remote_storage.py", line 182, in wait_for_results
    response = connection.getresponse()
NameError: free variable 'connection' referenced before assignment in enclosing scope