Comment 2 for bug 1849971

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

On Sat, Oct 26, 2019 at 04:44:41PM -0000, Olaf Seibert wrote:
> Public bug reported:
>
> I am preparing a package of breezy 3.0.1 on NetBSD's pkgsrc. I am using
> NetBSD/amd64 8.1 and Python 3.7.4.
>
> Several of the tests fail with the same or very similar stack traces:
>
> ```
> ...ary.test_symlink_content_summary(WorkingTreeFormat6,remote)ERROR 69ms
> log: {{{
> 1281.701 creating repository in chroot-132261157529056:///tree/.bzr/.
> 1281.705 creating branch <breezy.bzr.branch.BzrBranchFormat8 object at 0x784a6b0a60a0> in chroot-132261157529056:///tree/
> 1281.712 creating branch reference in file:///mnt/scratch/scratch/tmp/testbzr-u569akfo.tmp/breezy.tests.per_tree.test_path_content_summary.TestPathContentSummary.test_symlink_content_summary%28WorkingTreeFormat6%2Cremote%29/work/tree/
> 1281.730 trying to create missing lock '/mnt/scratch/scratch/tmp/testbzr-u569akfo.tmp/breezy.tests.per_tree.test_path_content_summary.TestPathContentSummary.test_symlink_content_summary(WorkingTreeFormat6,remote)/work/tree/.bzr/checkout/dirstate'
> 1281.731 opening working tree '/mnt/scratch/scratch/tmp/testbzr-u569akfo.tmp/breezy.tests.per_tree.test_path_content_summary.TestPathContentSummary.test_symlink_content_summary(WorkingTreeFormat6,remote)/work/tree'
> }}}
>
> Traceback (most recent call last):
> File "/home/tmp/devel/breezy/work.x86_64/breezy-3.0.1/breezy/tests/test_server.py", line 702, in stop_server
> super(SmartTCPServer_for_testing, self).stop_server()
> File "/home/tmp/devel/breezy/work.x86_64/breezy-3.0.1/breezy/tests/test_server.py", line 571, in stop_server
> self.server.stop_client_connections()
> File "/home/tmp/devel/breezy/work.x86_64/breezy-3.0.1/breezy/tests/test_server.py", line 375, in stop_client_connections
> self.shutdown_client(c)
> File "/home/tmp/devel/breezy/work.x86_64/breezy-3.0.1/breezy/tests/test_server.py", line 480, in shutdown_client
> self.shutdown_socket(sock)
> File "/home/tmp/devel/breezy/work.x86_64/breezy-3.0.1/breezy/tests/test_server.py", line 384, in shutdown_socket
> sock.shutdown(socket.SHUT_RDWR)
> OSError: [Errno 22] Invalid argument
> ```
> I'm not sure why this errno is returned from shutdown, but I suppose for the purposes of the test it can be ignored. (Unless you're passing the wrong file descriptor or something, or there is some bug in Python with the definition of SHUT_RDWR,)

We're not hitting this on Linux (and we run the test suite there quite
a lot). I suspect this is a behaviour in the underlying shutdown()
implementation on NetBSD and Linux.

The Linux manpage for shutdown has a BUGS section that says:

Checks for the validity of how are done in domain-specific code, and
before Linux 3.7 not all domains performed these checks. Most
notably, UNIX domain sockets simply ignored invalid values. This
problem was fixed for UNIX domain sockets in Linux 3.7.

I also wonder passing a socket that's already shutdown perhaps results
in EINVAL.

Jelmer

--
Jelmer Vernooij <email address hidden>
PGP Key: https://www.jelmer.uk/D729A457.asc