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

Fix async race condition in the tree #82881

Merged
merged 2 commits into from
Oct 23, 2019
Merged

Fix async race condition in the tree #82881

merged 2 commits into from
Oct 23, 2019

Conversation

solomatov
Copy link
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
Contributor

isidorn commented Oct 21, 2019

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

@solomatov did you also check that your fix trully fixes the issue
@joaomoreno can you also take a look, would be interested in what you have to say. Thanks

Copy link
Member

@joaomoreno joaomoreno left a comment

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.

@solomatov
Copy link
Contributor Author

Added a retry count in a new commit.

@solomatov
Copy link
Contributor Author

@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
Contributor

isidorn commented Oct 23, 2019

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 @solomatov

@isidorn isidorn merged commit f71a0cf into microsoft:master Oct 23, 2019
@isidorn isidorn added this to the October 2019 milestone Oct 23, 2019
@isidorn isidorn added the file-explorer Explorer widget issues label Oct 23, 2019
@solomatov solomatov deleted the reveal_fix branch November 10, 2019 05:01
@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