UAA perform badly on authorizing/issuing token with multiple concurrent users ( 2000 concurrent users)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- java
- Domain
- authentication, authorization, performance
Research direction
Start in UaaAuthorizationEndpoint.java at getAccessTokenForImplicitGrantOrHybrid and review the synchronized implicitLock block alongside the linked Spring Security issue. Determine whether the lock is still required for implicit and hybrid authorization-code grants, then validate the change against concurrency performance and race-condition behavior.
Written by the indexing model from the issue text.
Description
What version of UAA are you running?
We use cloudfoundry-identity-uaa-4.14.0.war
How are you deploying the UAA?
In production environment, we have deployed UAA in Tomcat 8. We have 3 UAA nodes running with a Load Balancer to forward requests. We use F5 APM as IDP
What did you expect to see? What goal are you trying to achieve with the UAA?
We have 3185814 records in users table, 5434714 records in Groups table and 6266156 records in group_membership table.
We are working on performance testing and expect UAA to authorize / issue token below 2 seconds with 2000 concurrent users.
What did you see instead?
- We are experiencing UAA performance issues. Authorize / issue token process takes about 8 – 11 seconds with the 2000 concurrent users.
- We have narrowed down the UAA code and found the synchronized code block in UaaAuthorizationEndpoint.java is the bottleneck for multi threads.
- This code seems to be a copy of code from spring framework - https://github.com/spring-projects/spring-security-oauth/blob/20903ff56bbea896c7f2709f61dc6cf1c5b6b8ef/spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/endpoint/AuthorizationEndpoint.java#L271.
- We came across this defect reporting performance issues in the same synchronized block in Spring framework too. Here is the defect - https://github.com/spring-projects/spring-security-oauth/issues/1191 for spring framework.
- As per the comments in the code, it seems like ImplicitGrantService caused race condition which is now deprecated and ImplicitRequestToken is being used instead.
So, would it make sense to remove “synchronized” block here since “ImplicitGrantService” has been deprecated?
Here is the code:
private OAuth2AccessToken getAccessTokenForImplicitGrantOrHybrid(TokenRequest tokenRequest, OAuth2Request storedOAuth2Request, OAuth2Request storedOAuth2Request, String grantType ) throws OAuth2Exception { // These 1 method calls have to be atomic, otherwise the ImplicitGrantService can have a race condition //where // one thread removes the token request before another has a chance to redeem it. synchronized (this.implicitLock) { switch (grantType) { case "implicit": return getTokenGranter().grant(grantType, new ImplicitTokenRequest(tokenRequest, storedOAuth2Request)); case "authorization_code": return getHybridTokenGranterForAuthCode().grant(grantType, new ImplicitTokenRequest(tokenRequest, storedOAuth2Request)); default: throw new OAuth2Exception(OAuth2Exception.INVALID_GRANT); } } }
- Dominant language
- Java
- Stars
- 1.6k
- Forks
- 847
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 48
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from cloudfoundry/uaa
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
cloudfoundry/uaa#4194 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
cloudfoundry/uaa#4189 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
cloudfoundry/uaa#4156 ·
Maintainers usually reply within 1 day
-
Support named allowed-resource policies for mTLS clientsPossibly taken @strehle claimed this 24 days ago. Open
Difficulty 5/5 Over a week Newbie friendliness 35/100
cloudfoundry/uaa#4125 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 52/100
cloudfoundry/uaa#4086 · 1 comment ·
Maintainers usually reply within 1 day
All issues in cloudfoundry/uaa
Similar issues
-
triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
eclipse-edc/IdentityHub#1296 ·
Maintainers usually reply within 1 day
-
area: ui priority: medium
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
tetsuji16/microProject#1721 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 2 days
-
The engine's "loaded, but had errors" message leaves out which library and line each error is inOpen
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
cqframework/clinical_quality_language#1980 ·
Maintainers usually reply within 3 days
-
windows-sys 0.101.0Open
Difficulty 2/5 1-3 hours Newbie friendliness 61/100