GitHub user jwagenleitner opened a pull request:

    https://github.com/apache/groovy/pull/298

    Guard against recursive calls to ReferenceManager#removeStallEntries …

    …that could cause a StackOverflowError.  A 
ManagedReference#finalizeReference method may call ManagedReference#clear on 
other references as part of the clean up process and #clear in turns calls 
#removeStallEntries.  This change makes it so that a queue is not re-entered 
for processing once it has started to be processed.
    
    This fix is related to PR #219 because that PR fixes the finalization of 
the ClassInfo instance.  As part of the cleanup a call is made to 
[ManagedReference#clear] 
(https://github.com/apache/groovy/blob/91406a76c6bf00ac27a102fe5b55362238fa8af5/src/main/org/codehaus/groovy/reflection/ClassInfo.java#L196)
  which in turn calls [removeStallEntries] 
(https://github.com/apache/groovy/blob/91406a76c6bf00ac27a102fe5b55362238fa8af5/src/main/org/codehaus/groovy/util/ManagedReference.java#L49).
    
    An option might be to remove the call to removeStallEntries from 
ManagedReference#clear and that is what was done in PR #219.  But it may be 
difficult to always guarantee no recursive calls in the Managed classes in 
which case having a guard in place removes the need of the managed classes from 
having to worry about it.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jwagenleitner/groovy refmanager

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/groovy/pull/298.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #298
    
----
commit 7f206909e5ee01f52e1b46f8ba847ce995ca95fa
Author: John Wagenleitner <[email protected]>
Date:   2016-03-22T21:11:02Z

    Guard against recursive calls to ReferenceManager#removeStallEntries that 
could cause a StackOverflowError.  A ManagedReference#finalizeReference method 
may call ManagedReference#clear on other references as part of the clean up 
process and #clear in turns calls #removeStallEntries.  This change makes it so 
that a queue is not re-entered for processing once it has started to be 
processed.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to