question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hang on startup when awaiting terminal PID

See original GitHub issue

Working with current master, I’m getting an occasional (about 50% of the time) hang on startup in Windows PowerShell.

This is again mysterious like the last issue I opened:

threads

However, there’s no dispose issue here.

Debugging the progress of this seems to interfere with the possibility of this deadlock occurring.

The log progresses to this point:

2020-02-24 13:57:16.584 -08:00 [DBG] Starting server, deregistering host logger and registering shutdown listener
2020-02-24 13:57:16.842 -08:00 [DBG] Creating LSP transport with endpoint InOut pipe: PSES_lffxipsq.u5q
2020-02-24 13:57:16.848 -08:00 [VRB] Writing session file
2020-02-24 13:57:16.848 -08:00 [VRB] Writing session started
2020-02-24 13:57:16.869 -08:00 [VRB] Assembly resolve event fired for Microsoft.WSMan.Management.resources, Version=3.0.0.0, Culture=en-US, PublicKeyToken=31bf3856ad364e35
2020-02-24 13:57:16.870 -08:00 [VRB] Assembly resolve event fired for Microsoft.WSMan.Management.resources, Version=3.0.0.0, Culture=en-US, PublicKeyToken=31bf3856ad364e35
2020-02-24 13:57:16.906 -08:00 [VRB] Loaded System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
2020-02-24 13:57:16.906 -08:00 [VRB] Loaded System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
2020-02-24 13:57:16.920 -08:00 [DBG] Session file written to c:\Users\roholt\Documents\Dev\vscode-PowerShell\sessions\PSES-VSCode-1088-643948 with content:
{"status":"started","languageServiceTransport":"NamedPipe","languageServicePipeName":"\\\\.\\pipe\\PSES_lffxipsq.u5q","debugServiceTransport":"NamedPipe","debugServicePipeName":"\\\\.\\pipe\\PSES_vtetuqus.ss5"}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:16 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
rjmholtcommented, Feb 25, 2020

Unfortunately there’s really not much to go on. When I next reproduce it I’ll take a full screenshot

0reactions
rjmholtcommented, Mar 2, 2020

Just to document a bit more, I can reproduce this with the following change from https://github.com/PowerShell/vscode-powershell/commit/d431617d6997c75fdce35342323e016f1bbaf271:

diff --git a/src/process.ts b/src/process.ts
index aa957b5..b70966e 100644
--- a/src/process.ts
+++ b/src/process.ts
@@ -128,7 +128,9 @@ export class PowerShellProcess {

         // Log that the PowerShell terminal process has been started
         this.log.write("Registering terminal PID log callback");
-        this.consoleTerminal.processId.then((pid) => this.logTerminalPid(pid, pwshName));
+        const pid = await this.consoleTerminal.processId;
+        this.logTerminalPid(pid, pwshName);
+        // this.consoleTerminal.processId.then((pid) => this.logTerminalPid(pid, pwshName));

         return sessionDetails;
     }

So startup pauses, since the client never opens a named pipe. The debugging the server shows it waiting on a named pipe connection.

In the client, pausing the debugger shows us stopped here:

pidHang

For whatever reason we are left awaiting the processId value.

I’ve only seen reports of this on Windows.

Read more comments on GitHub >

github_iconTop Results From Across the Web

5.6. Checklist: Terminal Hangs When I Log In
Enter the command kill PID (Section 24.12), where PID is the identification number from the previous step. If that doesn't work, try kill...
Read more >
Why is my terminal freezing up? - Ask Ubuntu
usually when the terminal freezes it is caused by another application in the background using too many resources, like the CPU or Disk...
Read more >
Reboot from the command line (stuck processes) - Ask Different
I tried again with sudo reboot -nq and after 15 minutes the machine rebooted. I don't know it one of processes finally died...
Read more >
How to get pid of just started process - Server Fault
In the second case, the pid will be set only if the first command succeeds. You can get the process id from $pid...
Read more >
How to wait in bash for several subprocesses to finish, and ...
wait also (optionally) takes the PID of the process to wait for, and with $! you get the PID of the last command...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found