On Tue, Aug 07, 2018 at 05:07:58PM +0530, [email protected] wrote:
> From: Numan Siddique <[email protected]>
> 
> The python function ovs.socket_util.check_connection_completion() uses 
> select()
> (provided by python) to monitor the socket file descriptor. The select()
> returns 1 when the file descriptor becomes ready. For error cases like -
> 111 (Connection refused) and 113 (No route to host) (POLLERR), 
> ovs.poller._SelectSelect.poll()
> expects the exceptfds list to be set by select(). But that is not the case.
> As per the select() man page, writefds list will be set for POLLERR.
> Please see "Correspondence between select() and poll() notifications" section 
> of select(2)
> man page.
> 
> Because of this behavior, ovs.socket_util.check_connection_completion() 
> returns success
> even if the remote is unreachable or not listening on the port.
> 
> This patch fixes this issue by using poll() to check the connection status 
> similar to
> the C implementation of check_connection_completion().
> 
> A new function 'get_system_poll() is added in ovs/poller.py which returns the
> select.poll() object. If select.poll is monkey patched by eventlet/gevent, it
> gets the original select.poll() and returns it.
> 
> The test cases added in this patch fails without the fix.
> 
> Suggested-by: Ben Pfaff <[email protected]>
> Signed-off-by: Numan Siddique <[email protected]>

Thanks.

I had to fold in the following to placate flake8:

diff --git a/python/ovs/poller.py b/python/ovs/poller.py
index ef67e6763237..9c6892d98e97 100644
--- a/python/ovs/poller.py
+++ b/python/ovs/poller.py
@@ -37,6 +37,7 @@ try:
         return eventlet_patcher.is_monkey_patched(select)
 except:
     eventlet_patcher = None
+
     def _using_eventlet_green_select():
         return False
 
@@ -266,15 +267,15 @@ class Poller(object):
         self.timeout = -1
 
 
-"""
-Returns the original select.poll() object. If select.poll is monkey patched
-by eventlet or gevent library, it gets the original select.poll and returns
-an object of it using the eventlet.patcher.original/gevent.monkey.get_original
-functions.
-
-As a last resort, if there is any exception it returns the SelectPoll() object.
-"""
 def get_system_poll():
+    """Returns the original select.poll() object. If select.poll is
+    monkey patched by eventlet or gevent library, it gets the original
+    select.poll and returns an object of it using the
+    eventlet.patcher.original/gevent.monkey.get_original functions.
+
+    As a last resort, if there is any exception it returns the
+    SelectPoll() object.
+    """
     try:
         if _using_eventlet_green_select():
             _system_poll = eventlet_patcher.original("select").poll
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to