RDBC-1020 Fix infinite recursion in BeforeDelete and BeforeQuery event args#270
Open
redknightlois wants to merge 1 commit intoravendb:v7.2from
Open
RDBC-1020 Fix infinite recursion in BeforeDelete and BeforeQuery event args#270redknightlois wants to merge 1 commit intoravendb:v7.2from
redknightlois wants to merge 1 commit intoravendb:v7.2from
Conversation
e1eac09 to
e5648c6
Compare
…yEventArgs.session Both @Property implementations returned `self.session` (calling themselves) instead of the private backing attribute. Any access caused RecursionError. Fix: use `self.__session` inside the class body (Python handles name mangling at definition time), consistent with all other event arg classes. The explicit-mangled form `self._ClassName__session` is only correct when accessing private attributes from outside a class. Also fixes cascade deletes in BeforeDelete handlers: DeletedEntitiesHolder.__iter__ now snapshots both sets with list() before yielding, so session.delete() calls inside a handler do not raise "Set changed size during iteration". New deletions are staged in __on_before_deleted_entities and processed in a second pass. Regression tests verify that: - BeforeDeleteEventArgs.session and BeforeQueryEventArgs.session return the session object without recursion - A before-delete handler can cascade-delete a second document via args.session.load() and args.session.delete()
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.
Issue link
https://issues.hibernatingrhinos.com/issue/RDBC-1020
Additional description
BeforeDeleteEventArgs.sessionandBeforeQueryEventArgs.sessionproperties were returningself.session, causing infinite recursion. Fixed by returning the name-mangled backing attribute directly (_BeforeDeleteEventArgs__session/_BeforeQueryEventArgs__session).The fix also reworks
DeletedEntitiesHolder.__iter__and__prepare_for_entities_deletionto snapshot the sets before iteration, soBeforeDeletehandlers can safely callsession.delete()without raisingRuntimeError: Set changed size during iteration.Type of change
How risky is the change?
Backward compatibility
Is it platform specific issue?
Documentation update
Documentation Requiredtag.Testing by Contributor
private)Testing by RavenDB QA team
QA Requiredtag.Is there any existing behavior change of other features due to this change?
UI work
Studio Requiredtag.