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

delay project system init to avoid solution update race #2057

Merged
merged 3 commits into from
Jan 12, 2021

Conversation

corngood
Copy link
Contributor

I've been getting this error intermittently:

_logger.LogError($"Failed to add project to workspace: '{projectFileInfo.FilePath}'");

I tracked it down to a race between TryApplyChanges calls.

Adding the project happens on a worker thread, and is queued on the main thread inside:

projectSystem.Initalize(projectConfiguration);

I believe AddProject can be called on a worker thread any time after this.

The other call is on the main thread via:

ProvideWorkspaceOptions(compositionHost, workspace, options, logger, omnisharpEnvironment);

if (!workspace.TryApplyChanges(workspace.CurrentSolution.WithOptions(workspaceOptionsProvider.Process(workspace.Options, options.CurrentValue, omnisharpEnvironment))))

This change rearranges workspace init to avoid this particular race. It doesn't seem like anything attempts to retry solution changes, so if there are other races it may be a more serious problem.

@dnfadmin
Copy link

dnfadmin commented Dec 31, 2020

CLA assistant check
All CLA requirements met.

Copy link
Member

@filipw filipw left a comment

Choose a reason for hiding this comment

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

LGTM

@filipw
Copy link
Member

filipw commented Jan 6, 2021

@JoeRobich @david-driscoll @mholo65 do you have any comments on this?

@filipw filipw merged commit f889db6 into OmniSharp:master Jan 12, 2021
@filipw
Copy link
Member

filipw commented Jan 12, 2021

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants