[ovs-dev] [PATCH 1/2] ovs python: ovs.stream.open_block() returns success even if the remote is unreachable

Ben Pfaff blp at ovn.org
Tue Jul 10 20:38:47 UTC 2018


On Wed, Jul 11, 2018 at 12:56:39AM +0530, nusiddiq at redhat.com wrote:
> From: Numan Siddique <nusiddiq at redhat.com>
> 
> 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 adding a wrapper function - check_connection_completion_status()
> which calls sock.connect_ex() to get the status of the connection if
> ovs.socket_util.check_connection_completion() returns success.
> 
> The test cases added fails without the fix in this patch.
> 
> Signed-off-by: Numan Siddique <nusiddiq at redhat.com>

Can we just code check_connection_completion() like we do in C, by
directly using select() on Windows and poll() everywhere else?  The
approach in this patch seems a little indirect to me.

Thanks,

Ben.


More information about the dev mailing list