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

Incorrect entry-exit state when assembling multiple chained SentinelReactorTransformer #1084

Closed
sczyh30 opened this issue Oct 15, 2019 · 0 comments · Fixed by #1089
Closed
Assignees
Labels
area/integrations Issues or PRs related to integrations with open-source components kind/bug Category issues or prs related to bug.

Comments

@sczyh30
Copy link
Member

sczyh30 commented Oct 15, 2019

Issue Description

Type: bug report

Describe what happened (or what feature you want)

Incorrect entry-exit state when assembling multiple chained SentinelReactorTransformer like this:

upstream
  .transform(new SentinelReactorTransformer<>("reactor-service-a"))
  .transform(new SentinelReactorTransformer<>("reactor-service-b"))

When the flow control for the latter resource (e.g. reactor-service-b) is triggered, the SentinelReactorSubscriber will signal cancel() and propagate the BlockException, but the SentinelReactorSubscriber did not handle the hookOnCancel appropriately, thus causing the AsyncEntry of the former resource reactor-service-a not exited.

Describe what you expected to happen

The onCancel() signal should be handled correctly, so the entry could be exited.

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

Run this code snippet:

public static void main(String[] args) throws Exception {
    FlowRuleManager.loadRules(
        Arrays.asList(new FlowRule("reactor-service-b").setCount(0))
    );
    Mono.just(2)
        .transform(new SentinelReactorTransformer<>("reactor-service-a"))
        .transform(new SentinelReactorTransformer<>("reactor-service-b"))
        .subscribe(System.out::println, Throwable::printStackTrace);
}

We set a FlowRule for resource reactor-service-b to disallow its invocation. After the code snippet is executed, we could find that the inner AsyncEntry for reactor-service-a is not exited.

1571105350000|2019-10-15 10:09:10|reactor-service-a|1|0|0|0|0|0
1571105350000|2019-10-15 10:09:10|reactor-service-b|0|1|0|0|0|0

Tell us your environment

Sentinel 1.7.0-SNAPSHOT on master branch.

@sczyh30 sczyh30 added kind/bug Category issues or prs related to bug. area/integrations Issues or PRs related to integrations with open-source components labels Oct 15, 2019
@sczyh30 sczyh30 self-assigned this Oct 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/integrations Issues or PRs related to integrations with open-source components kind/bug Category issues or prs related to bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant