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

Conversation

@solomatov
Copy link
Contributor

solomatov commented Oct 19, 2019

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

This comment has been minimized.

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 left a comment

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

This comment has been minimized.

Copy link
Contributor Author

solomatov commented Oct 21, 2019

Added a retry count in a new commit.

@solomatov

This comment has been minimized.

Copy link
Contributor Author

solomatov commented Oct 21, 2019

@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

This comment has been minimized.

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
2 checks passed
2 checks passed
VS Code #20191021.39 succeeded
Details
license/cla All CLA requirements met.
Details
@isidorn isidorn added this to the October 2019 milestone Oct 23, 2019
@solomatov solomatov deleted the solomatov:reveal_fix branch Nov 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.