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
>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
>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
>although an attempt to simulate this still doesn't get EINVAL:
>$ cat
>import socket
>s = socket.create_connection(("", 22))
>$ python3.7
><socket.socket fd=3, family=AddressFamily.AF_INET,
>type=SocketKind.SOCK_STREAM, proto=6, laddr=('', 62722),
>raddr=('', 22)>
><socket.socket [closed] fd=-1, family=AddressFamily.AF_INET,
>type=SocketKind.SOCK_STREAM, proto=6>
>Traceback (most recent call last):
> File "", 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
>Could the socket maybe a listening socket or something? (just wild
>You received this bug notification because you are subscribed to
> Some tests failing due to shutdown(2) returning EINVAL
>To manage notifications about this bug go to: