sentinel-golang icon indicating copy to clipboard operation
sentinel-golang copied to clipboard

fix concurrency isolation control bug

Open czarhao opened this issue 3 years ago • 3 comments

Describe what this PR does / why we need it

[BUG] The actual maximum concurrency may exceed the threshold of concurrency isolation control · Issue #394 · alibaba/sentinel-golang (github.com)

Does this pull request fix one issue?

Fixes #394

Describe how you did it

In the previous version, for the "concurrency" field of the "BaseStatNode" struct , reading and writing here are not at the same time. Will miss a certain number of concurrency statistics, I added a "preConcurrency" field, It is used to record these unrecorded concurrent numbers.

At the "execute rule based checking slot", Only when read "concurrency", will Increase the "preConcurrency"

At the "execute statistic slot", try to Decrease the "preConcurrency"

Describe how to verify it

I added the unit test mentioned before and it can now pass.

Special notes for reviews

I don't think so.

czarhao avatar Mar 11 '21 03:03 czarhao

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Mar 11 '21 03:03 CLAassistant

Hi, thanks for contributing. Could you please sign the CLA here? And please make sure the email of your commits match your GitHub email. You may refer to the instruction here, or rebase your commits with the correct email.


感谢贡献,请将 commit 对应的 email 调整成与 GitHub 的 email 相匹配并 确认一下 CLA

sczyh30 avatar Mar 11 '21 04:03 sczyh30

@luckyxiaoqiang could you please take a look?

louyuting avatar Sep 07 '21 07:09 louyuting