Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[statsd] fix socket creation thread safeness #60

Merged
merged 1 commit into from
Jun 25, 2015

Conversation

yannmh
Copy link
Member

@yannmh yannmh commented Jun 23, 2015

Fix #57. Thanks @GrahamDumpleton !

@yannmh yannmh added the bug label Jun 23, 2015
@yannmh yannmh self-assigned this Jun 23, 2015
yannmh added a commit that referenced this pull request Jun 25, 2015
[statsd] fix socket creation thread safeness
@yannmh yannmh merged commit 86882cd into master Jun 25, 2015
@yannmh yannmh deleted the yann/fix-thread-unsafe-get-socket branch June 25, 2015 01:40
self.socket.connect((self.host, self.port))
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.connect((self.host, self.port))
self.socket = sock
return self.socket

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm seeing these races in a newer version of this module. Pretty sure there is still a race in this code. If another thread closes the socket between line 59 and 60, get_socket could return None or a closed socket. Similar race in close_socket itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants