vscode: Reattached to the wrong terminal

I just reloaded a window with my vscode-jupyter repo open, and it attached to a terminal which is already open in my vscode repo, so now this terminal is open in two windows: Sep-21-2021 09-51-02

The right window is the window that originally owned this terminal

One thing about this terminal is that its cwd is some other folder outside of both workspaces, if that matters.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 3
  • Comments: 62 (56 by maintainers)

Commits related to this issue

Most upvoted comments

Ok, I figured this out. What a journey! Here is the fairly reliable repro:

  • Clear state
    • ./scripts/code
    • Given 2 folders a and b
    • Open folders a and b and close all terminals
    • File > Exit
  • Setup for the process revive
    • ./scripts/code
    • Window a: Open 3 terminals and type “a”, “b”, “c” into them respectively, this helps identify them to ensure they’re in the correct order later
    • Window b: Open 3 terminals and type “d”, “e”, “f” into them respectively
    • File > Exit
  • Process revive
    • ./scripts/code
    • Window a and b should revive the processes and have all terminals in the correct order they were created (this works)
  • Process reconnect
    • Reload window a and window b at the same time
    • Window a and b should revive the processes and have all terminals in the correct order they were created 🐛

Note that this is a timing issue and has a chance to not reproduce the problem.


This is what is meant to happen when exiting and restarting the pty host process. Terminal processes are revived (aka. re-created) and their actual pty IDs for this pty host process are mapped to, starting at 1. Notice below how the new IDs start from 1, they just represent the order they are created in which shouldn’t matter when reviving.

[2022-08-09 10:37:37.588] [ptyhost] [info] reviveTerminalProcesses', 'terminal id 2 -> newId 1
[2022-08-09 10:37:37.590] [ptyhost] [info] reviveTerminalProcesses', 'terminal id 3 -> newId 2
[2022-08-09 10:37:37.591] [ptyhost] [info] reviveTerminalProcesses', 'terminal id 4 -> newId 3
[2022-08-09 10:37:37.598] [ptyhost] [info] reviveTerminalProcesses', 'terminal id 1 -> newId 4
[2022-08-09 10:37:37.600] [ptyhost] [info] reviveTerminalProcesses', 'terminal id 5 -> newId 5
[2022-08-09 10:37:37.600] [ptyhost] [info] reviveTerminalProcesses', 'terminal id 6 -> newId 6
[2022-08-09 10:37:37.700] [ptyhost] [info] _expandTerminalInstance', 'terminal ID 2 -> revivedPtyId 1
[2022-08-09 10:37:37.700] [ptyhost] [info] _expandTerminalInstance', 'terminal ID 3 -> revivedPtyId 2
[2022-08-09 10:37:37.701] [ptyhost] [info] _expandTerminalInstance', 'terminal ID 4 -> revivedPtyId 3
[2022-08-09 10:37:37.701] [ptyhost] [info] _expandTerminalInstance', 'terminal ID 1 -> revivedPtyId 4
[2022-08-09 10:37:37.701] [ptyhost] [info] _expandTerminalInstance', 'terminal ID 5 -> revivedPtyId 5
[2022-08-09 10:37:37.701] [ptyhost] [info] _expandTerminalInstance', 'terminal ID 6 -> revivedPtyId 6

After that, when reloading windows, terminal processes do not get revived but reconnected to. So an undefined mapping is expected:

[2022-08-09 10:48:20.084] [ptyhost] [info] _expandTerminalInstance', 'terminal ID 1 -> revivedPtyId undefined
[2022-08-09 10:48:20.084] [ptyhost] [info] _expandTerminalInstance', 'terminal ID 2 -> revivedPtyId undefined
[2022-08-09 10:48:20.084] [ptyhost] [info] _expandTerminalInstance', 'terminal ID 3 -> revivedPtyId undefined

What is happening and what is causing this bug as well as a related issue[^1] is that the revived pty ID is cached, so if reloading happens to use a newId that is mapped to a different pty ID in _revivedPtyIdMap, it will reconnect to that one instead:

[2022-08-09 10:40:41.894] [ptyhost] [info] reviveTerminalProcesses', 'terminal id 2 -> newId 1
[2022-08-09 10:40:41.896] [ptyhost] [info] reviveTerminalProcesses', 'terminal id 5 -> newId 2
[2022-08-09 10:40:41.896] [ptyhost] [info] reviveTerminalProcesses', 'terminal id 6 -> newId 3
[2022-08-09 10:40:41.960] [ptyhost] [info] _expandTerminalInstance', 'terminal ID 2 -> revivedPtyId 1
[2022-08-09 10:40:41.960] [ptyhost] [info] _expandTerminalInstance', 'terminal ID 5 -> revivedPtyId 2
[2022-08-09 10:40:41.960] [ptyhost] [info] _expandTerminalInstance', 'terminal ID 6 -> revivedPtyId 3
[2022-08-09 10:40:42.073] [ptyhost] [info] reviveTerminalProcesses', 'terminal id 1 -> newId 4
[2022-08-09 10:40:42.074] [ptyhost] [info] reviveTerminalProcesses', 'terminal id 3 -> newId 5
[2022-08-09 10:40:42.075] [ptyhost] [info] reviveTerminalProcesses', 'terminal id 4 -> newId 6
[2022-08-09 10:40:42.154] [ptyhost] [info] _expandTerminalInstance', 'terminal ID 1 -> revivedPtyId 4
[2022-08-09 10:40:42.154] [ptyhost] [info] _expandTerminalInstance', 'terminal ID 3 -> revivedPtyId 5
[2022-08-09 10:40:42.154] [ptyhost] [info] _expandTerminalInstance', 'terminal ID 4 -> revivedPtyId 6

The above results in:

2 -> 1
5 -> 2
6 -> 3
1 -> 4
3 -> 5
4 -> 6

Then on reload the pty ID mapping occurs instead of being undefined, which causes a reconnect to the wrong pty.

[2022-08-09 10:40:53.471] [ptyhost] [info] _expandTerminalInstance', 'terminal ID 4 -> revivedPtyId 6
[2022-08-09 10:40:53.471] [ptyhost] [info] _expandTerminalInstance', 'terminal ID 5 -> revivedPtyId 2
[2022-08-09 10:40:53.471] [ptyhost] [info] _expandTerminalInstance', 'terminal ID 6 -> revivedPtyId 3
[2022-08-09 10:40:53.507] [ptyhost] [info] _expandTerminalInstance', 'terminal ID 1 -> revivedPtyId 4
[2022-08-09 10:40:53.507] [ptyhost] [info] _expandTerminalInstance', 'terminal ID 2 -> revivedPtyId 1
[2022-08-09 10:40:53.507] [ptyhost] [info] _expandTerminalInstance', 'terminal ID 3 -> revivedPtyId 5

So in the above they get re-mapped, shuffling the order within a window and potentially connecting to a different window’s ptys:

2 -> 1 -> 4
5 -> 2 -> 1
6 -> 3 -> 5
1 -> 4 -> 6
3 -> 5 -> 2
4 -> 6 -> 3

image

[^1]: The folder’s terminals may not get restored at with the warning “Couldn’t get layout info, a terminal was probably disconnected” in the pty host output channel. This started happening due to one of the previous workarounds to prevent 2 windows attaching to the same pty.

With @meganrogge’s logs in #186922, I was able to reproduce the problem!

image

The repro is very complicated, it is essentially trying to get into a state where 2+ windows have “old pty ids” that conflict with one another, and then increasing the latency of the pty host in order to force the race condition to show itself.

  1. Set these settings:
    "terminal.integrated.persistentSessionReviveProcess": "onExitAndWindowClose",
    "terminal.integrated.developer.ptyHost.latency": 500
    
  2. Set default log level to trace
  3. Close all windows
  4. Open window 1 (W1) with folder A
  5. W1: Open 2 terminals
  6. W1: Close window
  7. W1: Open window
  8. W1: Open pty host log, you should see this:
    2023-07-03 12:54:57.963 [info] Expanding terminal instance, old id 1 -> new id 1
    2023-07-03 12:54:57.963 [info] Expanding terminal instance, old id 2 -> new id 2
    
  9. Open window 2 (W2) with folder B
  10. W2: Open 2 terminals
  11. W1: Close window
  12. W2: Close window
  13. Open VS Code (W2 should open)
  14. W2: Open pty host log, you should something like this:
    2023-07-03 12:54:57.963 [info] Expanding terminal instance, old id 3 -> new id 1
    2023-07-03 12:54:57.963 [info] Expanding terminal instance, old id 4 -> new id 2
    
  15. W2: Close window
  16. Open an external terminal and type code
  17. Open another external terminal and type code <folder A>
  18. Run the commands in both terminals in quick succession
  19. W1|W2: Open pty host log, you should see something like this:
    2023-07-03 13:01:56.461 [info] Expanding terminal instance, old id 1 -> new id 3
    2023-07-03 13:01:56.461 [info] Expanding terminal instance, old id 2 -> new id 4
    2023-07-03 13:01:57.086 [info] Expanding terminal instance, old id 1 -> new id undefined
    2023-07-03 13:01:57.086 [info] Expanding terminal instance, old id 2 -> new id undefined
    

The terminal with new id undefined end up attaching to the wrong pty.


The fix for this is simple, just add workspace ID as part of the key of the old id, so 1 becomes <folder B hash>-1. This should make conflicts impossible to occur.

Yep, it’s not working atm for remote terminals, so:

terminal.integrated.enablePersistentSessions: false

Thanks @alexr00, it seems there’s some inconsistency with the layout info and the revived procs, so I suspect this silently error swallowing now:

https://github.com/microsoft/vscode/blob/eafde5a28081c115bb0b06e5199be8f2822a737c/src/vs/workbench/contrib/terminal/electron-sandbox/localTerminalBackend.ts#L301-L303

Added logs for that here: https://github.com/microsoft/vscode/pull/186732, I’ll merge for July so you might not be able to test for a week but when you do please also grab the Terminal output log as this is renderer side.

I tried to repeat my setup before updating, and it did happen again. Setup:

  • Window 1 is vscode-pull-request-github2 : terminal cwd is outside the workspace and on a different drive (C vs D)
  • Window 2 is vscode-pull-request-github: terminals cwd were in the workspace
  • Window 3 is repo1: terminal cws was in the workspace
  • Window 4 is vscode: terminals cwd were all in the workspace

After update:

  • Window 1 is vscode-pull-request-github2 : has a new terminal
  • Window 2 is vscode-pull-request-github: correct
  • Window 3 is repo1: has attached to Window 2’s terminal and now they share the same terminal
  • Window 4 is vscode: correct

Logs:

2023-06-30 12:19:27.910 [info] Revived process, old id 3 -> new id 1
2023-06-30 12:19:28.183 [info] Expanding terminal instance, old id 1 -> new id undefined
2023-06-30 12:19:28.233 [info] Expanding terminal instance, old id 4 -> new id undefined
2023-06-30 12:19:28.233 [warning] Couldn't get layout info, a terminal was probably disconnected Could not find pty on pty host
2023-06-30 12:19:28.233 [info] Reattach to wrong terminal debug info - layout info by id {"relativeSize":1,"terminal":4}
2023-06-30 12:19:28.236 [info] Reattach to wrong terminal debug info - _revivePtyIdMap [{"newId":1,"state":{"id":3,"shellLaunchConfig":{"icon":{"id":"terminal-powershell"},"executable":"C:\\Users\\alros\\AppData\\Local\\Microsoft\\WindowsApps\\Microsoft.PowerShell_8wekyb3d8bbwe\\pwsh.exe","color":null,"useShellEnvironment":true},"processDetails":{"id":3,"title":"pwsh","titleSource":1,"pid":16904,"workspaceId":"dfe6bca14cf70957a5e0b4d02852452b","workspaceName":"vscode-pull-request-github","cwd":"D:\\repos\\Microsoft\\vscode-pull-request-github","isOrphan":false,"icon":{"id":"terminal-powershell"},"environmentVariableCollections":[["vscode.git",[["GIT_ASKPASS",{"variable":"GIT_ASKPASS","value":"c:\\Program Files\\Microsoft VS Code Insiders\\resources\\app\\extensions\\git\\dist\\askpass.sh","type":1,"options":{"applyAtProcessCreation":true,"applyAtShellIntegration":false}}],["VSCODE_GIT_ASKPASS_NODE",{"variable":"VSCODE_GIT_ASKPASS_NODE","value":"C:\\Program Files\\Microsoft VS Code Insiders\\Code - Insiders.exe","type":1,"options":{"applyAtProcessCreation":true,"applyAtShellIntegration":false}}],["VSCODE_GIT_ASKPASS_EXTRA_ARGS",{"variable":"VSCODE_GIT_ASKPASS_EXTRA_ARGS","value":"--ms-enable-electron-run-as-node","type":1,"options":{"applyAtProcessCreation":true,"applyAtShellIntegration":false}}],["VSCODE_GIT_ASKPASS_MAIN",{"variable":"VSCODE_GIT_ASKPASS_MAIN","value":"c:\\Program Files\\Microsoft VS Code Insiders\\resources\\app\\extensions\\git\\dist\\askpass-main.js","type":1,"options":{"applyAtProcessCreation":true,"applyAtShellIntegration":false}}],["VSCODE_GIT_IPC_HANDLE",{"variable":"VSCODE_GIT_IPC_HANDLE","value":"\\\\.\\pipe\\vscode-git-54ea0bee87-sock","type":1,"options":{"applyAtProcessCreation":true,"applyAtShellIntegration":false}}]],[["",{"description":"Enables the following features: git auth provider"}]]]],"hasChildProcesses":false,"shellIntegrationNonce":"cabedd54-a605-4ed8-8c39-1a63e7be2bae"},"processLaunchConfig":{"env":{"ALLUSERSPROFILE":"C:\\ProgramData","APPDATA":"C:\\Users\\alros\\AppData\\Roaming","ChocolateyInstall":"C:\\ProgramData\\chocolatey","ChocolateyLastPathUpdate":"133034006781636031","CHROME_CRASHPAD_PIPE_NAME":"\\\\.\\pipe\\LOCAL\\crashpad_7008_BWXUDWPPZKOQEDJO","CLIENTNAME":"ALROS-3","CommonProgramFiles":"C:\\Program Files\\Common Files","CommonProgramFiles(x86)":"C:\\Program Files (x86)\\Common Files","CommonProgramW6432":"C:\\Program Files\\Common Files","COMPUTERNAME":"ALROS-1","ComSpec":"C:\\WINDOWS\\system32\\cmd.exe","CYGWIN_HOME":"C:\\cygwin","DriverData":"C:\\Windows\\System32\\Drivers\\DriverData","EFC_2220":"0","FOO":"this_is_a_bar","GOPATH":"C:\\Users\\alros\\go","GYP_MSVS_VERSION":"2015","HOMEDRIVE":"C:","HOMEPATH":"\\Users\\alros","INCLUDE":"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\include;C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\atlmfc\\include","LIB":"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\lib","LOCALAPPDATA":"C:\\Users\\alros\\AppData\\Local","LOGONSERVER":"\\\\DB3-RED-DC-08","NUMBER_OF_PROCESSORS":"12","NVM_HOME":"C:\\Users\\alros\\AppData\\Roaming\\nvm","NVM_SYMLINK":"C:\\Program Files\\nodejs","OneDrive":"C:\\Users\\alros\\OneDrive - Microsoft","OneDriveCommercial":"C:\\Users\\alros\\OneDrive - Microsoft","ORIGINAL_XDG_CURRENT_DESKTOP":"undefined","OS":"Windows_NT","Path":"C:\\Program Files\\Common Files\\microsoft shared\\Microsoft Online Services;C:\\Program Files (x86)\\Common Files\\Microsoft Shared\\Microsoft Online Services;C:\\Windows\\System32;C:\\Windows;C:\\Windows\\System32\\wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\OpenSSH\\;D:\\install\\powershell\\6\\;C:\\cygwin\\bin;C:\\Go\\bin;C:\\Program Files\\Microsoft VS Code Exploration\\bin;C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\bin;C:\\Program Files\\Microsoft VS Code Insiders\\bin;C:\\Python27;C:\\Program Files\\Microsoft SQL Server\\130\\Tools\\Binn\\;C:\\Users\\alros\\AppData\\Roaming\\nvm;C:\\Program Files\\nodejs;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files (x86)\\Yarn\\bin\\;C:\\Program Files\\CMake\\bin;C:\\ProgramData\\chocolatey\\bin;C:\\Program Files\\dotnet\\;C:\\Program Files (x86)\\Gpg4win\\..\\GnuPG\\bin;C:\\Program Files\\GitHub CLI\\;C:\\Program Files\\Microsoft VS Code\\bin;C:\\Program Files\\Git\\cmd;C:\\Program Files\\Docker\\Docker\\resources\\bin;C:\\Users\\alros\\.cargo\\bin;C:\\Users\\alros\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\alros\\go\\bin;C:\\Users\\alros\\.dotnet\\tools;C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319;C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\bin;C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\IDE;C:\\Python27;C:\\Users\\alros\\AppData\\Roaming\\nvm;C:\\Program Files\\nodejs;d:\\repos\\microsoft\\vscode\\scripts;C:\\Users\\alros\\AppData\\Local\\Yarn\\bin;C:\\Users\\alros\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python39\\Scripts;C:\\Users\\alros\\.dotnet\\tools;C:\\Users\\alros\\AppData\\Local\\GitHubDesktop\\bin;C:\\ProgramData\\alros\\GitHubDesktop\\bin","PATHEXT":".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC","PROCESSOR_ARCHITECTURE":"AMD64","PROCESSOR_IDENTIFIER":"Intel64 Family 6 Model 85 Stepping 4, GenuineIntel","PROCESSOR_LEVEL":"6","PROCESSOR_REVISION":"5504","ProgramData":"C:\\ProgramData","ProgramFiles":"C:\\Program Files","ProgramFiles(x86)":"C:\\Program Files (x86)","ProgramW6432":"C:\\Program Files","PSModulePath":"C:\\Program Files\\WindowsPowerShell\\Modules;C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules;C:\\Program Files (x86)\\Microsoft Azure Information Protection\\Powershell","PUBLIC":"C:\\Users\\Public","PYTHON":"C:\\Python27\\python.exe","SESSIONNAME":"RDP-Tcp#0","SystemDrive":"C:","SystemRoot":"C:\\WINDOWS","TEMP":"C:\\Users\\alros\\AppData\\Local\\Temp","TMP":"C:\\Users\\alros\\AppData\\Local\\Temp","UATDATA":"C:\\windows\\CCM\\UATData\\D9F8C395-CAB8-491d-B8AC-179A1FE1BE77","USERDNSDOMAIN":"REDMOND.CORP.MICROSOFT.COM","USERDOMAIN":"REDMOND","USERDOMAIN_ROAMINGPROFILE":"REDMOND","USERNAME":"alros","USERPROFILE":"C:\\Users\\alros","VS140COMNTOOLS":"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\Tools\\","windir":"C:\\WINDOWS","__COMPAT_LAYER":"DetectorsAppHealth","TERM_PROGRAM":"vscode","TERM_PROGRAM_VERSION":"1.80.0-insider","LANG":"en_US.UTF-8","COLORTERM":"truecolor","GIT_ASKPASS":"c:\\Program Files\\Microsoft VS Code Insiders\\resources\\app\\extensions\\git\\dist\\askpass.sh","VSCODE_GIT_ASKPASS_NODE":"C:\\Program Files\\Microsoft VS Code Insiders\\Code - Insiders.exe","VSCODE_GIT_ASKPASS_EXTRA_ARGS":"--ms-enable-electron-run-as-node","VSCODE_GIT_ASKPASS_MAIN":"c:\\Program Files\\Microsoft VS Code Insiders\\resources\\app\\extensions\\git\\dist\\askpass-main.js","VSCODE_GIT_IPC_HANDLE":"\\\\.\\pipe\\vscode-git-54ea0bee87-sock"},"executableEnv":{"ALLUSERSPROFILE":"C:\\ProgramData","APPDATA":"C:\\Users\\alros\\AppData\\Roaming","ChocolateyInstall":"C:\\ProgramData\\chocolatey","ChocolateyLastPathUpdate":"133034006781636031","CHROME_CRASHPAD_PIPE_NAME":"\\\\.\\pipe\\LOCAL\\crashpad_16072_MPZZDZVVZJBOERYY","CLIENTNAME":"ALROS-3","CommonProgramFiles":"C:\\Program Files\\Common Files","CommonProgramFiles(x86)":"C:\\Program Files (x86)\\Common Files","CommonProgramW6432":"C:\\Program Files\\Common Files","COMPUTERNAME":"ALROS-1","ComSpec":"C:\\WINDOWS\\system32\\cmd.exe","CYGWIN_HOME":"C:\\cygwin","DriverData":"C:\\Windows\\System32\\Drivers\\DriverData","EFC_2220":"0","FOO":"this_is_a_bar","GOPATH":"C:\\Users\\alros\\go","GYP_MSVS_VERSION":"2015","HOMEDRIVE":"C:","HOMEPATH":"\\Users\\alros","INCLUDE":"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\include;C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\atlmfc\\include","LIB":"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\lib","LOCALAPPDATA":"C:\\Users\\alros\\AppData\\Local","LOGONSERVER":"\\\\DB3-RED-DC-08","NUMBER_OF_PROCESSORS":"12","NVM_HOME":"C:\\Users\\alros\\AppData\\Roaming\\nvm","NVM_SYMLINK":"C:\\Program Files\\nodejs","OneDrive":"C:\\Users\\alros\\OneDrive - Microsoft","OneDriveCommercial":"C:\\Users\\alros\\OneDrive - Microsoft","ORIGINAL_XDG_CURRENT_DESKTOP":"undefined","OS":"Windows_NT","Path":"C:\\Program Files\\Common Files\\microsoft shared\\Microsoft Online Services;C:\\Program Files (x86)\\Common Files\\Microsoft Shared\\Microsoft Online Services;C:\\Windows\\System32;C:\\Windows;C:\\Windows\\System32\\wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\OpenSSH\\;D:\\install\\powershell\\6\\;C:\\cygwin\\bin;C:\\Go\\bin;C:\\Program Files\\Microsoft VS Code Exploration\\bin;C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\bin;C:\\Program Files\\Microsoft VS Code Insiders\\bin;C:\\Python27;C:\\Program Files\\Microsoft SQL Server\\130\\Tools\\Binn\\;C:\\Users\\alros\\AppData\\Roaming\\nvm;C:\\Program Files\\nodejs;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files (x86)\\Yarn\\bin\\;C:\\Program Files\\CMake\\bin;C:\\ProgramData\\chocolatey\\bin;C:\\Program Files\\dotnet\\;C:\\Program Files (x86)\\Gpg4win\\..\\GnuPG\\bin;C:\\Program Files\\GitHub CLI\\;C:\\Program Files\\Microsoft VS Code\\bin;C:\\Program Files\\Git\\cmd;C:\\Program Files\\Docker\\Docker\\resources\\bin;C:\\Users\\alros\\.cargo\\bin;C:\\Users\\alros\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\alros\\go\\bin;C:\\Users\\alros\\.dotnet\\tools;C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319;C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\bin;C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\IDE;C:\\Python27;C:\\Users\\alros\\AppData\\Roaming\\nvm;C:\\Program Files\\nodejs;d:\\repos\\microsoft\\vscode\\scripts;C:\\Users\\alros\\AppData\\Local\\Yarn\\bin;C:\\Users\\alros\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python39\\Scripts;C:\\Users\\alros\\.dotnet\\tools;C:\\Users\\alros\\AppData\\Local\\GitHubDesktop\\bin;C:\\ProgramData\\alros\\GitHubDesktop\\bin","PATHEXT":".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC","PROCESSOR_ARCHITECTURE":"AMD64","PROCESSOR_IDENTIFIER":"Intel64 Family 6 Model 85 Stepping 4, GenuineIntel","PROCESSOR_LEVEL":"6","PROCESSOR_REVISION":"5504","ProgramData":"C:\\ProgramData","ProgramFiles":"C:\\Program Files","ProgramFiles(x86)":"C:\\Program Files (x86)","ProgramW6432":"C:\\Program Files","PSModulePath":"C:\\Program Files\\WindowsPowerShell\\Modules;C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules;C:\\Program Files (x86)\\Microsoft Azure Information Protection\\Powershell","PUBLIC":"C:\\Users\\Public","PYTHON":"C:\\Python27\\python.exe","SESSIONNAME":"RDP-Tcp#0","SystemDrive":"C:","SystemRoot":"C:\\WINDOWS","TEMP":"C:\\Users\\alros\\AppData\\Local\\Temp","TMP":"C:\\Users\\alros\\AppData\\Local\\Temp","UATDATA":"C:\\windows\\CCM\\UATData\\D9F8C395-CAB8-491d-B8AC-179A1FE1BE77","USERDNSDOMAIN":"REDMOND.CORP.MICROSOFT.COM","USERDOMAIN":"REDMOND","USERDOMAIN_ROAMINGPROFILE":"REDMOND","USERNAME":"alros","USERPROFILE":"C:\\Users\\alros","VS140COMNTOOLS":"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\Tools\\","VSCODE_CODE_CACHE_PATH":"C:\\Users\\alros\\AppData\\Roaming\\Code - Insiders\\CachedData\\c1bca6d7cc2c5f71ae04deda90c0cf50819ffde4","VSCODE_CWD":"C:\\Program Files\\Microsoft VS Code Insiders","VSCODE_IPC_HOOK":"\\\\.\\pipe\\72671c30d05ce318932621dac30dfd34-1.80.0-insider-main-sock","VSCODE_NLS_CONFIG":"{\"locale\":\"en\",\"osLocale\":\"en-us\",\"availableLanguages\":{},\"_languagePackSupport\":true}","VSCODE_PID":"16072","windir":"C:\\WINDOWS","__COMPAT_LAYER":"DetectorsAppHealth"},"options":{"shellIntegration":{"enabled":true,"suggestEnabled":false,"nonce":"cabedd54-a605-4ed8-8c39-1a63e7be2bae"},"windowsEnableConpty":true,"environmentVariableCollections":[["vscode.git",[["GIT_ASKPASS",{"variable":"GIT_ASKPASS","value":"c:\\Program Files\\Microsoft VS Code Insiders\\resources\\app\\extensions\\git\\dist\\askpass.sh","type":1,"options":{"applyAtProcessCreation":true,"applyAtShellIntegration":false}}],["VSCODE_GIT_ASKPASS_NODE",{"variable":"VSCODE_GIT_ASKPASS_NODE","value":"C:\\Program Files\\Microsoft VS Code Insiders\\Code - Insiders.exe","type":1,"options":{"applyAtProcessCreation":true,"applyAtShellIntegration":false}}],["VSCODE_GIT_ASKPASS_EXTRA_ARGS",{"variable":"VSCODE_GIT_ASKPASS_EXTRA_ARGS","value":"--ms-enable-electron-run-as-node","type":1,"options":{"applyAtProcessCreation":true,"applyAtShellIntegration":false}}],["VSCODE_GIT_ASKPASS_MAIN",{"variable":"VSCODE_GIT_ASKPASS_MAIN","value":"c:\\Program Files\\Microsoft VS Code Insiders\\resources\\app\\extensions\\git\\dist\\askpass-main.js","type":1,"options":{"applyAtProcessCreation":true,"applyAtShellIntegration":false}}],["VSCODE_GIT_IPC_HANDLE",{"variable":"VSCODE_GIT_IPC_HANDLE","value":"\\\\.\\pipe\\vscode-git-54ea0bee87-sock","type":1,"options":{"applyAtProcessCreation":true,"applyAtShellIntegration":false}}]],[["",{"description":"Enables the following features: git auth provider"}]]]],"workspaceFolder":{"uri":{"$mid":1,"fsPath":"d:\\repos\\Microsoft\\vscode-pull-request-github","_sep":1,"external":"file:///d%3A/repos/Microsoft/vscode-pull-request-github","path":"/d:/repos/Microsoft/vscode-pull-request-github","scheme":"file"},"name":"vscode-pull-request-github","index":0}}},"unicodeVersion":"11","replayEvent":{"events":[{"cols":258,"rows":17,"data":"PS D:\\repos\\Microsoft\\vscode-pull-request-github> \u001b[93mgit \u001b[0mpull\r\nremote: Enumerating objects: 1, done.\r\nremote: Counting objects: 100% (1/1), done.\r\nremote: Total 1 (delta 0), reused 0 (delta 0), pack-reused 0\r\nUnpacking objects: 100% (1/1), 614 bytes | 61.00 KiB/s, done.\r\nFrom https://github.com/microsoft/vscode-pull-request-github\r\n   8cbac164..c6f00d59  main       -> origin/main\r\nUpdating 8cbac164..c6f00d59\r\nFast-forward\r\n src/commands.ts | 13 \u001b[32m++++++++++\u001b[31m---\r\n\u001b[0m 1 file changed, 10 insertions(+), 3 deletions(-)\r\nPS D:\\repos\\Microsoft\\vscode-pull-request-github> \u001b[93mgit \u001b[0mpull\r\nAlready up to date.\r\nPS D:\\repos\\Microsoft\\vscode-pull-request-github> \u001b[93mgit \u001b[0mcheckout \u001b[90m-b \u001b[0mrelease/0.68\r\nSwitched to a new branch 'release/0.68'\r\nPS D:\\repos\\Microsoft\\vscode-pull-request-github> \u001b[93mgit \u001b[0mpush\r\nfatal: The current branch release/0.68 has no upstream branch.\r\nTo push the current branch and set the remote as upstream, use\r\n\r\n    git push --set-upstream origin release/0.68\r\n\r\nTo have this happen automatically for branches without a tracking\r\nupstream, see 'push.autoSetupRemote' in 'git help config'.\r\n\r\nPS D:\\repos\\Microsoft\\vscode-pull-request-github> \u001b[93mgit \u001b[0mpush \u001b[90m--set-upstream \u001b[0morigin release/0.68\r\nTotal 0 (delta 0), reused 0 (delta 0), pack-reused 0\r\nremote:\r\nremote: Create a pull request for 'release/0.68' on GitHub by visiting:\r\nremote:      https://github.com/microsoft/vscode-pull-request-github/pull/new/release/0.68\r\nremote:\r\nTo https://github.com/microsoft/vscode-pull-request-github.git\r\n * [new branch]        release/0.68 -> release/0.68\r\nbranch 'release/0.68' set up to track 'origin/release/0.68'.\r\nPS D:\\repos\\Microsoft\\vscode-pull-request-github>\u001b[1C\u001b[93mgit \u001b[0mcheckout main\r\nSwitched to branch 'main'\r\nYour branch is up to date with 'origin/main'.\r\nPS D:\\repos\\Microsoft\\vscode-pull-request-github>\u001b[1C\u001b[93mgit \u001b[0mcheckout \u001b[90m-b \u001b[0malexr00/disablePrerelease \u001b[38;5;238m    \r\n\u001b[0mSwitched to a new branch 'alexr00/disablePrerelease'\r\nPS D:\\repos\\Microsoft\\vscode-pull-request-github>\u001b[1C"}],"commands":{"isWindowsPty":true,"commands":[{"startLine":0,"endLine":11,"executedLine":0,"command":"git pull","isTrusted":true,"cwd":"D:\\repos\\Microsoft\\vscode-pull-request-github","exitCode":0,"commandStartLineContent":"PS D:\\repos\\Microsoft\\vscode-pull-request-github> git pull --unshallow","timestamp":1688104913850},{"startLine":11,"endLine":13,"executedLine":11,"command":"git pull","isTrusted":true,"cwd":"D:\\repos\\Microsoft\\vscode-pull-request-github","exitCode":0,"commandStartLineContent":"PS D:\\repos\\Microsoft\\vscode-pull-request-github> git pull --unshallow","timestamp":1688104992406},{"startLine":13,"endLine":14,"executedLine":13,"command":"git checkout -b release/0.68","isTrusted":true,"cwd":"D:\\repos\\Microsoft\\vscode-pull-request-github","exitCode":0,"commandStartLineContent":"PS D:\\repos\\Microsoft\\vscode-pull-request-github> git checkout -b release/0.68","timestamp":1688105048380},{"startLine":15,"endLine":23,"executedLine":15,"command":"git push","isTrusted":true,"cwd":"D:\\repos\\Microsoft\\vscode-pull-request-github","exitCode":1,"commandStartLineContent":"PS D:\\repos\\Microsoft\\vscode-pull-request-github> git push --set-upstream origin release/1.80","timestamp":1688105055685},{"startLine":24,"endLine":32,"executedLine":24,"command":"git push --set-upstream origin release/0.68","isTrusted":true,"cwd":"D:\\repos\\Microsoft\\vscode-pull-request-github","exitCode":0,"commandStartLineContent":"PS D:\\repos\\Microsoft\\vscode-pull-request-github> git push --set-upstream origin release/0.68","timestamp":1688105063631},{"startLine":33,"endLine":35,"executedLine":33,"command":"git checkout main","isTrusted":true,"cwd":"D:\\repos\\Microsoft\\vscode-pull-request-github","exitCode":0,"commandStartLineContent":"PS D:\\repos\\Microsoft\\vscode-pull-request-github> git checkout main","timestamp":1688113116127},{"startLine":36,"endLine":37,"executedLine":36,"command":"git checkout -b alexr00/disablePrerelease","isTrusted":true,"cwd":"D:\\repos\\Microsoft\\vscode-pull-request-github","exitCode":0,"commandStartLineContent":"PS D:\\repos\\Microsoft\\vscode-pull-request-github> git checkout -b alexr00/disablePrerelease     ","timestamp":1688113158174},{"startLine":37,"startX":52,"command":"","isTrusted":true,"cwd":"D:\\repos\\Microsoft\\vscode-pull-request-github","timestamp":0}]}},"timestamp":1688120353450}}]
2023-06-30 12:19:28.488 [info] Expanding terminal instance, old id 3 -> new id 1
2023-06-30 12:19:28.865 [warning] Persistent process "1": Process had no disconnect runners but was an orphan
2023-06-30 12:19:28.866 [info] Persistent process reconnection "1"
2023-06-30 12:19:29.410 [info] Persistent process "1": Replaying 2108 chars and 1 size events
2023-06-30 12:19:29.487 [info] Revived process, old id 2 -> new id 2
2023-06-30 12:19:29.572 [info] Expanding terminal instance, old id 2 -> new id 2
2023-06-30 12:19:32.741 [warning] Persistent process "2": Process had no disconnect runners but was an orphan
2023-06-30 12:19:32.742 [info] Persistent process reconnection "2"
2023-06-30 12:19:32.762 [warning] Persistent process "1": Process had no disconnect runners but was an orphan
2023-06-30 12:19:32.763 [info] Persistent process reconnection "1"
2023-06-30 12:19:33.420 [info] Persistent process "2": Replaying 5919 chars and 1 size events
2023-06-30 12:19:33.428 [info] Persistent process "1": Replaying 2108 chars and 1 size events

I spent a few hours looking into this, here are my findings:

  • This warning in the logs is common across recent failures: Couldn't get layout info, a terminal was probably disconnected Could not find pty on pty host, I tried and tried but could not reproduce this on Insiders or OSS 🙁
  • I’m adding more verbose logs to the info log level that gives me the old/new pty id mapping as well as dumping a bunch of info when the above error happens https://github.com/microsoft/vscode/pull/186653
  • I looked into whether lastPtyId should be correct and while I found it could cause issues when the pty host restarts (https://github.com/microsoft/vscode/issues/186645), it seems like it should work after a restart
  • I could the cwd being outside the workspace would make a difference as we don’t even take that into account when reviving the proc (https://github.com/microsoft/vscode/issues/186635)
  • The management of lastPtyId would be a lot simpler if we moved the id to being a guid instead of a number, but that would be a shame as we then need to send the guid along the wire for pretty much every request to the pty host
  • I looked into possible race conditions where _revivedPtyIdMap could get stale/invalid values. Both a thorough review of the code and injecting timeouts (random, differing by window) into important calls didn’t cause problems

Current plan is to wait for https://github.com/microsoft/vscode/issues/186645 to merge and await a repro with these logs present, then analyze them. I’ll also likely be continuing to fiddle with terminal reconnection in debt week to improve perf further and reduce redundancies.

I just ran into this now:

  1. I had ~4 windows open:
    • Window 1 is vscode-pull-request-github2 : terminals cwd were all in the workspace
    • Window 2 is vscode-pull-request-github: terminals cwd were all in the workspace
    • Window 3 is repo1: 2 terminals, both of which had a cwd outside the workspace
    • Window 4 is vscode: terminals cwd were all in the workspace
  2. Updated VS Code
  3. Upon reattach:
    • Window 1’s terminals are correct
    • Window 2 has reattached to one of Window 3’s terminals and has lost it’s original terminal
    • Window 3’s terminals are correct
    • Window 4’s terminals are correct.

Pty logs from Window 2:

2023-06-29 12:10:40.105 [warning] Couldn't get layout info, a terminal was probably disconnected Could not find pty on pty host
2023-06-29 12:10:40.702 [warning] Persistent process "1": Process had no disconnect runners but was an orphan
2023-06-29 12:10:40.702 [info] Persistent process reconnection "1"
2023-06-29 12:10:41.035 [info] Persistent process "1": Replaying 805 chars and 1 size events
2023-06-29 12:10:44.807 [warning] Persistent process "1": Process had no disconnect runners but was an orphan
2023-06-29 12:10:44.807 [info] Persistent process reconnection "1"
2023-06-29 12:10:44.887 [info] Persistent process "1": Replaying 805 chars and 1 size events

@alexdima this is a little confusing to me. No reconnect is meant to happen on restart, when updating node-pty gets replaced so it can’t be running, all processes are torn down and the pty host shuts down with the main process. Did you see this?

Yes, I see this every time when restarting to install a new version (Gear > Restart to Update) or when changing the setting "update.mode":

image

Just ran into this again. I have the same terminal restored in two distinct windows. I ran into this after restarting to update Insiders on macOS (I had 6 folders opened). The Pty Host log contains the following:

[2022-08-03 21:57:34.961] [ptyhost] [warning] Persistent process "3": Process had no disconnect runners but was an orphan
[2022-08-03 21:57:34.962] [ptyhost] [warning] Persistent process "3": Process had no disconnect runners but was an orphan
[2022-08-03 21:57:35.074] [ptyhost] [info] Persistent process "3": Replaying 937 chars and 1 size events
[2022-08-03 21:57:35.074] [ptyhost] [warning] Persistent process "2": Process had no disconnect runners but was an orphan
[2022-08-03 21:57:35.074] [ptyhost] [warning] Persistent process "4": Process had no disconnect runners but was an orphan
[2022-08-03 21:57:35.144] [ptyhost] [info] Persistent process "3": Replaying 937 chars and 1 size events
[2022-08-03 21:57:35.232] [ptyhost] [info] Persistent process "2": Replaying 154 chars and 1 size events
[2022-08-03 21:57:35.300] [ptyhost] [info] Persistent process "4": Replaying 1653 chars and 1 size events

https://user-images.githubusercontent.com/5047891/182702530-97d5a741-9f64-4a17-aa25-dc4e9f75f957.mp4

Maybe @joaomoreno might know if there’s a way to easily simulate a restart caused by an update. Alternatively, maybe you can try changing a setting like "update.mode" which shows the restart prompt. I think this also leads to the terminals attaching incorrectly.

@Tyriar @meganrogge Could the needed log statement to troubleshoot this on the terminal side be converted to an [info] log. That might help track down this bug sooner.

Just had this happen again, but once again I didn’t have trace logging on. I’ll try to leave it turned on for next time. Pty Host logs:

[2022-07-26 14:07:06.241] [ptyhost] [warning] Persistent process "1": Process had no disconnect runners but was an orphan
[2022-07-26 14:07:06.570] [ptyhost] [info] Persistent process "1": Replaying 5659 chars and 1 size events
[2022-07-26 14:44:36.944] [ptyhost] [warning] Persistent process "1": Process had no disconnect runners but was an orphan
[2022-07-26 14:44:36.983] [ptyhost] [info] Persistent process "1": Replaying 4909 chars and 1 size events
[2022-07-26 14:44:36.999] [ptyhost] [info] Persistent process "3": Replaying 6314 chars and 1 size events
[2022-07-26 14:44:37.003] [ptyhost] [info] Persistent process "4": Replaying 7534 chars and 1 size events
[2022-07-26 14:45:04.436] [ptyhost] [info] Persistent process "1": Replaying 4909 chars and 1 size events
[2022-07-26 14:45:04.440] [ptyhost] [info] Persistent process "5": Replaying 6408 chars and 1 size events
[2022-07-26 14:45:04.446] [ptyhost] [info] Persistent process "6": Replaying 7534 chars and 1 size events
[2022-07-26 14:45:32.988] [ptyhost] [info] Persistent process "2": The reconnection grace time of 1m has expired, shutting down pid "34528"
[2022-07-26 14:46:43.492] [ptyhost] [info] Persistent process "1": Replaying 4909 chars and 1 size events
[2022-07-26 14:46:43.643] [ptyhost] [info] Persistent process "5": Replaying 6408 chars and 1 size events
[2022-07-26 14:46:43.649] [ptyhost] [info] Persistent process "6": Replaying 7534 chars and 1 size events
[2022-07-26 14:50:59.224] [ptyhost] [info] Persistent process "1": Replaying 4909 chars and 1 size events
[2022-07-26 14:50:59.242] [ptyhost] [info] Persistent process "7": Replaying 10881 chars and 1 size events
[2022-07-26 14:50:59.248] [ptyhost] [info] Persistent process "8": Replaying 9657 chars and 1 size events
[2022-07-26 14:50:59.250] [ptyhost] [info] Persistent process "9": Replaying 2716 chars and 1 size events
[2022-07-26 14:51:44.045] [ptyhost] [info] Persistent process "1": Replaying 4909 chars and 1 size events
[2022-07-26 14:51:44.047] [ptyhost] [info] Persistent process "9": Replaying 2716 chars and 1 size events
[2022-07-26 14:51:44.051] [ptyhost] [info] Persistent process "10": Replaying 10707 chars and 1 size events
[2022-07-26 14:51:44.057] [ptyhost] [info] Persistent process "11": Replaying 9657 chars and 1 size events
[2022-07-26 14:55:55.433] [ptyhost] [info] Persistent process "1": Replaying 4909 chars and 1 size events
[2022-07-26 14:55:55.538] [ptyhost] [info] Persistent process "9": Replaying 2716 chars and 1 size events
[2022-07-26 14:55:55.541] [ptyhost] [info] Persistent process "13": Replaying 4087 chars and 1 size events
[2022-07-26 14:55:55.557] [ptyhost] [info] Persistent process "12": Replaying 3927 chars and 1 size events
[2022-07-26 14:56:41.345] [ptyhost] [info] Persistent process "1": Replaying 4909 chars and 1 size events
[2022-07-26 14:56:41.347] [ptyhost] [info] Persistent process "15": Replaying 0 chars and 1 size events
[2022-07-26 14:58:03.461] [ptyhost] [info] Persistent process "1": Replaying 4909 chars and 1 size events
[2022-07-26 14:58:03.467] [ptyhost] [info] Persistent process "16": Replaying 95 chars and 1 size events
[2022-07-26 15:27:11.370] [ptyhost] [info] Persistent process "21": Replaying 32 chars and 1 size events

Window logs:

[2022-07-26 14:06:58.897] [renderer2] [error] [ms-vscode.remote-repositories]: notebook/cell/executePrimary is a proposed menu identifier. It requires 'package.json#enabledApiProposals: ["notebookEditor"]' and is only available when running out of dev or with the following command line switch: --enable-proposed-api ms-vscode.remote-repositories
[2022-07-26 14:07:03.314] [renderer2] [error] SyntaxError: Unexpected token A in JSON at position 0
    at JSON.parse (<anonymous>)
    at I.$getPassword (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code%20Insiders/resources/app/out/vs/workbench/workbench.desktop.main.js:1705:49637)
[2022-07-26 14:44:13.436] [renderer2] [warning] Settings pattern "keyboard.*" doesn't match any settings
[2022-07-26 14:44:33.965] [renderer2] [warning] Settings pattern "keyboard.*" doesn't match any settings
[2022-07-26 14:44:34.923] [renderer2] [error] [ms-vscode.remote-repositories]: notebook/cell/executePrimary is a proposed menu identifier. It requires 'package.json#enabledApiProposals: ["notebookEditor"]' and is only available when running out of dev or with the following command line switch: --enable-proposed-api ms-vscode.remote-repositories
[2022-07-26 14:44:36.434] [renderer2] [warning] Settings pattern "keyboard.*" doesn't match any settings
[2022-07-26 14:44:36.994] [renderer2] [error] SyntaxError: Unexpected token A in JSON at position 0
    at JSON.parse (<anonymous>)
    at I.$getPassword (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code%20Insiders/resources/app/out/vs/workbench/workbench.desktop.main.js:1705:49637)
[2022-07-26 14:44:38.722] [renderer2] [warning] Settings pattern "keyboard.*" doesn't match any settings
[2022-07-26 14:44:58.384] [renderer2] [warning] Settings pattern "keyboard.*" doesn't match any settings
[2022-07-26 14:45:01.227] [renderer2] [error] [ms-vscode.remote-repositories]: notebook/cell/executePrimary is a proposed menu identifier. It requires 'package.json#enabledApiProposals: ["notebookEditor"]' and is only available when running out of dev or with the following command line switch: --enable-proposed-api ms-vscode.remote-repositories
[2022-07-26 14:45:02.502] [renderer2] [warning] Settings pattern "keyboard.*" doesn't match any settings
[2022-07-26 14:45:03.249] [renderer2] [error] SyntaxError: Unexpected token A in JSON at position 0
    at JSON.parse (<anonymous>)
    at I.$getPassword (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code%20Insiders/resources/app/out/vs/workbench/workbench.desktop.main.js:1705:49637)
[2022-07-26 14:45:03.424] [renderer2] [warning] Settings pattern "keyboard.*" doesn't match any settings
[2022-07-26 14:45:05.702] [renderer2] [warning] Settings pattern "keyboard.*" doesn't match any settings
[2022-07-26 14:46:37.505] [renderer2] [warning] Settings pattern "keyboard.*" doesn't match any settings
[2022-07-26 14:46:40.309] [renderer2] [error] [ms-vscode.remote-repositories]: notebook/cell/executePrimary is a proposed menu identifier. It requires 'package.json#enabledApiProposals: ["notebookEditor"]' and is only available when running out of dev or with the following command line switch: --enable-proposed-api ms-vscode.remote-repositories
[2022-07-26 14:46:41.522] [renderer2] [warning] Settings pattern "keyboard.*" doesn't match any settings
[2022-07-26 14:46:42.292] [renderer2] [error] SyntaxError: Unexpected token A in JSON at position 0
    at JSON.parse (<anonymous>)
    at I.$getPassword (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code%20Insiders/resources/app/out/vs/workbench/workbench.desktop.main.js:1705:49637)
[2022-07-26 14:46:42.482] [renderer2] [warning] Settings pattern "keyboard.*" doesn't match any settings
[2022-07-26 14:46:44.951] [renderer2] [warning] Settings pattern "keyboard.*" doesn't match any settings
[2022-07-26 14:50:52.697] [renderer2] [warning] Settings pattern "keyboard.*" doesn't match any settings
[2022-07-26 14:50:55.311] [renderer2] [error] [ms-vscode.remote-repositories]: notebook/cell/executePrimary is a proposed menu identifier. It requires 'package.json#enabledApiProposals: ["notebookEditor"]' and is only available when running out of dev or with the following command line switch: --enable-proposed-api ms-vscode.remote-repositories
[2022-07-26 14:50:56.582] [renderer2] [warning] Settings pattern "keyboard.*" doesn't match any settings
[2022-07-26 14:50:57.630] [renderer2] [error] SyntaxError: Unexpected token A in JSON at position 0
    at JSON.parse (<anonymous>)
    at I.$getPassword (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code%20Insiders/resources/app/out/vs/workbench/workbench.desktop.main.js:1705:49637)
[2022-07-26 14:50:58.169] [renderer2] [warning] Settings pattern "keyboard.*" doesn't match any settings
[2022-07-26 14:51:00.342] [renderer2] [warning] Settings pattern "keyboard.*" doesn't match any settings
[2022-07-26 14:51:37.269] [renderer2] [warning] Settings pattern "keyboard.*" doesn't match any settings
[2022-07-26 14:51:40.340] [renderer2] [error] [ms-vscode.remote-repositories]: notebook/cell/executePrimary is a proposed menu identifier. It requires 'package.json#enabledApiProposals: ["notebookEditor"]' and is only available when running out of dev or with the following command line switch: --enable-proposed-api ms-vscode.remote-repositories
[2022-07-26 14:51:41.614] [renderer2] [warning] Settings pattern "keyboard.*" doesn't match any settings
[2022-07-26 14:51:42.513] [renderer2] [error] SyntaxError: Unexpected token A in JSON at position 0
    at JSON.parse (<anonymous>)
    at I.$getPassword (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code%20Insiders/resources/app/out/vs/workbench/workbench.desktop.main.js:1705:49637)
[2022-07-26 14:51:43.059] [renderer2] [warning] Settings pattern "keyboard.*" doesn't match any settings
[2022-07-26 14:51:45.274] [renderer2] [warning] Settings pattern "keyboard.*" doesn't match any settings
[2022-07-26 14:55:51.511] [renderer2] [error] [ms-vscode.remote-repositories]: notebook/cell/executePrimary is a proposed menu identifier. It requires 'package.json#enabledApiProposals: ["notebookEditor"]' and is only available when running out of dev or with the following command line switch: --enable-proposed-api ms-vscode.remote-repositories
[2022-07-26 14:55:54.102] [renderer2] [error] SyntaxError: Unexpected token A in JSON at position 0
    at JSON.parse (<anonymous>)
    at I.$getPassword (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code%20Insiders/resources/app/out/vs/workbench/workbench.desktop.main.js:1705:49637)
[2022-07-26 14:56:37.809] [renderer2] [error] [ms-vscode.remote-repositories]: notebook/cell/executePrimary is a proposed menu identifier. It requires 'package.json#enabledApiProposals: ["notebookEditor"]' and is only available when running out of dev or with the following command line switch: --enable-proposed-api ms-vscode.remote-repositories
[2022-07-26 14:56:40.564] [renderer2] [error] SyntaxError: Unexpected token A in JSON at position 0
    at JSON.parse (<anonymous>)
    at I.$getPassword (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code%20Insiders/resources/app/out/vs/workbench/workbench.desktop.main.js:1705:49637)
[2022-07-26 14:58:01.322] [renderer2] [error] [ms-vscode.remote-repositories]: notebook/cell/executePrimary is a proposed menu identifier. It requires 'package.json#enabledApiProposals: ["notebookEditor"]' and is only available when running out of dev or with the following command line switch: --enable-proposed-api ms-vscode.remote-repositories
[2022-07-26 14:58:03.533] [renderer2] [error] SyntaxError: Unexpected token A in JSON at position 0
    at JSON.parse (<anonymous>)
    at I.$getPassword (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code%20Insiders/resources/app/out/vs/workbench/workbench.desktop.main.js:1705:49637)
[2022-07-26 15:28:22.254] [renderer2] [error] [ms-vscode.remote-repositories]: notebook/cell/executePrimary is a proposed menu identifier. It requires 'package.json#enabledApiProposals: ["notebookEditor"]' and is only available when running out of dev or with the following command line switch: --enable-proposed-api ms-vscode.remote-repositories
[2022-07-26 15:28:22.508] [renderer2] [error] [Extension Host] Extension `ms-python.python` is already registered
[2022-07-26 16:05:38.697] [renderer2] [info] Webgl lost context, disposing of webgl renderer
[2022-07-26 16:05:39.171] [renderer2] [info] Webgl lost context, disposing of webgl renderer

We should review the code around terminal adoption of orphan processes, I suspect the issue is that it’s not transactional.

Yes it would be very helpful @alexr00. I spent 90 mins yesterday trying to reproduce to no avail. If you could enable trace logging too in case you repro, that might give the insight we need

In case it is important to the issue, I’m just saying that the drop-on-document terminal that was wrongly attached to the vscode window hadn’t yet been attached to the drop-on-document window, because it was from some earlier session.

Sorry, I cursed myself because this happened again today but I probably won’t have consistent repro steps. I reloaded the window with my vscode workspace and got a terminal from this extension sample which is also open in another window, although the terminal panel had not been made visible in that other window’s session yet.

I reloaded the window several more times and always got the right terminal after that.

image

@meganrogge exiting the application (cmd+q) and reopening it is essentially what happens on update