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

address already in use #2

Open
anizeani opened this issue Jun 17, 2021 · 0 comments
Open

address already in use #2

anizeani opened this issue Jun 17, 2021 · 0 comments

Comments

@anizeani
Copy link

I watched the "Best Practices for Compose-managed Python Apps", thx for that! super informative and helpful.

I then tried to follow the same steps to debug the
project I'm working on: https://github.com/encointer/polkascan-os
My goal is to debug the explorer-api, which is a falcon (python) app.

So I:

  1. added the port 5678 in the docker-compose file.
  2. added the entry ptvsd==4.3.2 in the requirements.txt file
  3. added the code snipped ptvsd.enable_attach(address=('0.0.0.0',5678)) // why 0.0.0.0 here?
  4. docker-compose build and than docker-compose up
  5. in vscode, I added the configuration file with "localRoot": "${workspaceFolder}/explorer-api/app" and
    "remoteRoot": "/usr/src/app/app/" // here I add the folder that points to main.py, is this correct?

The error I'm getting is: OSError: [Errno 98] Address already in use

I struggle to understand, where the problem is, I guess somehow this port is already in use, but if i change the port, the same error appears which leads me to think, that somehow the debugger or so creates 2 instances that try to connect to that port.

I'm not sure this is the correct place to file the issue, if somebody knows a solution or a better place to get answers to my question, I'd be very thankful.

Here is the error message trace log (i get it 3x):

ptvsd.enable_attach(address=('0.0.0.0',5678))

File "/usr/local/lib/python3.8/site-packages/ptvsd/attach_server.py", line 101, in enable_attach
ptvsd_enable_attach(address)
File "/usr/local/lib/python3.8/site-packages/ptvsd/_remote.py", line 76, in enable_attach
pydevd.settrace(host=host,
File "/usr/local/lib/python3.8/site-packages/ptvsd/_vendored/pydevd/pydevd.py", line 2169, in settrace
_locked_settrace(
File "/usr/local/lib/python3.8/site-packages/ptvsd/_vendored/pydevd/pydevd.py", line 2230, in _locked_settrace
debugger.connect(host, port) # Note: connect can raise error.
File "/usr/local/lib/python3.8/site-packages/ptvsd/_vendored/pydevd/pydevd.py", line 1060, in connect
s = start_client(host, port)
File "/usr/local/lib/python3.8/site-packages/ptvsd/pydevd_hooks.py", line 136, in _start_client
return start_client(daemon, h, p)
File "/usr/local/lib/python3.8/site-packages/ptvsd/_remote.py", line 62, in
start_client=(lambda daemon, h, port: start_daemon()),
File "/usr/local/lib/python3.8/site-packages/ptvsd/_remote.py", line 50, in start_daemon
_, next_session = daemon.start_server(addr=(host, port))
File "/usr/local/lib/python3.8/site-packages/ptvsd/daemon.py", line 161, in start_server
self._server = create_server(addr.host, addr.port)
File "/usr/local/lib/python3.8/site-packages/ptvsd/socket.py", line 79, in create_server
server.bind((host, port))
OSError: [Errno 98] Address already in use

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant