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

opening folder with "code --reuse-window ." command effects all open windows #121926

Closed
iainvm opened this issue Apr 22, 2021 · 15 comments · Fixed by #158635
Closed

opening folder with "code --reuse-window ." command effects all open windows #121926

iainvm opened this issue Apr 22, 2021 · 15 comments · Fixed by #158635
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority insiders-released Patch has been released in VS Code Insiders papercut 🩸 A particularly annoying issue impacting someone on the team remote Remote system operations issues terminal General terminal issues that don't fall under another label verified Verification succeeded workbench-cli VS Code Command line issues
Milestone

Comments

@iainvm
Copy link

iainvm commented Apr 22, 2021

Issue Type: Bug

  • Open project1 in vscode
  • Open project2 in vscode
  • In the integrated terminal of vscode project2 run command code --reuse-window ../project3

Expected behaviour:
Window that was project2 should now have project3 open.

Actual Result:
All vscode windows change to have project3 open.

Possibly related to #118718

VS Code version: Code 1.55.2 (3c4e3df, 2021-04-13T09:35:57.887Z)
OS version: Windows_NT x64 10.0.19042
Remote OS version: Linux x64 5.4.0-48-generic
Remote OS version: Linux x64 5.4.0-48-generic

System Info
Item Value
CPUs Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz (12 x 2592)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
protected_video_decode: enabled
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 15.75GB (7.22GB free)
Process Argv -n --crash-reporter-id 0d0b1ade-99e4-4fbe-bb6a-11c2df9f1a81
Screen Reader no
VM 0%
Item Value
Remote SSH: brokkr
OS Linux x64 5.4.0-48-generic
CPUs Intel(R) Xeon(R) Gold 5120 CPU @ 2.20GHz (4 x 2194)
Memory (System) 7.75GB (0.55GB free)
VM 17%
Item Value
Remote SSH: brokkr
OS Linux x64 5.4.0-48-generic
CPUs Intel(R) Xeon(R) Gold 5120 CPU @ 2.20GHz (4 x 2194)
Memory (System) 7.75GB (0.55GB free)
VM 17%
Extensions (28)
Extension Author (truncated) Version
vsc-material-theme Equ 33.1.2
vsc-material-theme-icons equ 1.2.2
remote-ssh ms- 0.65.4
remote-ssh-edit ms- 0.65.4
env-cmd-file-syntax Nix 0.2.2
swagger-viewer Arj 3.0.1
atlascode atl 2.8.6
gitignore cod 0.6.0
vscode-markdownlint Dav 0.40.3
gitlens eam 11.4.1
pipenv-scripts Fed 1.0.3
rest-client hum 0.24.5
git-graph mhu 1.30.0
python ms- 2021.4.765268190
jupyter ms- 2021.5.745244803
vsliveshare ms- 1.0.4131
vsliveshare-audio ms- 0.1.91
vsliveshare-pack ms- 0.4.0
autodocstring njp 0.5.4
open-in-new-window ona 1.0.0
vscode-yaml red 0.18.0
rust rus 0.7.8
vscode-coverage-gutters rya 2.7.2
file-tree-generator Shi 1.1.1
markdowntable Tak 0.5.1
serverless-ide-vscode Thr 0.5.31
shellcheck tim 0.14.1
markdown-all-in-one yzh 3.4.0

(1 theme extensions excluded)

A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383:30185418
pythonvspyt678:30270856
pythonvspyt602:30291499
vspor879:30202332
vspor708:30202333
vspor363:30204092
vstry914:30276682
pythonvsdeb440:30248342
pythonvsded773:30248341
pythonvspyt875:30259475
pythonvspyt639:30291489
pythontb:30283811
pythonvspyt551cf:30291415
vspre833cf:30267465
pythonptprofiler:30281270
vsdfh931cf:30280410
vshan820:30276952
pythondataviewer:30285071
vscus158cf:30286554

@bpasero bpasero assigned aeschli and unassigned bpasero Apr 22, 2021
@bpasero bpasero added the remote Remote system operations issues label Apr 22, 2021
@bpasero
Copy link
Member

bpasero commented Apr 22, 2021

This seems specific to remote when I see the details in the issue.

@iainvm
Copy link
Author

iainvm commented Apr 22, 2021

When asking a co-worker to try reproduce they didn't see the issue, they were not using remote.

So yes this might be an issue when using remote.

@aeschli
Copy link
Contributor

aeschli commented Apr 23, 2021

I can reproduce.

  • open 2 WSL window
  • in the dev tools of both windows set breakpoints in mainThreadCLICommands where _remoteCLI.windowOpen is handled
  • in one of the terminals run code -r someFolder (resp code-insiders or code.sh|bat)
  • both breakpoints are hit

Looks like a regression introduced by the refactoring to make the terminal process a child of server process.

Each terminal process runs a CLI server that is used by thecode command. That server talks to a renderer window, which should be the window in which the terminal is used. That window then talks to main with the reload.

@alexdima
Copy link
Member

  • I cannot reproduce in 1.53.2
  • I cannot reproduce in 1.54.3
  • I can reproduce in 1.55.2

@Tyriar @meganrogge I think this was working correctly in the past with the server spawned terminals, but it was introduced by a more recent refactoring

@alexdima alexdima assigned Tyriar and meganrogge and unassigned alexdima Apr 23, 2021
@alexdima alexdima added terminal General terminal issues that don't fall under another label bug Issue identified by VS Code Team member as probable bug labels Apr 23, 2021
@iainvm
Copy link
Author

iainvm commented Apr 23, 2021

Yes, this is recent issue, as my usual workflow has been to move to the project in the integrated terminal and use code -r . to open the project, and I try to stay up to date with VSCode versions.

@taikulawo
Copy link

It's a bug. -r has be broken a long time 😢 @Tyriar @meganrogge

Version: 1.56.2
Commit: 054a9295330880ed74ceaedda236253b4f39a335
Date: 2021-05-12T17:44:30.902Z
Electron: 12.0.4
Chrome: 89.0.4389.114
Node.js: 14.16.0
V8: 8.9.255.24-electron.0
OS: Darwin x64 20.4.0

@taikulawo
Copy link

Still not fixed. I found it have been moved to Backlog, It's a bug which broken -r option, When it will be fixed?

@mirdaki
Copy link

mirdaki commented Aug 30, 2021

I'm having a similar issue with my git config editor (git config --global core.editor "code -w -r"). It used to open the commit message in the existing window and now it opens a new one.

Version: 1.59.1 (user setup)
Commit: 3866c3553be8b268c8a7f8c0482c0c0177aa8bfa
Date: 2021-08-19T11:56:46.957Z
Electron: 13.1.7
Chrome: 91.0.4472.124
Node.js: 14.16.0
V8: 9.1.269.36-electron.0
OS: Windows_NT x64 10.0.19043

I also suspect #131731 is related

@meganrogge since it looks you're assigned to both this and that issue

@Tyriar Tyriar added the workbench-cli VS Code Command line issues label Oct 18, 2021
@reinaldo-calderon-team
Copy link

yup, same here, I'm still using the old version 1.56.2 due to this issue

@mirdaki
Copy link

mirdaki commented Feb 17, 2022

I have been able to temporarily fix this issue by starting up VSCode with extensions disabled. It works when disabled, it works immediately after enabling them again, and works for a days after still. Then randomly stops. Not had enough experiences with the "workaround" to detect a pattern yet. Happy to help isolate this issue if someone wants to reach out to me

@TyIsI
Copy link

TyIsI commented Mar 9, 2022

Came here from issue #5930.

Since that issue is closed and it seems related, I figured I'd update here: in the hopes that this helps narrow it down a little.

Breakdown:

  • This happens on version 1.65.1. (Local is Windows 10, remote is Linux/Ubuntu over Windows SSH. No ControlMaster.)
  • This happens both on windows opened from within an existing remote session (remote ->terminal -> cd -> code .) as for new remote sessions (new window -> connect current window to host -> select host -> open folder)
  • While starting the create-react-app scripts via yarn start, it adds the automatically created port forward to all open windows and then opens a tab for every remote in the local environment.

I've set up a repository with a test case:

https://github.com/TyIsI/vscode-portforward-quirk

And even more peculiar, this triggers existing port forwards to open as tabs (9 in total - 6 from my main project and 3 from the above test).

image

Version:

Version: 1.65.1 (user setup)
Commit: 8908a9c
Date: 2022-03-08T02:06:27.846Z
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.19043

Let me know if you need me to create a separate issue.

@bpasero
Copy link
Member

bpasero commented Aug 2, 2022

@Tyriar @meganrogge the result is N windows on the same workspace identifier, which is something that could result in all sorts of issues and is generally unsupported in VSCode.

Marking this important for the current milestone.

image

@Tyriar
Copy link
Member

Tyriar commented Aug 19, 2022

I believe this started happening when we introduced the pty host as the message gets broadcast to all windows:

this._remoteTerminalChannel.onExecuteCommand(async e => {
const reqId = e.reqId;
const commandId = e.commandId;
if (!allowedCommands.includes(commandId)) {
this._remoteTerminalChannel.sendCommandResult(reqId, true, 'Invalid remote cli command: ' + commandId);
return;
}
const commandArgs = e.commandArgs.map(arg => revive(arg));
try {
const result = await this._commandService.executeCommand(e.commandId, ...commandArgs);
this._remoteTerminalChannel.sendCommandResult(reqId, false, result);
} catch (err) {
this._remoteTerminalChannel.sendCommandResult(reqId, true, err);
}
});

But we don't check the pty exists unlike other calls like this:

this._remoteTerminalChannel.onProcessExit(e => {
const pty = this._ptys.get(e.id);
if (pty) {
pty.handleExit(e.event);
this._ptys.delete(e.id);
}
});

It does not repro in the test resolver because each window gets its own server and pty host.

Debt item here would fix this: #133895

@Tyriar
Copy link
Member

Tyriar commented Aug 19, 2022

Created a PR for this #158635, couldn't test it in Code - OSS though so we'll need to verify when it gets released.

@vscodenpa vscodenpa added the unreleased Patch has not yet been released in VS Code Insiders label Aug 19, 2022
@bpasero
Copy link
Member

bpasero commented Aug 20, 2022

Thanks!!

@vscodenpa vscodenpa added insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels Aug 22, 2022
@roblourens roblourens added the verified Verification succeeded label Aug 25, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Oct 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority insiders-released Patch has been released in VS Code Insiders papercut 🩸 A particularly annoying issue impacting someone on the team remote Remote system operations issues terminal General terminal issues that don't fall under another label verified Verification succeeded workbench-cli VS Code Command line issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.