Nested modules sometimes fail to propagate exports #6199
Labels
bug
Something isn't working
flow
Related to Grafana Agent Flow
frozen-due-to-age
Locked due to a period of inactivity. Please open new issues or PRs if more discussion is needed.
What's wrong?
This branch contains the test that sometimes triggers the bug and a hacky fix: https://github.com/grafana/agent/compare/experiment-modules-bug?expand=1
More context from @rfratto after a quick investigation: the worker pool is shared between all controllers, and is used for evaluating updated components. items are queued into the worker pool using SubmitWithKey.
note this lne:
Adding a job with a key that is already queued is a no-op (even if the submitted function is different).
the bug is that the key is the local ID of a component, not the global ID. because you have multiple components with the local ID of testcomponents.passthrough.pt, the worker queue is getting confused and is dropping events for one/both of them.
it's essentially a race condition which depends on whether the worker queue processes events from both components quickly enough. if it doesn't, events for one of them get dropped.
Without the fix, you can avoid the problem by having a different label on every component. It also seems that you need a different label on the export blocks. We don't know yet why this is the case for the exports block, this part should be investigated as it might reveal another bug.
Steps to reproduce
To trigger the bug you can modify the test of the branch above and put the same label on the same components (for example put the label "pt" on both "testcomponents.passthrough". If you run the test without the hacky fix several time you will see that it sometimes either fail or it pauses for about a second before succeeding.
System information
No response
Software version
v0.39.0
Configuration
No response
Logs
The text was updated successfully, but these errors were encountered: