Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nrunner should have a back up plan for when port 8888 is taken #5550

Open
verdog opened this issue Dec 14, 2022 · 2 comments
Open

nrunner should have a back up plan for when port 8888 is taken #5550

verdog opened this issue Dec 14, 2022 · 2 comments

Comments

@verdog
Copy link

verdog commented Dec 14, 2022

Is your feature request related to a problem? Please describe.
Multiple people on my team use avocado 99.0 on a shared development server. Only one of us can run a test suite at once because the status server (?) always binds to port 8888 with no backup plan.

If multiple people try to run tests, someone will see this:

Task exception was never retrieved
future: <Task finished coro=<StatusServer.serve_forever() done, defined at /.../avocado-virtual-environment/avocado/lib/python3.6/site-packages/avocado/core/status/server.py:41> exception=OSError(98, "error while attempting to bind on address ('127.0.0.1', 8888): address already in use")>
Traceback (most recent call last):
  File "/usr/lib64/python3.6/asyncio/base_events.py", line 1073, in create_server
    sock.bind(sa)
OSError: [Errno 98] Address already in use

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/.../avocado-virtual-environment/avocado/lib/python3.6/site-packages/avocado/core/status/server.py", line 43, in serve_forever
    await self.create_server()
  File "/.../avocado-virtual-environment/avocado/lib/python3.6/site-packages/avocado/core/status/server.py", line 34, in create_server
    self.cb, host=host, port=port, limit=limit
  File "/usr/lib64/python3.6/asyncio/streams.py", line 119, in start_server
    return (yield from loop.create_server(factory, host, port, **kwds))
  File "/usr/lib64/python3.6/asyncio/base_events.py", line 1077, in create_server
    % (sa, err.strerror.lower()))
OSError: [Errno 98] error while attempting to bind on address ('127.0.0.1', 8888): address already in use

Describe the solution you'd like
If the user hasn't specified any specific options with --status-server-listen etc. and binding on port 8888 fails, try another port.

Describe alternatives you've considered
--status-server-disable-auto --status-server-listen 127.0.0.1:8889 --status-server-uri 127.0.0.1:8889 works but is impractical.

@clebergnu
Copy link
Contributor

Hi @verdog ,

Yes, this makes sense. My suggestion is that we add support for specifying a port range in addition to a single port. For instance, one could define:

--status-server-listen 127.0.0.1:8888-9000

The tricky part is that most times a user wants listen and uri to match, but that is not always true. Maybe we can add another behavior where, if uri is set to the same value (including the port range) of the listen parameter, then we will automatically match them.

How does that sound?

@verdog
Copy link
Author

verdog commented Dec 14, 2022

I like that. The most important thing for my use case in particular would be to make the auto behavior be equal to a range like that by default, without any extra flags.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Long Term (Next Q) Backlog
Development

No branches or pull requests

2 participants