-
Bug
-
Resolution: Done
-
Undefined
-
26.2.5
-
False
-
-
False
-
-
Before reporting an issue
[x] 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
core
Describe the bug
Unable to delete the client via the console and api, when the client has CompositeRoles assigned.
Creating a client with the minimal payload, and with Roles and Composite Roles is successful. Attempting to delete the client, we get an error message, as seen in the attached image.
<img width="1434" alt="Image" src="https://github.com/user-attachments/assets/038a86e3-187a-44e3-be4a-3de4edaabf52" />
Version
26.2.4
Regression
[x] The issue is a regression
Expected behavior
The client should be removed.
Actual behavior
Error shown in the UI and via the api.
How to Reproduce?
Create a client with the following payload:
{
"ClientId": "robottest-client-minimal",
"RedirectURIs": [
"1.2.3.5",
"1.2.3.4"
],
"ClientRoles": [
"SuperUser",
"SuperNoob"
],
"CompositeRoles": [
]
}
Attempting to delete the client shows in the KC logs the following stack trace:
ERROR [org.keycloak.services.error.KeycloakErrorHandler] (executor-thread-65) Uncaught server error: org.hibernate.LazyInitializationException: failed to lazily initialize a collection: could not initialize proxy - no Session at org.hibernate.collection.spi.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:635) at org.hibernate.collection.spi.AbstractPersistentCollection.withTemporarySessionIfNeeded(AbstractPersistentCollection.java:219) at org.hibernate.collection.spi.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:614) at org.hibernate.collection.spi.PersistentSet.remove(PersistentSet.java:208) at org.keycloak.models.jpa.JpaRealmProvider.lambda$removeRole$7(JpaRealmProvider.java:462) at java.base/java.lang.Iterable.forEach(Iterable.java:75) at org.keycloak.models.jpa.JpaRealmProvider.removeRole(JpaRealmProvider.java:462) at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133) at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1939) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596) at org.keycloak.utils.ClosingStream.forEach(ClosingStream.java:128) at org.keycloak.models.jpa.JpaRealmProvider.removeRoles(JpaRealmProvider.java:497) at org.keycloak.storage.RoleStorageManager.removeRoles(RoleStorageManager.java:195) at org.keycloak.models.cache.infinispan.RealmCacheSession.removeRoles(RealmCacheSession.java:934) at org.keycloak.models.jpa.JpaRealmProvider.removeClient(JpaRealmProvider.java:1114) at org.keycloak.storage.ClientStorageManager.removeClient(ClientStorageManager.java:296) at org.keycloak.models.cache.infinispan.RealmCacheSession.removeClient(RealmCacheSession.java:699) at org.keycloak.models.cache.infinispan.RealmAdapter.removeClient(RealmAdapter.java:848) at org.keycloak.services.managers.ClientManager.removeClient(ClientManager.java:101)
Anything else?
This bug might be related to the newly closed issue #39237 .
We are using a PostgreSQL 14.14 on x86_64-pc-linux-gnu
- links to