[misc] Fix robustness issues in the DeleteServlet - #2451
Open
sdumitriu wants to merge 1 commit into
Open
Conversation
sdumitriu
commented
Aug 15, 2026
Member
- Reference cycles, e.g. two resources holding mutual RECURSIVE_DELETE links to each other, made the referrer traversal recurse until the stack overflowed; each node's referrers are now only chased once per phase
- Deleting a link's own definition consulted that definition's onDelete policy, although the policy describes what to do when the link's target is deleted; a RECURSIVE_DELETE definition would take every linking resource down with it. A link cannot outlive its definition, so the link itself is now removed without consulting the policy
- A hard link with the (illegal) IGNORE policy, or an unrecognized policy value, passed the conflict check untouched and then blew up at commit time with a ReferentialIntegrityException reported as a generic 500; such links are now removed, with a warning for the illegal policy
- A link with an unresolvable definition crashed the whole request; the policy now falls back to only removing the link, with a warning
- One node failing to describe itself made the whole 409 explanation collapse into 'referenced by unknown item(s)'; failures are now counted among the 'other' items instead of discarding the rest of the list
- After sending the 409 explanation, control still fell through to the removal loop and session.save(), which would persist any unrelated pending changes; refusals now skip the removal phase entirely
- A versionable ancestor checked out for the removal of one node could be removed by the same operation as a referrer, making the final checkin crash on the missing path; checkins are now path-based and skip deleted nodes
- A request for a non-JCR resource crashed with a NullPointerException instead of answering 404
- Also removed the resolver ThreadLocal and the mid-analysis save it existed for, which saved an empty transient state
- Reference cycles, e.g. two resources holding mutual RECURSIVE_DELETE links to each other, made the referrer traversal recurse until the stack overflowed; each node's referrers are now only chased once per phase - Deleting a link's own definition consulted that definition's onDelete policy, although the policy describes what to do when the link's target is deleted; a RECURSIVE_DELETE definition would take every linking resource down with it. A link cannot outlive its definition, so the link itself is now removed without consulting the policy - A hard link with the (illegal) IGNORE policy, or an unrecognized policy value, passed the conflict check untouched and then blew up at commit time with a ReferentialIntegrityException reported as a generic 500; such links are now removed, with a warning for the illegal policy - A link with an unresolvable definition crashed the whole request; the policy now falls back to only removing the link, with a warning - One node failing to describe itself made the whole 409 explanation collapse into 'referenced by unknown item(s)'; failures are now counted among the 'other' items instead of discarding the rest of the list - After sending the 409 explanation, control still fell through to the removal loop and session.save(), which would persist any unrelated pending changes; refusals now skip the removal phase entirely - A versionable ancestor checked out for the removal of one node could be removed by the same operation as a referrer, making the final checkin crash on the missing path; checkins are now path-based and skip deleted nodes - A request for a non-JCR resource crashed with a NullPointerException instead of answering 404 - Also removed the resolver ThreadLocal and the mid-analysis save it existed for, which saved an empty transient state
sdumitriu
force-pushed
the
misc-delete-servlet-fixes
branch
from
August 15, 2026 02:31
83a13b9 to
4b2df24
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.