Skip to content

login command says "address already in use" but does not provide useful information #501

@chmreid

Description

@chmreid

When running the hca dss login command, I saw the following error message raised:

$ hca dss login
Traceback (most recent call last):
  File "/Users/charles/.pyenv/versions/miniconda3-4.3.30/bin/hca", line 10, in <module>
    sys.exit(main())
  File "/Users/charles/.pyenv/versions/miniconda3-4.3.30/lib/python3.6/site-packages/hca/cli.py", line 134, in main
    result = parsed_args.entry_point(parsed_args)
  File "/Users/charles/.pyenv/versions/miniconda3-4.3.30/lib/python3.6/site-packages/hca/util/__init__.py", line 587, in arg_forwarder
    return command(**command_args)
  File "/Users/charles/.pyenv/versions/miniconda3-4.3.30/lib/python3.6/site-packages/hca/util/__init__.py", line 391, in login
    credentials = flow.run_local_server(success_message=msg, audience=self._audience)
  File "/Users/charles/.pyenv/versions/miniconda3-4.3.30/lib/python3.6/site-packages/google_auth_oauthlib/flow.py", line 443, in run_local_server
    host, port, wsgi_app, handler_class=_WSGIRequestHandler)
  File "/Users/charles/.pyenv/versions/miniconda3-4.3.30/lib/python3.6/wsgiref/simple_server.py", line 153, in make_server
    server = server_class((host, port), handler_class)
  File "/Users/charles/.pyenv/versions/miniconda3-4.3.30/lib/python3.6/socketserver.py", line 453, in __init__
    self.server_bind()
  File "/Users/charles/.pyenv/versions/miniconda3-4.3.30/lib/python3.6/wsgiref/simple_server.py", line 50, in server_bind
    HTTPServer.server_bind(self)
  File "/Users/charles/.pyenv/versions/miniconda3-4.3.30/lib/python3.6/http/server.py", line 136, in server_bind
    socketserver.TCPServer.server_bind(self)
  File "/Users/charles/.pyenv/versions/miniconda3-4.3.30/lib/python3.6/socketserver.py", line 467, in server_bind
    self.socket.bind(self.server_address)
OSError: [Errno 48] Address already in use

At the time I had a Python simple http server running on port 8000, a Jupyter notebook running on port 8888, and a third python process on 8080. (it turns out 8080 was the problem port that the HCA CLI wanted to use.)

First, the hca login should not require the specific port 8080 to be open/reserved, since there are tens of thousands of ports available for use on a given machine. (In dss.utils there is a get_random_unused_tcp_port() method that would do this.)

Second, if the port that hca login chose is already in use, the command should at least print information about what port number is in use, so that the user can determine what process is running on that port and kill it. As is, there is no information provided to the user in the error message about which port/address is in use.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions