Skip to content

Conversation

@jjhwan-h
Copy link

Fix polling interval validation in Reconfigure to avoid nanosecond ticker loops

Fixes: #8081

Why the changes in this PR are needed?

When Reconfigure() is called on the bundle plugin, the provided bundle configuration
is applied without validating polling.min_delay_seconds and polling.max_delay_seconds.
This means that even when a user explicitly configures a valid value such as:

"min_delay_seconds": 10

the actual polling interval used by the downloader may still fall back to 10 nanoseconds
(or effectively 0 nanoseconds) instead of 10 seconds.
In practice, this results in an extremely tight polling loop and thousands of HTTP requests
per second.

This behavior is incorrect and inconsistent with the user’s configuration, and validation
is required to ensure that the polling delays reflect the intended seconds-based values.

What are the changes in this PR?

  • Add validation for polling interval fields during the Reconfigure() flow.

Notes to assist PR review:

  • After this fix, the configuration is validated before applying changes, preventing the
    downloader from entering a tight polling loop.
  • Changes are limited to v1/plugins/bundle/plugin.go.

Further comments:

@netlify
Copy link

netlify bot commented Nov 27, 2025

Deploy Preview for openpolicyagent ready!

Name Link
🔨 Latest commit fe6ccb9
🔍 Latest deploy log https://app.netlify.com/projects/openpolicyagent/deploys/692e92386f75100008af2227
😎 Deploy Preview https://deploy-preview-8082--openpolicyagent.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@jjhwan-h jjhwan-h force-pushed the fix/reconfigure branch 3 times, most recently from d42e79b to 107d706 Compare November 27, 2025 12:59
Fix polling interval validation in Reconfigure to avoid nanosecond ticker
loops

Fixes: open-policy-agent#8081

Signed-off-by: jjhwan.h <[email protected]>
@sspaink
Copy link
Member

sspaink commented Dec 1, 2025

Thank you @jjhwan-h for fixing this! definitely a bug 🐛

The test TestUpgradeLegacyBundleToMuiltiBundleSameBundle is now failing because it gets further then before. It tries to stop the downloader that was configured incorrectly without a trigger causing a nil de-reference when trying to stop the downloaders.

Let me know if you need any help fixing this test!

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.

Missing validation for polling intervals in Reconfigure() leads to nanosecond-level bundle polling

2 participants