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

Fix CreateDefaultBuilder_SecretsDoesReload test failure #52466

Closed
wants to merge 1 commit into from

Conversation

IEvangelist
Copy link
Member

Test failures appear to be isolated to Ubuntu 16.04, I'm wondering if this is related to the FileSystemWatcher not signaling file system changes correctly.

  • Sets the "DOTNET_USE_POLLING_FILE_WATCHER" env var to "1" for the duration of the test

Fixes #48696

@ghost
Copy link

ghost commented May 7, 2021

Tagging subscribers to this area: @eerhardt, @maryamariyan
See info in area-owners.md if you want to be subscribed.

Issue Details

Test failures appear to be isolated to Ubuntu 16.04, I'm wondering if this is related to the FileSystemWatcher not signaling file system changes correctly.

  • Sets the "DOTNET_USE_POLLING_FILE_WATCHER" env var to "1" for the duration of the test

Fixes #48696

Author: IEvangelist
Assignees: -
Labels:

area-Extensions-Hosting

Milestone: -

Directory.CreateDirectory(secretFileInfo.Directory.FullName);

static string SaveRandomSecret(string secretPath)
var originalValue = Environment.GetEnvironmentVariable("DOTNET_USE_POLLING_FILE_WATCHER");
Copy link
Member

@maryamariyan maryamariyan May 7, 2021

Choose a reason for hiding this comment

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

Note for reviewers:

The diff looks tough to read but seems like this change is basically just adding a try/finally block around this entire code snippet and setting DOTNET_USE_POLLING_FILE_WATCHER environment variable

also:

-           config.GetReloadToken().RegisterChangeCallback(
-                _ => configReloadedCancelTokenSource.Cancel(), null);
+           using IDisposable token = config.GetReloadToken().RegisterChangeCallback(
+                _ => configReloadedCancelTokenSource.Cancel(), null);

@ericstj
Copy link
Member

ericstj commented May 7, 2021

If we rely on polling to be set doesn't that mean we have a problem with the product, since that is not the default?

File.WriteAllText(secretPath, $"{{ \"Hello\": \"{newMessage}\" }}");
return newMessage;
}
Environment.SetEnvironmentVariable("DOTNET_USE_POLLING_FILE_WATCHER", "1");
Copy link
Member

Choose a reason for hiding this comment

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

Do these tests run concurrently? If so, then setting the environment variable for the entire process might effect other tests, you can use RemoteExecutor to give the test it's own process, or use API to setup the polling file-watcher.

UsePollingFileWatcher = true,
UseActivePolling = true

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, yes. That makes sense. I could wrap this up in the RemoteExecutor to isolate it, but I'd like to ensure first that changing this test in this way is the correct approach?

@IEvangelist
Copy link
Member Author

If we rely on polling to be set doesn't that mean we have a problem with the product, since that is not the default?

Hi @ericstj - yes, but I think this is a somewhat known issue for certain environments. In fact, I just had to update docs to mention details about this per @davidfowl, see #51866 (comment).

I'm not certain that this is isolated to Ubuntu 16.04, but that is the only environment that I saw occasionally failing for this test unit test. I believed it to be related to the FileSystemWatcher not reliably signaling that the file has changed. I also found an old SO that mentioned concerns with Ubuntu and the FileSystemWatcher not signaling. I could be wrong, but I did want to at least give it a try.

@IEvangelist
Copy link
Member Author

I'm going to abandon/close this PR. I was unable to reliably validate these changes, per #52466 (comment).

@IEvangelist IEvangelist closed this Jun 7, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Jul 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CreateDefaultBuilder_SecretsDoesReload test failed in CI
3 participants