qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] tests/qemu_iotests: Minimize usage of used ports


From: Max Reitz
Subject: Re: [PATCH] tests/qemu_iotests: Minimize usage of used ports
Date: Thu, 6 Feb 2020 16:03:35 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

On 03.02.20 08:59, Lukáš Doktor wrote:
> Using a range of ports from 32768 to 65538 is dangerous as some
> application might already be listening there and interfere with the
> testing. There is no way to reserve ports, but let's decrease the chance
> of interactions by only using ports that were free at the time of
> importing this module.
> 
> Without this patch CI occasionally fails with used ports. Additionally I
> tried listening on the first port to be tried via "nc -l localhost
> $port" and no matter how many other ports were available it always
> hanged for infinity.

I’m afraid I don’t quite understand.  The new functions check whether
the ports are available for use by creating a server on them (i.e.,
binding a socket there).  The current code just lets qemu create a
server there, and see if that works or not.

So the only difference I can see is that instead of trying out random
ports during the test and see whether they’re free to use we do this
check only once when the test is started.

And the only problem I can imagine from your description is that there
is some other tool on the system that tries to set up a server but
cannot because we already have an NBD server there (by accident).

But I don’t see how checking for free ports once at startup solves that
problem reliably.

If what I guessed above is right, the only reliable solution I can
imagine would be to allow users to specify the port range through
environment variables, and then you’d have to specify a range that you
know is free for use.

Max




reply via email to

[Prev in Thread] Current Thread [Next in Thread]