Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

abuse of socket.setdefaulttimeout() in util.py get_instance_metadata breaks threading #1935

Open
ksquaredkey opened this Issue · 0 comments

2 participants

@ksquaredkey

In utils.py, get_instance_metadata(), the socket.setdefaulttimeout() global is misused to cause timeouts in the urllib2 trying to access the metadata server. The problem is that the way it is used is not thread safe and results in setting the default timeout for all sockets created after being called in two threads to be 1.0 rather than the proper default of None. This is a problem if you try to use IAM Roles for EC2 on your connections.

If we can abandon 2.5, we can use the timeout arguments added to urlllib2 in 2.6. Alternatively, there needs to be locking added around the whole body of get_instance_metadata() to keep multiple threads out of the unsafe code and prevent the default timeout from being stomped by boto.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.