Skip to content
This repository has been archived by the owner on Nov 5, 2019. It is now read-only.

Fix connection leaks caused by a stale job queue #65

Merged
merged 1 commit into from
Apr 25, 2013

Conversation

manover
Copy link
Contributor

@manover manover commented Apr 24, 2013

Another one

@manover
Copy link
Contributor Author

manover commented Apr 24, 2013

@jehiah Sorry, another one, don't merge it yet, I wanna watch how it works

@manover
Copy link
Contributor Author

manover commented Apr 25, 2013

If an error occurs during either authorization or RS handshake, the job queue might still contain unprocessed message(s). This fix works by flushing the queue, so that Connection._parse_response() would return connections to the pool in this case.

@@ -128,6 +128,8 @@ def _socket_close(self):
if callback:
callback(None, InterfaceError('connection closed'))
finally:
# Flush the job queue, ignore the callbacks, they've been already called
del self.__job_queue[:]
Copy link
Member

Choose a reason for hiding this comment

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

small style tweak, but can you just self.__job_queue = [] to clear it out instead of using del.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

well, here I wanted to make sure that the original list is emptied in case it's referenced from somewhere else, not sure it's relevant right now, but it's kind of a coding habit

@manover
Copy link
Contributor Author

manover commented Apr 25, 2013

@jehiah done

jehiah added a commit that referenced this pull request Apr 25, 2013
Fix connection leaks caused by a stale job queue
@jehiah jehiah merged commit 3b33c15 into bitly:master Apr 25, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants