Open
Conversation
…tering cleanup cancel t.Cleanup callbacks run in LIFO (last-in, first-out) order. When t.TempDir() is called after registering a t.Cleanup that calls cancel() + egrp.Wait(), the temp dir removal runs FIRST — before the context is cancelled. This means background goroutines launched by LaunchXrootdMaintenance are still running and actively reading/ writing files in directories that have already been deleted. Fix by moving t.TempDir() calls before the cancel/egrp cleanup registration so that LIFO ordering ensures: 1. cancel() + egrp.Wait() — goroutine stops 2. temp dir removal — safe, nothing is using it
…utines Several tests in xrootd_config_test.go called `defer ResetTestState()` alongside a `t.Cleanup` that cancelled the context and waited on the errgroup. Because `defer` runs before `t.Cleanup` (LIFO within their respective stacks, but all defers execute before any t.Cleanup), `ResetTestState` would wipe the viper configuration -- including `Cache_RunLocation` and `Origin_RunLocation` -- while the maintenance goroutine launched by `LaunchXrootdMaintenance` was still running. The goroutine would then read an empty RunLocation, causing EmitAuthfile to write `authfile-cache-generated` into the working directory (i.e. the source tree) instead of the test's temp dir. Fix this by moving ResetTestState() into the t.Cleanup callback, after egrp.Wait() returns, so the config is only wiped once the goroutine has fully exited.
Contributor
Author
|
I tried rebasing to fix the "Check Rebase on Main" check that was failing, but I don't think that actually did anything.. |
Contributor
Author
|
I think those commits that got pulled in should probably be dropped from this PR, but I'm not sure how to do that and don't want to make things worse. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes to docs/app/getting-help/troubleshooting/page.mdx are an unrelated fix.