keycloak/keycloak

OutOfMemoryError in `org.keycloak.authorization.admin.ScopeService.getPermissions`

Offen

#17.414 geöffnet am 02.03.2023

 (3 Kommentare) (1 Reaktion) (0 zugewiesene Personen)Java (8.346 Forks)batch import
area/admin/apiarea/authorization-serviceshelp wantedkind/bugpriority/normalstatus/auto-bumpteam/core-iam

Repository-Metriken

Stars
 (34.398 Sterne)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

Before reporting an issue

  • I have searched existing issues
  • I have reproduced the issue with the latest release

Area

admin/ui

Describe the bug

Reason: OutOfMemoryError throws because method getPermissions in ScopeService return all items without pagination. In case of a lot of items it is become OutOfMemoryError.

Code flow

image

image

image

Query:

@NamedQuery(name="findPolicyIdByScope", query="select pe from PolicyEntity pe inner join pe.scopes s where pe.type = 'scope' and pe.resourceServer.id = :serverId and s.id in (:scopeIds)"),

Version

21.0.1

Expected behavior

No OutOfMemoryError

Actual behavior

OutOfMemoryError

How to Reproduce?

Create authorization client with scope and a lot of attached resources (100500+).

Anything else?

No response

Contributor Guide