Comment 7 for bug 1849971

Revision history for this message
Jelmer Vernooij (jelmer) wrote : Re: [Bug 1849971] Re: Some tests failing due to shutdown(2) returning EINVAL

fd=-1 ? That doesn't seem right

On 26 October 2019 19:51:01 BST, Olaf Seibert <email address hidden> wrote:
>Oh, if you close() the socket before the shutdown, it results in
>"OSError: [Errno 9] Bad file descriptor", so that is not what is
>happening.
>
>I'll be happy to just stub out the call do shutdown() if it takes too
>long to find a root cause here. But maybe I found something: I stuck a
>pdb.set_trace() just before the shutdown(), and it seems that the
>socket
>object is not quite as expected:
>
>(Pdb) sock
><socket.socket [closed] fd=-1, family=AddressFamily.AF_INET,
>type=SocketKind.SOCK_STREAM, proto=0>
>(Pdb) sock._io_refs
>0
>
>although an attempt to simulate this still doesn't get EINVAL:
>
>$ cat sock.py
>import socket
>
>s = socket.create_connection(("127.0.0.1", 22))
>print(s)
>s.detach()
>print(s)
>s.shutdown(socket.SHUT_RDWR)
>$ python3.7 sock.py
><socket.socket fd=3, family=AddressFamily.AF_INET,
>type=SocketKind.SOCK_STREAM, proto=6, laddr=('127.0.0.1', 62722),
>raddr=('127.0.0.1', 22)>
><socket.socket [closed] fd=-1, family=AddressFamily.AF_INET,
>type=SocketKind.SOCK_STREAM, proto=6>
>Traceback (most recent call last):
> File "sock.py", line 7, in <module>
> s.shutdown(socket.SHUT_RDWR)
>OSError: [Errno 9] Bad file descriptor
>
>Another difference is proto=6 in the my test versus proto=0 in the real
>case.
>
>Could the socket maybe a listening socket or something? (just wild
>guesswork)
>
>-Olaf.
>
>--
>You received this bug notification because you are subscribed to
>Breezy.
>https://bugs.launchpad.net/bugs/1849971
>
>Title:
> Some tests failing due to shutdown(2) returning EINVAL
>
>To manage notifications about this bug go to:
>https://bugs.launchpad.net/brz/+bug/1849971/+subscriptions