I am trying to configure vimspector for remote debugging Python Django application running in a Docker container and when starting the debugger become following error:
Channel is already running
Error detected while processing function vimspector#Continue[4]..function vimspector#Continue:
line 4:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "~/.vim/pack/vimspector/opt/vimspector/python3/vimspector/debug_session.py", line 473, in Continue
self.Start()
File "~/.vim/pack/vimspector/opt/vimspector/python3/vimspector/debug_session.py", line 277, in Start
self._StartWithConfiguration( configuration, adapter )
File "~/.vim/pack/vimspector/opt/vimspector/python3/vimspector/debug_session.py", line 322, in _StartWithConfiguration
start()
File "~/.vim/pack/vimspector/opt/vimspector/python3/vimspector/debug_session.py", line 295, in start
self._Initialise()
File "~/.vim/pack/vimspector/opt/vimspector/python3/vimspector/debug_session.py", line 972, in _Initialise
self._connection.DoRequest( handle_initialize_response, {
AttributeError: 'NoneType' object has no attribute 'DoRequest'
Here is my .vimspector.json
config file (mostly inspired by this example from vimspector documentation):
{
"adapters": {
"python-remote": {
"port": "${port}",
"launch": {
"remote": {
"container": "${container}",
"launchCommmand": [
"python", "-m", "debugpy", "--listen", "0.0.0.0:${port}",
"%CMD"
]
}
},
"attach": {
"remote": {
"container": "${container}",
"pidCommand": [
"sh", "-c", "pgrep", "-f", "${filename}"
],
"attachCommand": [
"sh", "-c", "python", "-m", "debugpy", "--listen", "0.0.0.0:${port}",
"--pid", "%PID%"
]
}
}
}
},
"configurations": {
"remote-launch": {
"adapter": "python-remote",
"remote-request": "launch",
"remote-cmdLine": [
"${RemoteRoot}/${fileBasename}", "*${args}"
],
"configuration": {
"request": "attach",
"pathMappings": [
{
"localRoot": "${workspaceRoot}",
"remoteRoot": "${RemoteRoot}"
}
]
}
},
"remote-attach": {
"adapter": "python-remote",
"remote-request": "attach",
"configuration": {
"request": "attach",
"pathMappings": [
{
"localRoot": "${workspaceRoot}",
"remoteRoot": "${RemoteRoot}"
}
]
}
}
}
}
Any ideas what could be causing?
The traceback is clearly a bug. Please see Vimspector's CONTRIBUTING.md for how to report a reproducible test case for that.
I suspect the issue is that it's not successfully starting the debug adapter, then fails to connect to it and gets itself in a mess.
You may be able to "clear" the mess with a :VimspectorReset, but it might be that restarting vim is the only way to clear the mess in vimspector's state.
Regarding why it's failing to connect, that's less clear. We'd need to know the exact steps you took to get there, etc. Best to seek support for Vimspector in the Gitter channel.
Note that when using containers, the container has to already be running. You tell vimspector the Container ID and it just does docker exec
using that ID. Vimspector isn't a container orchestration system, it's just able to run ssh
and docker exec
commands for you to help automate some parts of the debugging process.