Skip to content

Fix async race condition in the tree - #82881

Merged
Isidor Nikolic (isidorn) merged 2 commits into
microsoft:masterfrom
solomatov:reveal_fix
Oct 23, 2019
Merged

Fix async race condition in the tree#82881
Isidor Nikolic (isidorn) merged 2 commits into
microsoft:masterfrom
solomatov:reveal_fix

Conversation

@solomatov

Copy link
Copy Markdown
Contributor

This PR fixes #82290

The following was done:

  • Introduced _isDisposed field on the ExplorerItem class
  • Set it to true when children are deleted from the active tree
  • Check that nodes are not disposed in the code revealing resource, and if they are disposed start over

@isidorn

Copy link
Copy Markdown

Thank you for the PR and your investigation from #82290
At the end of the day you are checking if the item got disposed and if yes start over. In theory none of the items should be disposed which are in the model, so we can try to fix this one level sooner?
Maybe instead of introducing the whole dispose logic we should fire the onDidSelectResource with a timeout of 0 here. Or react with a timeout here

Konstantin Solomatov (@solomatov) did you also check that your fix trully fixes the issue
João Moreno (@joaomoreno) can you also take a look, would be interested in what you have to say. Thanks

@joaomoreno João Moreno (joaomoreno) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overall this makes sense. Given that the model has a forgetChildren, it serves as a great starting point to remember that those children should not be give to the tree.

Comment thread src/vs/workbench/contrib/files/browser/views/explorerView.ts Outdated
Comment thread src/vs/workbench/contrib/files/browser/views/explorerView.ts Outdated
@solomatov

Copy link
Copy Markdown
Contributor Author

Added a retry count in a new commit.

@solomatov

Copy link
Copy Markdown
Contributor Author

Isidor Nikolic (@isidorn) Concerning the applicability of this, my understanding of the problem is that children are loaded asynchronously, and we can't do anything with it. It's nodejs, and if we use sync calls, UI wouldn't be so responsive.

@isidorn

Copy link
Copy Markdown

Let's go with this PR and push it to insiders to get user feedback.
The code is not so nice, but it is a decent workaround until we get something better.
Thank you for your PR Konstantin Solomatov (@solomatov)

@isidorn
Isidor Nikolic (isidorn) merged commit f71a0cf into microsoft:master Oct 23, 2019
@isidorn Isidor Nikolic (isidorn) added this to the October 2019 milestone Oct 23, 2019
@isidorn Isidor Nikolic (isidorn) added the file-explorer Explorer widget issues label Oct 23, 2019
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

file-explorer Explorer widget issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reveal in Sidebar crashes

3 participants