Skip to content
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

Which SlotChainBuilder is used is unpredictable, depends on order of resource loading #1128

Closed
xiazuojie opened this issue Oct 30, 2019 · 2 comments
Labels
kind/discussion For further discussion kind/enhancement Category issues or prs related to enhancement.

Comments

@xiazuojie
Copy link

xiazuojie commented Oct 30, 2019

Issue Description

Which com.alibaba.csp.sentinel.slotchain.SlotChainBuilder to use can be specified by creating a resource file resources/META-INF/services/com.alibaba.csp.sentinel.slotchain.SlotChainBuilder.
However, sentinel-core already ships its own file that uses com.alibaba.csp.sentinel.slots.DefaultSlotChainBuilder.
If an user provides his own resource file, we have multiple files (resources/META-INF/services/com.alibaba.csp.sentinel.slotchain.SlotChainBuilder) in classpath. Which one actually gets used depends on which resource file is loaded first, which is unpredictable and may cause unexpected issues.

Type: bug report or feature request
bug report

Describe what happened (or what feature you want)

If a user provides a resources/META-INF/services/com.alibaba.csp.sentinel.slotchain.SlotChainBuilder, it may not get used because sentinel-core already ships one.

Describe what you expected to happen

Which SlotChainBuilder is used can be specified in a predictable way, maybe a system property.
If there are multiple specifications, raise an error with detailed message on how to specify which one to use.

How to reproduce it (as minimally and precisely as possible)

Tell us your environment

Anything else we need to know?

From Alibaba with love

@sczyh30 sczyh30 added kind/discussion kind/enhancement Category issues or prs related to enhancement. labels Oct 31, 2019
@sczyh30 sczyh30 added kind/discussion For further discussion and removed kind/discussion labels Dec 17, 2019
@sczyh30
Copy link
Member

sczyh30 commented Jan 19, 2020

Actually it seems not a good design to make SlotChainBuilder as the SPI and load the first-encountered implementation. We may need a more flexible mechanism like #411 (though compatibility should be considered).

@sczyh30
Copy link
Member

sczyh30 commented May 13, 2020

Resolved in Sentinel 1.7.2 via #411

@sczyh30 sczyh30 closed this as completed May 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/discussion For further discussion kind/enhancement Category issues or prs related to enhancement.
Projects
None yet
Development

No branches or pull requests

2 participants