From 5491e93d95e1dcde6de541f3e8a3452c9a0523d1 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Thu, 18 Jun 2015 16:55:01 -0700 Subject: Do not raise RetryIOError on blocked write When EAGAIN is returned on a socket write, do not raise RetryIOError. This exception is used principally to indicate that we have encountered a blocked read, and a method farther up the call stack may need to perform some cleanup. However, within the sendQueuedData method, all necessary cleanup is performed by the finally handler itself. Therefore, it is safe to ignore a blocked write, and count on either a subsequent write (which will append data to the queue and retry sending the oldest data) or the poll edge trigger to indicate that we should retry the write. There is nothing in the call stack above this method that has an exception handler for RetryIOError. Therefore, in the current state, the raised exception was causing connections to be disconnected due to the error. Change-Id: I9211fb6365f8f3b6dd0310430cf97926ce1f5d07 --- gear/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gear/__init__.py b/gear/__init__.py index 51c0c91..a4b8e23 100644 --- a/gear/__init__.py +++ b/gear/__init__.py @@ -2346,8 +2346,8 @@ class NonBlockingConnection(Connection): if e.errno == errno.EAGAIN: self.log.debug("Write operation on %s would block" % self) - raise RetryIOError() - raise + else: + raise finally: data = data[r:] if data: -- cgit v1.2.1