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

Switch to named pipes #1327

Merged

Conversation

TylerLeonhardt
Copy link
Member

@TylerLeonhardt TylerLeonhardt commented May 20, 2018

PR Summary

switch to using named pipes on Windows (and Unix domain sockets) instead of TCP.

It's shockingly great how simple this change was :)

marking WIP because I want to test on a few platforms and want a CI build.

PR Checklist

Note: Tick the boxes below that apply to this pull request by putting an x between the square brackets.
Please mark anything not applicable to this PR NA.

  • PR has a meaningful title
  • Summarized changes
  • This PR is ready to merge and is not work in progress
    • If the PR is work in progress, please add the prefix WIP: to the beginning of the title and remove the prefix when the PR is ready

src/session.ts Outdated

if (this.sessionSettings.developer.editorServicesWaitForDebugger) {
this.editorServicesArgs += "-WaitForDebugger ";
this.editorServicesArgs += `-WaitForDebugger `;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for string interpolation here.

src/session.ts Outdated
}
if (this.sessionSettings.developer.editorServicesLogLevel) {
this.editorServicesArgs += "-LogLevel '" + this.sessionSettings.developer.editorServicesLogLevel + "' ";
this.editorServicesArgs += `-LogLevel '${this.sessionSettings.developer.editorServicesLogLevel}' `;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why don't we need it here?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If your question is about the string interpolation, then I'm for its use here, where there is a variable to interpolate inside the string. :-)

Copy link
Collaborator

@rkeithhill rkeithhill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. And ... very cool! :-)

@TylerLeonhardt
Copy link
Member Author

TylerLeonhardt commented May 21, 2018

Connecting logic all seems right but there's a crash that occurs when a script finishes debugging (staring and walking through breakpoints and such all work fine):

2018-05-21 11:44:02 [NORMAL] - Method "Stop" at line 167 of C:\projects\PowerShellEditorServices\src\PowerShellEditorServices.Protocol\Server\DebugAdapter.cs

Debug adapter is shutting down...

2018-05-21 11:44:02 [NORMAL] - Method "OnDebugServiceClientConnect" at line 311 of C:\projects\PowerShellEditorServices\src\PowerShellEditorServices.Host\EditorServicesHost.cs

Previous debug session ended, restarting debug service listener...

2018-05-21 11:44:02 [VERBOSE] - Method "Start" at line 45 of C:\projects\PowerShellEditorServices\src\PowerShellEditorServices.Protocol\MessageProtocol\Channel\NamedPipeServerListener.cs

Named pipe server failed to start due to exception:

All pipe instances are busy.
2018-05-21 11:44:02 [ERROR] - Method "OnListenTaskCompleted" at line 391 of C:\projects\PowerShellEditorServices\src\PowerShellEditorServices.Protocol\MessageProtocol\ProtocolEndpoint.cs

ProtocolEndpoint message loop terminated due to unhandled exception:

System.AggregateException: One or more errors occurred. ---> System.IO.IOException: All pipe instances are busy. .........

I'll have to dig in to how the debug adapter handles ending of debugging.

@TylerLeonhardt
Copy link
Member Author

Ok that crash is fixed in PowerShell/PowerShellEditorServices#668

I'm removing the WIP. I've tested named pipes on:

  • Windows 10 with 5.1 & 6+
  • macOS
  • Ubuntu
  • CentOS

@TylerLeonhardt TylerLeonhardt changed the title WIP: Switch to named pipes Switch to named pipes May 21, 2018
Copy link
Collaborator

@SeeminglyScience SeeminglyScience left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, we can probably close those airplane mode related issues now too :)

Copy link
Collaborator

@rjmholt rjmholt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

"-AdditionalModules @('PowerShellEditorServices.VSCode') " +
"-BundledModulesPath '" + this.bundledModulesPath + "' " +
"-EnableConsoleRepl ";
`-HostName 'Visual Studio Code Host' ` +
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thoughts on using ordinary strings where no interpolation is needed vs consistency? Not opinionated either way.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for here, I just kept it consistent with the rest of the string concat

".dotnet", "corefx", "pipe",
pipeName);
// Windows uses NamedPipes where non-Windows platforms use Unix Domain Sockets.
// This requires connecting to the pipe file in different locations on Windows vs non-Windows.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically the name difference is just .NET Core being strange, rather than the use of domain sockets, no?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nah the location is different too. Named Pipes are in:

\\.\pipe\foo

domain sockets are in:

/tmp/CoreFxPipe_foo

Even the Named Pipes on Windows using .NET Standard instead are placed here:

\\.\pipe\foo

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

Successfully merging this pull request may close these issues.

None yet

4 participants