Skip to content

Conversation

@shreemaan-abhishek
Copy link
Contributor

@shreemaan-abhishek shreemaan-abhishek commented Dec 8, 2025

Description

When the same plugin is configured across different global rules, there will be no guarantee on which plugin config will be executed first. Additionally, the current architecture does not guarantee plugin execution order according to the priority.

We address this problem by disallowing configuring same plugin across multiple global_rules and sorting the plugins to their priority and executing in order.

Fixes: #12704

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. plugin labels Dec 8, 2025
Signed-off-by: Abhishek Choudhary <[email protected]>
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Dec 9, 2025
Signed-off-by: Abhishek Choudhary <[email protected]>
Signed-off-by: Abhishek Choudhary <[email protected]>
Signed-off-by: Abhishek Choudhary <[email protected]>
nic-6443
nic-6443 previously approved these changes Dec 9, 2025
membphis
membphis previously approved these changes Dec 12, 2025
@Baoyuantop Baoyuantop linked an issue Dec 15, 2025 that may be closed by this pull request
Signed-off-by: Abhishek Choudhary <[email protected]>
@shreemaan-abhishek shreemaan-abhishek dismissed stale reviews from membphis and nic-6443 via 4df44ed December 16, 2025 07:02
Signed-off-by: Abhishek Choudhary <[email protected]>

-- remove duplicate plugins
for plugin_name, _ in pairs(duplicate_plugins) do
all_plugins[plugin_name] = nil
Copy link
Contributor

Choose a reason for hiding this comment

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

We should warn which plugins are not working.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you are right, thanks. I pushed a new commit that contains:

        core.log.warn("found ", plugin_name, " configured across different global rules ",
                      " it won't get executed")

Copy link
Contributor

Choose a reason for hiding this comment

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

I think duplicate_plugins are redundant.
Can we merge three loops into one?

Signed-off-by: Abhishek Choudhary <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plugin size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: wrong plugin execution order

5 participants