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

[6.0.2] Call sync connection close instead of async #26943

Merged
merged 1 commit into from
Dec 15, 2021

Conversation

roji
Copy link
Member

@roji roji commented Dec 8, 2021

Fixes #26790, replaces #26793

Description

As part of logging path optimizations in 6.0, an (unawaited) async connection Close method call was accidentally introduced in a synchronous code path. In addition, while investigating this some cases of missing ConfigureAwait(false) were discovered.

Customer impact

In some providers, where pooling isn't used, the unawaited async call causes a race condition with unknown effects, potentially crashing the application. The cases of missing ConfigureAwait(false) could potentially cause EF Core code to run in the user's synchronization context instead of on the thread pool.

How found

A customer reported the unawaited async call on 6.0. The other two issues were found as a result of fixing an analyzer issue which suppressed warnings.

Regression

Yes, from 5.0.

Testing

Verifying that an async method is called instead of a sync one isn't feasible.

Risk

Very low - an obvious one line fix to an obvious copy-paste mistake for the unawaited async call, and trivial additions of ConfigureAwait(false) where missing.

@roji roji requested a review from a team December 8, 2021 13:20
@roji roji changed the base branch from main to release/6.0 December 8, 2021 13:22
@roji roji changed the title Call sync connection close instead of async [6.0.2] Call sync connection close instead of async Dec 8, 2021
Also add missing ConfigureAwait(false) and StringComparison.Ordinal,
because of a configuration mismatch between FxCop and the built-in
diagnostics analyzers.

Fixes dotnet#26790
@leecow leecow modified the milestones: 6.0.x, 6.0.2 Dec 14, 2021
@ajcvickers ajcvickers merged commit 9dd028f into dotnet:release/6.0 Dec 15, 2021
@ajcvickers ajcvickers removed this from the 6.0.2 milestone Dec 15, 2021
@roji roji deleted the AsyncStuff6.0 branch December 15, 2021 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RelationalConnection.Close calls async function
4 participants