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

ConnectionDropped bug fix. #41

Closed
wants to merge 1 commit into from
Closed

ConnectionDropped bug fix. #41

wants to merge 1 commit into from

Conversation

cgordon
Copy link

@cgordon cgordon commented Dec 10, 2012

Fixing a bug that causes the writer thread/greenlet to exit on dropped connections. In the _send_request method there are three places in which the _submit method is called. Two of them happen in the body of the "try", while the third happens in the exception handler for self.handler.empty exceptions.

If the connection is dropped in either of the first two calls to _submit, it triggers the "except Exception" handler, which causes the method to return False, thereby triggering the writer thread/greenlet to shut down. The other call to _submit is already in an exception handler, so if it raises a ConnectionDropped it is handled in the _connect_loop, which is what should happen. The straightforward fix is to just forward ConnectionDropped exceptions for the other two cases as well.

It isn't very easy to test this case, as it requires a ConnectionDropped to occur while in a write. We will be testing this change on our production servers over the next couple weeks to see if it fixes the (rare) issue.

connections. In the _send_request method there are three places in which the
_submit method is called. Two of them happen in the body of the "try", while
the third happens in the exception handler for self.handler.empty exceptions.
If the connection is dropped in either of the first two calls to _submit, it
triggers the "except Exception" handler, which causes the method to return
False, thereby triggering the writer thread/greenlet to shut down. The other
call to _submit is already in an exception handler, so if it raises a
ConnectionDropped it is handled in the _connect_loop, which is what should
happen. The straightforward fix is to just forward ConnectionDropped exceptions
for the other two cases as well.
@hannosch
Copy link
Contributor

hannosch commented Jan 2, 2013

Looks good, I committed your patch including a test. The test asynchronously sets a node value to a large value (~1mb) and shuts down the ZK server at the same time. It's not 100% perfect, but triggers often enough to fail on a couple of the 14 different setup combinations we test for.

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