dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.86k stars 672 forks source link

Port conflicts when debugging on MacOS #4952

Open badsyntax opened 2 years ago

badsyntax commented 2 years ago

Issue Description

Steps to Reproduce

Note that this behaviour only starting occurring in the past couple weeks.

Expected Behavior

Actual Behavior

Some random "Google" service (perhaps related to the debugger?) start listening on the same app port which causes a port conflict and the .NET app does not respond.

See:

❯ lsof -i :6001     
COMMAND     PID          USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
Google    81023 richardwillis   32u  IPv6 0xf8f89ab85c47340b      0t0  TCP localhost:57342->localhost:6001 (ESTABLISHED)
Google    81023 richardwillis   49u  IPv6 0xf8f89ab85c4720eb      0t0  TCP localhost:57411->localhost:6001 (ESTABLISHED)
Google    81023 richardwillis   51u  IPv6 0xf8f89ab86279c0cb      0t0  TCP localhost:57412->localhost:6001 (ESTABLISHED)
Google    81023 richardwillis   54u  IPv6 0xf8f89ab85c4ccdcb      0t0  TCP localhost:57414->localhost:6001 (ESTABLISHED)
dotnet    81073 richardwillis  121u  IPv6 0xf8f89ab85c47142b      0t0  TCP localhost:6001->localhost:57737 (CLOSE_WAIT)
dotnet    81073 richardwillis  314u  IPv4 0xf8f89ab85b49efc3      0t0  TCP localhost:6001 (LISTEN)
dotnet    81073 richardwillis  315u  IPv6 0xf8f89ab85c4740cb      0t0  TCP localhost:6001 (LISTEN)
dotnet    81073 richardwillis  319u  IPv6 0xf8f89ab85c471a8b      0t0  TCP localhost:6001->localhost:57342 (ESTABLISHED)
dotnet    81073 richardwillis  328u  IPv6 0xf8f89ab85c473a6b      0t0  TCP localhost:6001->localhost:57411 (ESTABLISHED)
dotnet    81073 richardwillis  329u  IPv6 0xf8f89ab86279942b      0t0  TCP localhost:6001->localhost:57412 (ESTABLISHED)
dotnet    81073 richardwillis  330u  IPv6 0xf8f89ab85c4d00cb      0t0  TCP localhost:6001->localhost:57413 (CLOSE_WAIT)
dotnet    81073 richardwillis  331u  IPv6 0xf8f89ab85c4cd42b      0t0  TCP localhost:6001->localhost:57414 (ESTABLISHED)

Note it does not matter what port the app starts on.

To fix, I have to manually kill both the dotnet process and the Google process. I'm almost at a point now where I cannot use VS Code to do .NET dev on a Mac anymore due to this bug. Any suggestions would be greatly appreciated.

Logs

OmniSharp log

Post the output from Output-->OmniSharp log here

C# log

Post the output from Output-->C# here

Environment information

VSCode version: 1.63.0 C# Extension: 1.23.17

Mono Information OmniSharp using global mono :6.12.0
Dotnet Information .NET SDK (reflecting any global.json): Version: 6.0.100 Commit: 9e8b04bbff Runtime Environment: OS Name: Mac OS X OS Version: 11.6 OS Platform: Darwin RID: osx.11.0-arm64 Base Path: /usr/local/share/dotnet/sdk/6.0.100/ Host (useful for support): Version: 6.0.0 Commit: 4822e3c3aa .NET SDKs installed: 6.0.100 [/usr/local/share/dotnet/sdk] .NET runtimes installed: Microsoft.AspNetCore.App 6.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] To install additional .NET runtimes or SDKs: https://aka.ms/dotnet-download
Visual Studio Code Extensions |Extension|Author|Version| |---|---|---| |azure-account|ms-vscode|0.9.11| |azure-pipelines|ms-azure-devops|1.195.0| |bash-debug|rogalmic|0.3.9| |bats|jetmartin|0.1.8| |code-spell-checker|streetsidesoftware|2.0.13| |cpptools|ms-vscode|1.7.1| |csharp|ms-dotnettools|1.23.17| |debugger-for-chrome|msjsdiag|4.13.0| |dotenv|mikestead|1.0.1| |dotnet|leo-labs|1.3.0| |dotnet-test-explorer|formulahendry|0.7.7| |EditorConfig|EditorConfig|0.16.4| |eta-vscode|shadowtime2000|1.0.0| |gitlens|eamodio|11.7.0| |hadolint|exiasr|1.1.0| |java|redhat|1.1.0| |nugetpackagemanagergui|aliasadidev|1.1.9| |path-autocomplete|ionutvmi|1.17.1| |playwright|ms-playwright|0.0.9| |polacode-fixed-edition|mrrefactoring|0.3.6| |postcss|csstools|1.0.9| |powershell|ms-vscode|2021.10.2| |prettier-vscode|esbenp|9.0.0| |python|ms-python|2021.12.1559732655| |remotehub|GitHub|0.19.0| |richard-willis-extension-pack|richardwillis|1.3.44| |shell-format|foxundermoon|7.2.2| |shellcheck|timonwong|0.18.2| |vscode-docker|ms-azuretools|1.18.0| |vscode-elixir|mjmcloug|1.1.0| |vscode-eslint|dbaeumer|2.2.2| |vscode-gradle|vscjava|3.8.4| |vscode-java-debug|vscjava|0.37.0| |vscode-java-dependency|vscjava|0.18.8| |vscode-java-pack|vscjava|0.19.0| |vscode-java-test|vscjava|0.33.0| |vscode-markdownlint|DavidAnson|0.45.0| |vscode-maven|vscjava|0.34.1| |vscode-proto3|zxh404|0.5.5| |vscode-pylance|ms-python|2021.12.1| |vscode-spotless-gradle|richardwillis|1.1.8| |vscode-styled-components|jpoissonnier|1.7.0| |vscode-xml|redhat|0.18.1| |vscode-yaml|redhat|1.2.2|;
badsyntax commented 2 years ago

I'm not sure if the port conflict is a red herring. It seems like the processes start replicating when I send certain requests, and the dotnet process eventually gets "exhausted" and hangs. It's hard to know exactly what's going on but I'll update this issue with more information over time.