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

Ben Pfaff blp at ovn.org
Mon Jul 9 18:06:04 UTC 2018


On Sun, Jul 08, 2018 at 10:05:41PM +0530, nusiddiq at redhat.com wrote:
> From: Numan Siddique <nusiddiq at redhat.com>
> 
> Calling ovs.stream.open_block(ovs.stream.open("tcp:127.0.0.1:6641")) returns
> success even if there is no server listening on 6641. To check if the connection
> is established or not, Stream class makes use of ovs.socket_util.check_connection_completion().
> This function returns zero if the select for the socket fd signals. It doesn't
> really check if the connection was established or not.
> 
> 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>

I don't understand the problem here.  I mean, I believe when you say
there is a problem, but the cause doesn't really make sense to me.  The
code for check_connection_completion in socket_util.py looks correct to
me and equivalent to the C implementation in socket-util.c.  Do you have
an idea of why it doesn't work properly?  (Is it somehow specific to
Python?)

I don't think we have an equivalent test for the C version.  Does it
pass, or does it need a similar change?

Thanks,

Ben.


More information about the dev mailing list