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

Zuul 2.6.2: Concurrency protection configuration off by 1 ? (zuul.origin.<route>.concurrency.max.requests) #1892

Open
pcabot opened this issue Feb 14, 2025 · 0 comments

Comments

@pcabot
Copy link

pcabot commented Feb 14, 2025

Hi,
Problem
While configuring the latest Zuul (2.6.2) concurrency protection mechanism, I found out that Zuul will accept 1 more connection than the limit.

Example
For instance, with the following config:

zuul.origin.api.concurrency.protect.enabled=true
zuul.origin.api.concurrency.max.requests=30

I can send 31 requests without being throttled, i.e. the 32nd connection is actually blocked.

Code
After looking at the code, it looks like this was done by design (or a bug?) where the concurrent counter is incremented after checking for the limit in BasicNettyOrigin.java (or >= should be used instead ?) :

    @Override
    public void preRequestChecks(HttpRequestMessage zuulRequest) {
        if (concurrencyProtectionEnabled.get() && concurrentRequests.get() > concurrencyMax.get()) {
            rejectedRequests.increment();
            throw new OriginConcurrencyExceededException(getName());
        }

        concurrentRequests.incrementAndGet();
    }

Question
Is this a known issue or is it by design ?
(of course, in my case I can just increment the max+1 to fix the issue, but I wanted to check)

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant