Skip to content

/users/?max=100000 API request partial response with timeout #26884

Closed as not planned

Description

@richardjennings

Before reporting an issue

  • I have read and understood the above terms for submitting issues, and I understand that my issue may be closed without action if I do not follow them.

Area

admin/api

Describe the bug

API Request for All Users fails to complete.

Regardless of attempts to increase CPU and RAM available, when requesting all users from the API we see increasingly chunky chunks of JSON content returned by the API, until ultimately we hit a timeout at 30 seconds where the response body is incomplete and thus the JSON invalid.

With briefRepresentation set to true the request completes in 2.5 seconds consistently.

We have an older version of Keycloak 15.1.1 which is able to satisfy the all users request consistently without timeout.

Version

22.0.3

Expected behavior

API request to /users/?max=100000 should complete successfully

Actual behavior

API request to /users/?max=100000 times out after 30seconds with a partial response

How to Reproduce?

It is not clear how to reproduce this issue as it may relate to the specific data we are managing.

Anything else?

No response

Activity

  1. added
    kind/bug
    on Feb 7, 2024
  2. added
    area/admin/api
    on Feb 7, 2024
  3. stianst commented on Feb 8, 2024

    @stianst
    Contributor

    Returning a non-brief representation of 100000 users is a very expensive operation, and would have a significant impact on a given node, so that is something I'd recommend not doing, and rather do pagination.

    The default transaction timeout is 300 seconds, but can be configured with quarkus.transaction-manager.default-transaction-timeout. I would not recommend doing this though as it will apply to all requests.

    We could probably introduce a supported way to set transaction timeouts, as well as ability to set it differently for login vs admin. See #26889.

    However, as I mentioned initially fetching 100000 users is a very expensive operation, and I'd avoid doing that in the first place.

  4. richardjennings commented on Feb 8, 2024

    @richardjennings
    Author

    @stianst Thank you for your response. It is indeed a silly query that should be avoided if possible. Interestingly it does appear to have indicated a significant performance regression in that particular request between 15.1.1 and 22.0.3. Regards.

  5. stianst commented on Feb 8, 2024

    @stianst
    Contributor

    Not really a regression I think as there is now additional information added to the full user representation that causes it to be more expensive. If I don't remember incorrectly the default tx timeout has also changed since 15 (I might be wrong here though).

    You could always do some benchmarking and compare the results, if they are very different then open another issue with the details and we can take a look.

  6. richardjennings commented on Feb 8, 2024

    @richardjennings
    Author

    @stianst That is fair and understood. The benchmark numbers for 35000 users are roughly:

    15.1.1 10 seconds
    22.0.3 > 300 seconds

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/admin/apikind/bugteam/core-shared

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions