live-share icon indicating copy to clipboard operation
live-share copied to clipboard

Cmd+P fails to function because VS Code Live Share does not have directory loop detection

Open klakin-pivotal opened this issue 4 years ago • 5 comments

Describe what happened: Cmd+P to search for files by filename only will find files that have already been opened in a local editor.

What was your system configuration? Product and Version: VSCode 1.45.0 OS Version: MacOS 10.14.4 Live Share Extension Version: 1.0.2106 Target Platform or Language [e.g. Node.js]: Ruby

Steps to Reproduce / Scenario: [Host] - Create a project that has a symlink that creates a directory loop. e.g. mkdir -p one/two; cd one/two; ln -s three ../../ [Host] - Start a Live Share session [Guest] - Attach to that Live Share session [Guest] - Press Cmd+P to search by filename. Notice that it fails to find files that you haven't already opened in an editor.

Probable root cause: An intentional directory loop caused by a symlink in the vendor directory of a gem in the project causes a failure in the Agent. We see evidence of this in ..._Agent.log exported from the Export Logs feature. The following snippet is repeated many, many times in the ..._Agent.log in the Export Logs bundle:

[2020-05-14 17:59:30.195 Agent.Rpc.Workspace V] > #4 {Id=196 Name=syncService.checkSync}
[2020-05-14 17:59:30.195 Agent.Rpc.Workspace V] < #5 {Id=186 Name=syncService.checkSync}
[2020-05-14 17:59:30.687 Agent.Rpc.Workspace V] > #5 {Id=186}
[2020-05-14 17:59:30.687 Agent.Rpc.Workspace V] < #4 {Id=196}
[2020-05-14 17:59:32.710 Agent.Rpc.Workspace V] > #1 {Id=1220 Name=syncService.checkSync}
[2020-05-14 17:59:32.710 Agent.Rpc.Workspace V] < #3 {Id=1210 Name=syncService.checkSync}
[2020-05-14 17:59:33.203 Agent.Rpc.Workspace V] > #3 {Id=1210}
[2020-05-14 17:59:33.203 Agent.Rpc.Workspace V] < #1 {Id=1220}
[2020-05-14 17:59:35.691 Agent.Rpc.Workspace V] > #4 {Id=197 Name=syncService.checkSync}
[2020-05-14 17:59:35.691 Agent.Rpc.Workspace V] < #5 {Id=187 Name=syncService.checkSync}
[2020-05-14 17:59:35.900 Agent.Rpc.Workspace V] > #4 {Id=198 Name=file.getFiles}
[2020-05-14 17:59:35.900 Agent.Rpc.Workspace V] < #5 {Id=188 Name=file.getFiles}
[2020-05-14 17:59:36.185 Agent.Rpc.Workspace V] > #5 {Id=187}
[2020-05-14 17:59:36.185 Agent.Rpc.Workspace V] < #4 {Id=197}
[2020-05-14 17:59:36.366 Agent.Rpc.Workspace V] > #5 {Id=188 Error={Code=-32098 Message=The path '/Users/$USER/workspace/installation/gems/$GEM_NAME/vendor/installation/gems/$GEM_NAME/vendor/installation/gems/$GEM_NAME/vendor/installation/gems/$GEM_NAME/vendor/installation/gems/$GEM_NAME/vendor/installation/gems/$GEM_NAME/vendor/installation/gems/$GEM_NAME/vendor/installation/gems/$GEM_NAME/vendor/installation/gems/$GEM_NAME/vendor/installation/gems/$GEM_NAME/vendor/installation/gems/$GEM_NAME/vendor/installation/gems/$GEM_NAME/vendor/installation/gems/$GEM_NAME/vendor/installation/gems/$GEM_NAME/vendor/installation/gems/$GEM_NAME/vendor/installation/gems/$GEM_NAME/vendor/installation/gems/$GEM_NAME/vendor/installation/gems/$GEM_NAME/vendor/installation/gems/$GEM_NAME/vendor/installation/gems/$GEM_NAME/vendor/installation/web/node_modules/puppeteer/.local-chromium/mac-686378/chrome-mac/Chromium.app/Contents/Frameworks/Chromium Framework.framework/Versions/78.0.3882.0/XPCServices/AlertNotificationService.xpc/Contents/MacOS/AlertNotificationService' is too long, or a component of the specified path is too long. Data=(StackTrace=System.IO.PathTooLongException: The path '/Users/$USER/workspace/installation/gems/$GEM_NAME/vendor/installation/gems/$GEM_NAME/vendor/installation/gems/$GEM_NAME/vendor/installation/gems/$GEM_NAME/vendor/installation/gems/$GEM_NAME/vendor/installation/gems/$GEM_NAME/vendor/installation/gems/$GEM_NAME/vendor/installation/gems/$GEM_NAME/vendor/installation/gems/$GEM_NAME/vendor/installation/gems/$GEM_NAME/vendor/installation/gems/$GEM_NAME/vendor/installation/gems/$GEM_NAME/vendor/installation/gems/$GEM_NAME/vendor/installation/gems/$GEM_NAME/vendor/installation/gems/$GEM_NAME/vendor/installation/gems/$GEM_NAME/vendor/installation/gems/$GEM_NAME/vendor/installation/gems/$GEM_NAME/vendor/installation/gems/$GEM_NAME/vendor/installation/gems/$GEM_NAME/vendor/installation/web/node_modules/puppeteer/.local-chromium/mac-686378/chrome-mac/Chromium.app/Contents/Frameworks/Chromium Framework.framework/Versions/78.0.3882.0/XPCServices/AlertNotificationService.xpc/Contents/MacOS/AlertNotificationService' is too long, or a component of the specified path is too long.
   at System.IO.FileStatus.EnsureStatInitialized(ReadOnlySpan`1 path, Boolean continueOnError)
   at System.IO.FileSystemInfo.Init(FileStatus& fileStatus)
   at System.IO.FileSystemInfo.Create(String fullPath, String fileName, FileStatus& fileStatus)
   at System.IO.Enumeration.FileSystemEnumerator`1.MoveNext()
   at System.Collections.Generic.LargeArrayBuilder`1.AddRange(IEnumerable`1 items)
   at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source)
   at Microsoft.VisualStudio.Workspace.Indexing.IndexWorkspaceService.<>c__DisplayClass101_0.<<FindIndexedFilesAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.VisualStudio.Workspace.WorkspaceFolderHelper.FindFilesAsync(String rootPath, Boolean recursive, Func`2 handleDirectory, CancellationToken cancellationToken, PauseToken pauseToken)
   at Microsoft.VisualStudio.Workspace.WorkspaceFolderHelper.FindFilesAsync(String rootPath, Boolean recursive, Func`2 handleDirectory, CancellationToken cancellationToken, PauseToken pauseToken)
   at Microsoft.VisualStudio.Workspace.WorkspaceFolderHelper.FindFilesAsync(String rootPath, Boolean recursive, Func`2 handleDirectory, CancellationToken cancellationToken, PauseToken pauseToken)
   at Microsoft.VisualStudio.Workspace.WorkspaceFolderHelper.FindFilesAsync(String rootPath, Boolean recursive, Func`2 handleDirectory, CancellationToken cancellationToken, PauseToken pauseToken)
   at Microsoft.VisualStudio.Workspace.WorkspaceFolderHelper.FindFilesAsync(String rootPath, Boolean recursive, Func`2 handleDirectory, CancellationToken cancellationToken, PauseToken pauseToken)
   at Microsoft.VisualStudio.Workspace.WorkspaceFolderHelper.FindFilesAsync(String rootPath, Boolean recursive, Func`2 handleDirectory, CancellationToken cancellationToken, PauseToken pauseToken)
   at Microsoft.VisualStudio.Workspace.WorkspaceFolderHelper.FindFilesAsync(String rootPath, Boolean recursive, Func`2 handleDirectory, CancellationToken cancellationToken, PauseToken pauseToken)
   at Microsoft.VisualStudio.Workspace.WorkspaceFolderHelper.FindFilesAsync(String rootPath, Boolean recursive, Func`2 handleDirectory, CancellationToken cancellationToken, PauseToken pauseToken)
   at Microsoft.VisualStudio.Workspace.WorkspaceFolderHelper.FindFilesAsync(String rootPath, Boolean recursive, Func`2 handleDirectory, CancellationToken cancellationToken, PauseToken pauseToken)
   at Microsoft.VisualStudio.Workspace.WorkspaceFolderHelper.FindFilesAsync(String rootPath, Boolean recursive, Func`2 handleDirectory, CancellationToken cancellationToken, PauseToken pauseToken)
   at Microsoft.VisualStudio.Workspace.WorkspaceFolderHelper.FindFilesAsync(String rootPath, Boolean recursive, Func`2 handleDirectory, CancellationToken cancellationToken, Paus...

The installation symlink looks like

~/workspace/installation/gems/$GEM_NAME/vendor $ ls -l
total 0
lrwxr-xr-x  1 pivotal  staff  9 Apr  9 12:16 installation -> ../../../

When we remove that symlink and restart all VS Code instances (and the Live Share session), Cmd+P works correctly.

The exported logs contain sensitive information that we're uncomfortable sharing, but this should be easy enough to reproduce. (Yes, I know, this is never the case. :() Do let us know if you require additional information.

klakin-pivotal avatar May 14 '20 18:05 klakin-pivotal

cc: @mingxiao

klakin-pivotal avatar May 14 '20 18:05 klakin-pivotal

Hi Kenneth! thank you for reporting this issue. It sounds to me more like a feature request, we will review it and prioritize it appropriately.

c.c. @fubaduba

mlacouture avatar May 18 '20 21:05 mlacouture

I notice that this bug has been closed.

Has the problem been fixed?

klakin-pivotal avatar Apr 01 '21 16:04 klakin-pivotal

This issue has been automatically marked as stale because it has not had recent activity. It will be closed automatically in 2 days.

github-actions[bot] avatar Aug 15 '22 10:08 github-actions[bot]

Hey, can you please prevent your stalebot from closing this issue?

I ran into this bug again on Wednesday while working with a colleague while using the latest version of the extension and latest version of VS Code. This is still not fixed.

klakin-pivotal avatar Aug 15 '22 13:08 klakin-pivotal

We’re not able to prioritize this issue over the other higher-impact issues we receive every week, based on the votes and comments from others in the community and our understanding of the issue. However, rest assured that we love your input. If you feel it deserves to stay open, then clarify your use case and contact us to let us know how severe it’s for you.

fubaduba avatar Nov 08 '22 01:11 fubaduba

...clarify your use case and contact us to let us know how severe it’s for you.

I thought that the description and detailed reproduction steps that I put here were clear? https://github.com/MicrosoftDocs/live-share/issues/3535#issue-618445993. Let's try again, then.

This breaks Cmd+P. This means that remote participants in a Live Share session cannot search for files by filename, unless that file is already open in an editor. For trivial projects containing only a few hundred files, this might be acceptable, but for projects that have thousands-to-hundreds-of-thousands of files, this is a significant loss of functionality.

It has been two-and-a-half years(!) since I first made this report, but I do remember that this bug causes the project-file-selection-tree to fail to behave correctly:

  • I know that the title of the tree up at the top was stuck at something like Loading Contents..., rather than the name of the top-level directory.
    • This breaks the "copy path to file" feature in the editor tab, as it put that as the first component of the path, rather than the actual path component.
  • There was also something wrong with expanding parts of the tree. I think there were massive delays in loading parts of the project's file tree, but -again- it has been years since I reported the issue.

Symlink loop detection is table stakes for anything that runs on Linux or OSX, so I figured that the problem would be clear, and that listing the easiest to describe symptom would be fine. I suppose that neither was the case.

Here's hoping that you folks see your way clear to dragging in a Subject Matter Expert from elsewhere in Microsoft and spending the one-to-three days it would take to resolve this in your core filesystem traversal library.

klakin-pivotal avatar Nov 08 '22 22:11 klakin-pivotal

As far as "customer impact" goes, we waited a few months for you folks to fix this issue (see the "table stakes" comment above for why we thought this would be recognized as a low-effort, high-impact fix), and then stopped using Live Share.

We fell back to using Zoom Screen Sharing which sucks in a lot of ways, but is better tolerated by the team than smashing into the brick wall of this issue.

klakin-pivotal avatar Nov 08 '22 22:11 klakin-pivotal