Comments (7)
@bvbsdvy I have been able to reproduce it consistently and I also have tested with multiple scenarios. There are sure many ways to fix it. When the server closes the connection, only the next client request fails because the client is not aware of the close, so retrying the request will work as it will create a new connection in the retry request. The root cause lies in the Apache HTTPClient and not our code. Section 2.5 here explains that: https://hc.apache.org/httpcomponents-client-ga/tutorial/html/connmgmt.html. As I understand it is "not 100%" reliability of the http client to detect stale connections.
To reproduce the issue , you can make 200 requests in a loop with a delay of 6secs. The TTL on our server is 5 seconds. I have consistently been able to reproduce the issue using this.
from okta-sdk-java.
Also , this issue is not just with AuthApiClient , this issue happens with any API if we use the Apache HTTPClient.
from okta-sdk-java.
I was not able to reproduce it with the following code. All 200 tries were successful:
public void testOkta() throws Exception {
ApiClientConfiguration config = new ApiClientConfiguration(oktaUrl, oktaApiKey);
AuthApiClient apiClient = new AuthApiClient(config);
for (int i = 0; i < 200; i++) {
AuthResult result = apiClient.authenticate(username, password, "");
System.out.println(i + ". " + result.getStatus());
Thread.sleep(6000);
}
}
(oktaUrl
, oktaApiKey
, username
, and password
are just Strings defined in my test class.)
I tried one run using HttpClient 4.5.2 with HttpCore 4.4.4 -- these are the latest versions of the Apache libraries currently. I also tried a second run using the default versions that are dependencies of the Okta SDK: HttpClient 4.3.6.
The version of Okta SDK I'm using is 874dcfd.
from okta-sdk-java.
The behaviour is very random. Try this
for(int i = 0 ; i < 500; i++) {
List users = usersClient.getUsersWithQuery(Integer.toString(random.nextInt()));
Thread.sleep(6000);
System.out.println(i);
User newUser = usersClient.createUser(
"First",
"Last",
"login" + Integer.toString(random.nextInt()) + "@example.com",
"email" + Integer.toString(random.nextInt()) + "@example.com",
true);
List<UserGroup> userGroups = userGroupApiClient.getUserGroupsWithLimit(1);
// Read
User user = usersClient.getUser(newUser.getId());
Assert.assertTrue(newUser.getId().equals(user.getId()));
// Update
user.getProfile().setLastName("NewLast");
user = usersClient.updateUser(user);
usersClient.setRecoveryQuestion(newUser.getId(), "how are you", "winter is coming");
UserGroup group = new UserGroup();
group.setId(Integer.toString(random.nextInt()));
UserGroupProfile profile = new UserGroupProfile();
profile.setName(Integer.toString(random.nextInt()));
group.setProfile(profile);
group = userGroupApiClient.createUserGroup(group);
userGroupApiClient.addUserToGroup(group.getId(), newUser.getId());
}
from okta-sdk-java.
This should be fixed by #23
from okta-sdk-java.
@lboyette-okta In the commit, I see that you are using StandardHttpRequestRetryHandler to fix this issue. But AuthApiClient.authenticate method uses POST method which is not idempotent. But I think StandardHttpRequestRetryHandler only retries idempotent methods. So that excludes POST which is used in this method. Can you please explain how the fix works in this case?
from okta-sdk-java.
@ggehlot You're correct that StandardHttpRequestRetryHandler doesn't cover that case, so the current fix won't work for the AuthApiClient (or for any methods that require POST).
from okta-sdk-java.
Related Issues (20)
- Cannot get "after" value from paginated response in v11. HOT 2
- Make model objects implement `java.io.Serializable`. HOT 2
- Default okta.properties missing in com.okta.sdk:okta-sdk-impl:12.0.2 HOT 2
- Pagination removed from recent releases HOT 1
- Some characters are not serialized correctly. HOT 1
- ApiExceptionHelper throws an exception when ApiException doesnโt have a response body HOT 1
- An attempt to remove profile attribute value does not succeed HOT 2
- 13.0.2 missing UTF-8 support in Azure HOT 4
- Null LinksSelf in VerifyUserFactorResponse HOT 1
- Missing "List groups assigned to application" HOT 5
- OAUTH_AUTHORIZATION_POLICY PolicyType missing in latest spec HOT 9
- With 14.0.0 the application id is always null upon create HOT 2
- ClassNotFoundException with current dependencies in Gradle build HOT 4
- Okta Verify Fast Pass as an enrolled Factor is not returned HOT 8
- UserProfile equals() does not return true when objects are equal HOT 1
- Upgrade to 13.0.2 causes updateUser API to fail from attribute being mastered by a different system HOT 8
- `IdentityProviderApi` cannot properly deserialize `/ipds` responses HOT 1
- Create authorization server policy with type OAUTH_AUTHORIZATION_POLICY get error HOT 3
- IdP Discovery Policy not returned in listPolicyRules() HOT 2
- GroupsAPI - Custom group profile attributes missing HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from okta-sdk-java.