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

Properly synchronise terminalTaskSystem._activeTasks #180581

Closed
wants to merge 1 commit into from

Conversation

markw65
Copy link
Contributor

@markw65 markw65 commented Apr 21, 2023

Fixes #180578

This fixes the issue by keeping a map of tasks that have been passed to _executeTask, but which haven't yet been added to _activeTasks.

Code that needs to synchronise with _activeTasks waits on the corresponding _activatingTasks promise, which will resolve when the task is actually added to _activeTasks (or when an error causes it to not be started).

Fixes microsoft#180578

This fixes the issue by keeping a map of tasks that have been passed
to _executeTask, but which haven't yet been added to _activeTasks.

Code that needs to synchronise with _activeTasks waits on the corresponding
_activatingTasks promise, which will resolve when the task is actually added to
_activeTasks (or when an error causes it to not be started).
@markw65
Copy link
Contributor Author

markw65 commented Apr 21, 2023

I'll just note that while I'm pretty sure this works, and closes the race, I think a cleaner approach would repurpose _activeTasks instead of creating the new _activatingTasks map.

Basically _executeTask would add an entry to _activeTasks before starting to look at its dependents. This would mean that the terminal in IActiveTerminalData would have to be optional (because we don't have a terminal for it yet). And then the terminal would be added once the terminal is determined.

I started down that route, but there are many uses of _activeTasks where I struggled (due to lack of familiarity with the code) to determine what the correct behavior would be if there was no terminal. So I went with this instead. I'd be happy to try again if that seems like a better approach.

@markw65
Copy link
Contributor Author

markw65 commented Apr 22, 2023

I thought about this some more, and #180617 seems like a much better solution

@markw65 markw65 closed this Apr 22, 2023
@markw65 markw65 deleted the synchronize-active-tasks branch May 10, 2023 21:37
@github-actions github-actions bot locked and limited conversation to collaborators Jun 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

There is a race starting dependent tasks
2 participants