Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.