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

Remove feature flag for EnableEnhancedScopes #1954

Closed
brettsam opened this issue Jul 8, 2021 · 1 comment
Closed

Remove feature flag for EnableEnhancedScopes #1954

brettsam opened this issue Jul 8, 2021 · 1 comment

Comments

@brettsam
Copy link
Member

brettsam commented Jul 8, 2021

The feature flag EnableEnhancedScopes changes how dependency injection scopes are resolved from within the JobHost. This was added to prevent any major breaking change, but it has fixed a number of dependency scoping problems for users without any known issues.

Without this flag, scopes are passed via an AsyncLocal which can be problematic in some scenarios (most notably when using HttpClient).

This was introduced here: Azure/azure-functions-host#6721

Motivation

We consider the new scope resolution behavior to be the correct behavior, but were trying to mitigate risk by hiding it behind a feature flag. We should use the new behavior going forward.

Impact

This will impact all customers as dependency resolution is used everywhere. It's a bigger impact to .NET in-proc customers, but we believe the behavior with the flag is the correct behavior.

Compat-mode support

We can introduce a DisableEnhancedScopes flag that puts things back the way they were in v3.

Alternatives

There's no real alternatives that don't involve changes to service resolution. There was a long investigation that led to this flag and behavior being added.

Detection

Not really. Before this flag, a number of odd ObjectDisposedExceptions and null-refs would be seen. Only when we got a number of issues around HttpClient usage did we start diving into the issue we were seeing.

Support

This isn't a change that most customers will notice, and we don't believe anyone is depending on the previous behavior.

Documentation

None

Components impacted

This only involves a change to the host.

Performance

No performance impact.

@brettsam
Copy link
Member Author

brettsam commented Sep 2, 2021

Tracking bug for work: Azure/azure-functions-host#7584

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

No branches or pull requests

2 participants