-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
plugin/reload: avoid race conditions if imported files change during reload / fix issues with sigusr1 reload #6244
base: master
Are you sure you want to change the base?
Conversation
Thanks for the fix! Adding a test may be a pain, but I think one approach would be to craft an ad-hoc test plugin with a locked OnShutdown function that the executing test can unlock (i.e. pausing the reload to induce the race condition). |
…reload Signed-off-by: Christoph Barbian <christoph.barbian@sap.com>
Signed-off-by: Christoph Barbian <christoph.barbian@sap.com>
I have added a corresponding test case. As you suggested, it uses a plugin (called
In addition the plugin registers an The test then starts up a coredns instance with a simple Corefile:
and kicks off a change in the imported file, and waits until the plugin is finally running with the latest configuration version. With the upstream logic, the test fails, with the changed logic in the PR it succeeds. |
However I do not completely understand why the test is failing.
However running the package tests as a whole never works. Could it be the case that this is because the global plugins (in that case, reload) are then shared across the various tests in the package, which is problematic if they carry a state? If so, what could I do to overcome this ? |
Signed-off-by: Christoph Barbian <christoph.barbian@sap.com>
It really seems to be impossible to use certain plugins (at least the reload plugin is affected) in that shared At the moment the only test case using the reload plugin in Anyway, to overcome the problem, I moved the test introduced by this PR into a separate package, |
Codecov Report
@@ Coverage Diff @@
## master #6244 +/- ##
==========================================
+ Coverage 55.70% 58.26% +2.56%
==========================================
Files 224 251 +27
Lines 10016 16399 +6383
==========================================
+ Hits 5579 9555 +3976
- Misses 3978 6257 +2279
- Partials 459 587 +128
... and 169 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Signed-off-by: Christoph Barbian <christoph.barbian@sap.com>
Signed-off-by: Christoph Barbian <christoph.barbian@sap.com>
Following the discussion in #6243 I created a PR on coredns/caddy: coredns/caddy#4, and refactored the reload logic to make use of it. NOTES:
|
1. Why is this pull request needed and what does it do?
Try to fix race condition described in #6243
2. Which issues (if any) are related?
#6243
3. Which documentation changes (if any) need to be made?
None I think
4. Does this introduce a backward incompatible change or deprecation?
Hopefully not