Skip to content

fix: removing the message about missing proactive closure - #51251

Open
shawkins wants to merge 1 commit into
keycloak:mainfrom
shawkins:iss51131
Open

fix: removing the message about missing proactive closure#51251
shawkins wants to merge 1 commit into
keycloak:mainfrom
shawkins:iss51131

Conversation

@shawkins

Copy link
Copy Markdown
Contributor

Opting for removal, rather than trying to further refine this. What additional refinements would entail:

  • picking up quarkus 3.33.3 to get Response not handled in ContainerResponseFilter for dropped HTTP requests quarkusio/quarkus#54889
  • Adding the Cancellable annotation to CloseSessionFilter
  • Add additional logic to account closure when there's Stream or StreamingOutput entities - as we expect those to be read / closed to proactively close the session. More than likely this would mean adding another flag to the session "pending closure" to track that the CloseSessionFilter had run, but that full closure had not happened yet.
  • And finally detect in CloseSessionFilter that it's being run in a different thread than what started the transaction as what we're trying to truly detect / warn against are new or missing async scenarios that the TransactionalSessionHandler isn't handling. Ideally Keycloak maintainers shouldn't be adding new async endpoints, and we document that users shouldn't be doing that either.

It doesn't seem like the additional complexity is warranted given this is already a corner case, and if we see a need for something like this in the future, it would be better to have quarkus provide us with a flag on the ResteasyReactiveRequestContext.

closes: #51131

closes: keycloak#51131

Signed-off-by: Steve Hawkins <shawkins@redhat.com>
Copilot AI review requested due to automatic review settings July 28, 2026 16:02
@shawkins
shawkins requested review from a team as code owners July 28, 2026 16:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Removes the warning about “missing proactive closure” and clarifies that request-end session closing may not always run (e.g., if the connection drops), relying on the CDI disposer as a safety net.

Changes:

  • Update CloseSessionFilter Javadoc to note it may not run when the connection is already closed.
  • Remove the Logger and warning log from KeycloakBeanProducer.dispose() and always close the session there.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/integration/jaxrs/CloseSessionFilter.java Adjusts filter documentation to reflect that it may not execute under some connection-closure scenarios.
quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/integration/cdi/KeycloakBeanProducer.java Removes the proactive-closure warning and relies on disposer-driven closure as a fallback.

@ahus1 ahus1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for looking into that. I've been reading the parent issue, and this is a rabbit hole.

I understand that the KeycloakBeanProducer is called in all place as the last line of defense.

Approving, but not merging yet in case you want someone else to review this one. Do you want to backport it as well?

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Warning "Proactive closing of the session was missed - refinements are needed to TransactionSessionHandler related logic" appears

3 participants