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

Connection to Dev Container intermittently lost #10569

Open
johnmdusel opened this issue Dec 15, 2024 · 7 comments
Open

Connection to Dev Container intermittently lost #10569

johnmdusel opened this issue Dec 15, 2024 · 7 comments
Assignees
Labels
containers Issue in vscode-remote containers info-needed Issue requires more information from poster

Comments

@johnmdusel
Copy link

Does this issue occur when all extensions are disabled?: Yes/No

  • VS Code Version: 1.96.0 138f619c86f1199955d53b4166bef66ef252935c x64. I've seen this issue on VS Code instances installed through snap and through apt.
  • OS Version: Ubuntu 20.04.6

Steps to Reproduce:

  1. Open folder and build Dev Container
  2. Reopen folder in Container
  3. Perform routine development tasks. In my case the language is Python. Edit a file. Run a script from the terminal. Run a script in the Python debugger.
  4. Intermittently, the message "Reconnecting to Dev Container" shows in the lower left corner of the VS Code pane. Example of message appearing in container log:
    ======== start =======
    [161127 ms] Start: Reconnection attempt 1
    [161128 ms] CLIHost does not need reconnection.
    [161129 ms] Start: Run: docker inspect --type container 315831e858149a72f63101097d833d73c66ab3eb8d8f02fec8601e20dedf2a29
    [161201 ms] Port forwarding connection from 39044 > 38885 > 38885 in the container.
    [161203 ms] Start: Run in container: /home/dusel/.vscode-server/bin/138f619c86f1199955d53b4166bef66ef252935c/node -e
    [161474 ms] Port forwarding 39044 > 38885 > 38885 stderr: Error: connect ECONNREFUSED 127.0.0.1:38885
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1611:16)
    [161475 ms] Port forwarding 39044 > 38885 > 38885 stderr: Remote close with error
    [161487 ms] Port forwarding 39044 > 38885 > 38885 terminated with code 1 and signal null.
    [161488 ms] Port forwarding 39044 > 38885 > 38885: Local close
    [161497 ms] Port forwarding connection from 39068 > 38885 > 38885 in the container.
    [161498 ms] Start: Run in container: /home/dusel/.vscode-server/bin/138f619c86f1199955d53b4166bef66ef252935c/node -e
    [161809 ms] Port forwarding 39068 > 38885 > 38885 stderr: Error: connect ECONNREFUSED 127.0.0.1:38885
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1611:16)
    [161810 ms] Port forwarding 39068 > 38885 > 38885 stderr: Remote close with error
    [161824 ms] Port forwarding 39068 > 38885 > 38885 terminated with code 1 and signal null.
    [161825 ms] Port forwarding 39068 > 38885 > 38885: Local close
    ===== end =====

I've tried the following fixes. None of them have consistently resolved the issue

  1. With VS Code running, in a terminal session outside VS Code enter docker ps followed by docker kill <name>. This prompts a window reload within VS Code. The "reconnecting" message disappears but comes back eventually.
  2. Exit VS Code. In a terminal session enter docker container rm -f <name>. Restart VS Code and, from the command palette, run "Rebuild without Caching and Open in Container.". The container rebuild proceeds normally, but the "reconnecting" message comes back eventually.
@chrmarti
Copy link
Contributor

Please append the full Dev Containers log from when this happens. (F1 > Dev Containers: Show Container Log)

@chrmarti chrmarti added the info-needed Issue requires more information from poster label Dec 17, 2024
@chrmarti chrmarti transferred this issue from microsoft/vscode Dec 17, 2024
@chrmarti chrmarti added the containers Issue in vscode-remote containers label Dec 17, 2024
@johnmdusel
Copy link
Author

johnmdusel commented Dec 17, 2024

Contents of log file attached.devcontainerlog.txt

@chrmarti
Copy link
Contributor

It looks like the server stopped accepting connections. Please check its log file when this happens again:

  • Reload the window to reconnect.
  • Go to ~/.vscode-server/data/logs.
  • Check which of the subfolders is from the previous session (they are named by timestamp) and go into that.
  • Check the remoteagent.log and share it here.
  • exthost*/remoteexthost.log might also be of interest.

@fkfouri
Copy link

fkfouri commented Dec 21, 2024

This problem happens to me all the time. The test explorer and run and debug stop working. I have to reopen the VS Code.

My DevContainerlog is:

[564350 ms] Port forwarding connection from 49309 > 35925 > 35925 in the container.
[564350 ms] Start: Run in Host: docker exec -i -u fkfouri -e VSCODE_REMOTE_CONTAINERS_SESSION=dc9c8378-1502-4b8c-857a-25522369b7f31734781986684 b1b0b9d27cc628a6420ad70416a4c6d93d556af712daada03f0b013e0cbdbc08 /home/fkfouri/.vscode-server/bin/138f619c86f1199955d53b4166bef66ef252935c/node -e 
[564470 ms] Port forwarding 49311 > 35925 > 35925 stderr: Connection established
[564476 ms] Port forwarding 49309 > 35925 > 35925 stderr: Connection established
[564496 ms] Port forwarding 49308 > 35925 > 35925 stderr: Connection established
[564496 ms] Port forwarding 49310 > 35925 > 35925 stderr: Connection established
[570477 ms] Port forwarding 49311 > 35925 > 35925 stderr: Remote close
[570490 ms] Port forwarding 49311 > 35925 > 35925 terminated with code 0 and signal null.
[570502 ms] Port forwarding 49309 > 35925 > 35925 stderr: Remote close
[570503 ms] Port forwarding 49310 > 35925 > 35925 stderr: Remote close
[570503 ms] Port forwarding 49308 > 35925 > 35925 stderr: Remote close
[570517 ms] Port forwarding 49308 > 35925 > 35925 terminated with code 0 and signal null.
[570518 ms] Port forwarding 49310 > 35925 > 35925 terminated with code 0 and signal null.
[570520 ms] Port forwarding 49309 > 35925 > 35925 terminated with code 0 and signal null.
[690488 ms] Port forwarding 49311 > 35925 > 35925: Local close with error
[690516 ms] Port forwarding 49308 > 35925 > 35925: Local close with error
[690533 ms] Port forwarding 49310 > 35925 > 35925: Local close with error
[690535 ms] Port forwarding 49309 > 35925 > 35925: Local close with error
[875127 ms] Start: Run in container: cat /proc/93901/environ

@chrmarti
Copy link
Contributor

Since you mention Python: Could you try updating to the latest pre-release version of the Python extension to get a fix for a known issue? (microsoft/vscode-copilot-release#3357)

@johnmdusel
Copy link
Author

Contents of ~/.vscode-server/data/logs. from a session that disconnected.

2024-12-22 12:37:14.842 [info] 




2024-12-22 12:37:14.869 [info] Extension host agent started.
2024-12-22 12:37:15.010 [debug] No uninstalled extensions found.
2024-12-22 12:37:15.051 [info] [127.0.0.1][d8ca9e31][ManagementConnection] New connection established.
2024-12-22 12:37:15.117 [info] Log level changed to info
2024-12-22 12:37:15.349 [info] [127.0.0.1][f6e862c9][ExtensionHostConnection] New connection established.
2024-12-22 12:37:15.360 [info] [127.0.0.1][f6e862c9][ExtensionHostConnection] <296> Launched Extension Host Process.

The instruction "exthost*/remoteexthost.log might also be of interest" is cryptic to me. Can you please give more detail on that path?

@johnmdusel
Copy link
Author

Since you mention Python: Could you try updating to the latest pre-release version of the Python extension to get a fix for a known issue? (microsoft/vscode-copilot-release#3357)

I installed the Pre-Release version in the dev container using the extensions pane and reloaded the window. The dev container connection was immediately dropped, so I reloaded the window.

Attempting to run a Python script using the debugger causes the connection to drop again. I also see "Discovering Python interpreters" at the bottom of the window.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
containers Issue in vscode-remote containers info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

4 participants