MYFACES-4751 5.0 Destroy @ViewScoped beans of views that are never sa…#997
Merged
Merged
Conversation
…ved (apache#995) A view rendered without writing its state - e.g. a page with no UIForm, so no view state token is emitted - can never be restored, and unlike a saved view it is never registered in the session SerializedViewCollection. Consequently the normal "evict view -> destroy its view scope" path never ran for such a view, and any @ViewScoped beans created while rendering it lingered in the session (ViewScopeContextualStorageHolder) until the session expired. Requesting such a page repeatedly within one session therefore leaked one view-scope storage per request, unbounded. FaceletViewDeclarationLanguage.renderView now destroys the view scope of a non-transient view whose state was not written, at the end of the request, publishing PreDestroyViewMapEvent and destroying its (CDI or non-CDI) @ViewScoped storage. Add ViewScopeFormlessLeakTestCase: rendering a formless page bound to a @ViewScoped bean N times now destroys the bean N times instead of accumulating it in the session. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
3b37239 to
13040eb
Compare
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.
…ved (#995)
A view rendered without writing its state - e.g. a page with no UIForm, so no view state token is emitted - can never be restored, and unlike a saved view it is never registered in the session SerializedViewCollection. Consequently the normal "evict view -> destroy its view scope" path never ran for such a view, and any @ViewScoped beans created while rendering it lingered in the session (ViewScopeContextualStorageHolder) until the session expired. Requesting such a page repeatedly within one session therefore leaked one view-scope storage per request, unbounded.
FaceletViewDeclarationLanguage.renderView now destroys the view scope of a non-transient view whose state was not written, at the end of the request, publishing PreDestroyViewMapEvent and destroying its (CDI or non-CDI) @ViewScoped storage.
Add ViewScopeFormlessLeakTestCase: rendering a formless page bound to a @ViewScoped bean N times now destroys the bean N times instead of accumulating it in the session.