Skip to content

Ensure we don't call out into arbitrary code directly when setting up our cache state#63132

Merged
CyrusNajmabadi merged 7 commits intodotnet:mainfrom
CyrusNajmabadi:taskRun
Aug 2, 2022
Merged

Ensure we don't call out into arbitrary code directly when setting up our cache state#63132
CyrusNajmabadi merged 7 commits intodotnet:mainfrom
CyrusNajmabadi:taskRun

Conversation

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor

@CyrusNajmabadi CyrusNajmabadi commented Aug 2, 2022

Followup to #63131

// cache state in RemoteWorkspace must always run fully to completion without issue. We don't want
// anything we call in the constructor to possibly prevent the constructor from running to completion.
var cancellationToken = this.CancellationToken;
_disconnectedSolutionTask = Task.Run(() => computeDisconnectedSolutionAsync(cancellationToken), cancellationToken);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this is to be hyper paranoid, but it is legitimately safer. Synchronously calling into a callback which runs abitrary code within this constructor is inherrently unsafe. If anything throws synchronously in that callback then this constructor won't finish, and the caller won't properly update cache state.

// cache state in RemoteWorkspace must always run fully to completion without issue. We don't want
// anything we call in this method to possibly prevent the method from running to completion.
var cancellationToken = this.CancellationToken;
_primaryBranchTask = Task.Run(() => ComputePrimaryBranchAsync(cancellationToken), cancellationToken);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

same issue. TryKickOffPrimaryBranchWork_NoLock must run to completion successfully.

@CyrusNajmabadi CyrusNajmabadi merged commit 8909116 into dotnet:main Aug 2, 2022
@ghost ghost added this to the Next milestone Aug 2, 2022
@CyrusNajmabadi CyrusNajmabadi deleted the taskRun branch August 2, 2022 19:54
@dibarbet dibarbet modified the milestones: Next, 17.4 P2 Sep 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants