Repository navigation
#6152 Destroy client window scoped beans - #6154
Merged
Merged
Conversation
@ClientWindowScoped beans were dropped without Contextual.destroy() on session destroy and on client window eviction. So @PreDestroy never ran and @dependent objects were never released. Store the original CreationalContext, as only that one holds the dependent objects. Destroy the beans of all remaining windows on session destroy. Evict the eldest window explicitly, so that its beans can be destroyed outside the lock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #6152
@ClientWindowScopedbeans were never destroyed, on session destroy and on client window eviction. So@PreDestroynever ran and@Dependentobjects were never released.ClientWindowScopeContextObjectstores the originalCreationalContext. CDI requires the same instance forContextual.destroy(), and only that instance holds the dependent objects.sessionDestroyed()destroys the beans of all remaining client windows.getContextMap()evicts the least recently used client window explicitly, and destroys its beans outside the lock. A callback in theLRUMapcannot hold aBeanManager, because the map is serialized with the session.New IT
test/issue6152covers eviction, session destroy and dependent objects. It passes on GlassFish, WildFly and TomEE, and it fails on GlassFish without the fix.Not tested on a real cluster. A serialization round trip of the bean with its
CreationalContextworks on Weld 5.1.6, and theCreationalContextimplementations of Weld and OpenWebBeans areSerializable.🤖 Generated with Claude Opus 5.5