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

HostID Collision detection #7682

Merged
merged 1 commit into from
Sep 29, 2021
Merged

HostID Collision detection #7682

merged 1 commit into from
Sep 29, 2021

Conversation

mathewc
Copy link
Member

@mathewc mathewc commented Sep 20, 2021

Adding logic to detect host ID collisions in shared storage accounts. In Functions v3 this will log a warning when detected, and in v4 it will be an error.

Breaking change proposal for v4: Azure/Azure-Functions#2049

public class HostIdValidator
{
public const string BlobPathFormat = "ids/usage/{0}";
private const LogLevel DefaultLevel = LogLevel.Warning;
Copy link
Member Author

Choose a reason for hiding this comment

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

When this is merged to the v4 branch, we simply have to update this to default Error level.

@mathewc mathewc force-pushed the host-id-check branch 3 times, most recently from c36c339 to 17773ba Compare September 21, 2021 19:02
// Schedule the validation to run asynchronously after a delay. This delay ensures
// we're not impacting coldstart, and also gives time for the primary host to be
// identified.
Utility.ExecuteAfterDelay(() => Task.Run(() => ValidateHostIdUsageAsync(hostId)), TimeSpan.FromSeconds(validationDelaySeconds));
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason for the Task.Run here?

Copy link
Member Author

Choose a reason for hiding this comment

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

I need to kick off an asynchronous background task that isn't awaited. I could remove the Task.Run, and add inline #pragmas to ignore the unawaited task warnings, but this seems preferable.

Copy link
Member

Choose a reason for hiding this comment

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

With the language version we're using, we should be able to use a discard, right?

src/WebJobs.Script/Host/HostIdValidator.cs Outdated Show resolved Hide resolved
src/WebJobs.Script/Host/HostIdValidator.cs Outdated Show resolved Hide resolved
src/WebJobs.Script/Host/HostIdValidator.cs Outdated Show resolved Hide resolved
src/WebJobs.Script/Host/HostIdValidator.cs Show resolved Hide resolved
src/WebJobs.Script/Host/HostIdValidator.cs Show resolved Hide resolved
src/WebJobs.Script/Properties/Resources.resx Show resolved Hide resolved
@mathewc mathewc merged commit 19bb671 into dev Sep 29, 2021
@mathewc mathewc deleted the host-id-check branch September 29, 2021 22:36
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