On 20.12.2018 21:10, Ben Pfaff wrote: > On Thu, Dec 20, 2018 at 08:36:39PM +0300, Ilya Maximets wrote: >> Otherwise failed non-blocking connection reported as connected. >> This causes errors in all following operations with the socket. >> >> For example, ovsdb-idl tests fails with the following error trying >> to send data to the 'WRONG_PORT_1': >> >> stderr: >> jsonrpc transaction failed: Broken pipe >> >> This happens because dispite of SelectPoll, select.poll could >> return POLLHUP without POLLERR set. >> >> This fixes tests on FreeBSD. >> >> CC: Numan Siddique <[email protected]> >> Fixes: c1aa16d191d2 ("ovs python: ovs.stream.open_block() returns success >> even if the remote is unreachable") >> Signed-off-by: Ilya Maximets <[email protected]> >> --- >> python/ovs/socket_util.py | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/python/ovs/socket_util.py b/python/ovs/socket_util.py >> index 8e582fe91..2596ddefd 100644 >> --- a/python/ovs/socket_util.py >> +++ b/python/ovs/socket_util.py >> @@ -178,7 +178,7 @@ def check_connection_completion(sock): >> pfds = p.poll(0) >> if len(pfds) == 1: >> revents = pfds[0][1] >> - if revents & ovs.poller.POLLERR: >> + if revents & ovs.poller.POLLERR or revents & ovs.poller.POLLHUP: >> try: >> # The following should raise an exception. >> sock.send("\0".encode(), socket.MSG_DONTWAIT) > > Thanks for the fix. > > I'm surprised to see this for the Python library but not for the very > similar code in check_connection_completion() in lib/socket-util.c. Do > we need the same fix there?
Hmm. Yes, you right. There is exactly same issue. I can reproduce it. I'll send v2 including the same fix for C code and a CHECK_STREAM_OPEN_BLOCK test for it. Best regards, Ilya Maximets. _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
