keycloak/keycloak

Error while removing expired entries from database

Open

#49.083 geöffnet am 19. Mai 2026

Auf GitHub ansehen
 (5 Kommentare) (1 Reaktion) (1 zugewiesene Person)Java (34.398 Stars) (8.346 Forks)batch import
area/storagehelp wantedkind/bugpriority/lowstatus/auto-bumpstatus/auto-expireteam/core-iamteam/core-shared

Beschreibung

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

storage

Describe the bug

An exception is thrown during expired session cleanup when BaseExpirationTask attempts to remove expired entries from the database.

2026-05-18 21:51:23.910 ERROR [org.keycloak.models.sessions.infinispan.expiration.BaseExpirationTask] (user-session-purge-expired) [realmId=, clientId=, userId=, username=, ipAddress=] Unexpected error while removing expired entries from database: jakarta.enterprise.context.ContextNotActiveException: RequestScoped context was not active when trying to obtain a bean instance for a client proxy of CLASS bean [class=io.quarkus.vertx.http.runtime.CurrentVertxRequest, id=ZMes0Yo6HsWixdWYNWZOvMsRHzQ]
        - you can activate the request context for a specific method using the @ActivateRequestContext interceptor binding
        at io.quarkus.arc.impl.ClientProxies.notActive(ClientProxies.java:76)
        at io.quarkus.arc.impl.ClientProxies.getSingleContextDelegate(ClientProxies.java:32)
        at io.quarkus.vertx.http.runtime.CurrentVertxRequest_ClientProxy.arc$delegate(Unknown Source)
        at io.quarkus.vertx.http.runtime.CurrentVertxRequest_ClientProxy.getOtherHttpContextObject(Unknown Source)
        at io.quarkus.resteasy.reactive.server.runtime.QuarkusCurrentRequest.get(QuarkusCurrentRequest.java:21)
        at org.jboss.resteasy.reactive.server.core.CurrentRequestManager.get(CurrentRequestManager.java:8)
        at org.keycloak.quarkus.runtime.integration.resteasy.QuarkusKeycloakContext.getResteasyReactiveRequestContext(QuarkusKeycloakContext.java:54)
        at org.keycloak.quarkus.runtime.integration.resteasy.QuarkusKeycloakContext.createClientConnection(QuarkusKeycloakContext.java:48)
        at org.keycloak.services.DefaultKeycloakContext.getConnection(DefaultKeycloakContext.java:161)

Version

26.6.1

Regression

  • The issue is a regression

Expected behavior

Expired session cleanup tasks should complete successfully without throwing exceptions.

Actual behavior

The user-session-purge-expired task fails with the following exception while removing expired entries from the database:

2026-05-18 21:51:23.910 ERROR [org.keycloak.models.sessions.infinispan.expiration.BaseExpirationTask] (user-session-purge-expired) [realmId=, clientId=, userId=, username=, ipAddress=] Unexpected error while removing expired entries from database: jakarta.enterprise.context.ContextNotActiveException: RequestScoped context was not active when trying to obtain a bean instance for a client proxy of CLASS bean [class=io.quarkus.vertx.http.runtime.CurrentVertxRequest, id=ZMes0Yo6HsWixdWYNWZOvMsRHzQ]

How to Reproduce?

The error ocurrs in both:

  • Docker container running in localhost
  • VM running Keycloak as a service

Anything else?

The only related overridden configuration is: spi-user-sessions--infinispan--session-expiration-period=3600

Contributor Guide