Issue Details (XML | Word | Printable)

Key: GROOVY-2432
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Critical Critical
Assignee: Unassigned
Reporter: Brandon Smith
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
groovy

Setting unscoped log level to ALL can cause infiinte loop and stack overflow

Created: 21/Dec/07 09:19 AM   Updated: 17/Apr/08 07:26 AM   Resolved: 20/Mar/08 02:08 AM
Component/s: None
Affects Version/s: 1.5
Fix Version/s: 1.5.5, 1.6-beta-1

Time Tracking:
Not Specified

File Attachments: 1. Zip Archive infiniteloop.zip (2 kB)

Environment: Issue consistently appears on Windows Vista, XP SP2 on IBM JDK 5 and Mac OS X 10.4.11 and 10.5.1 on Sun JDK 1.5.


 Description  « Hide

The issue appears when a Groovy class overrides the toString() method and the method makes a call that routes a call through its meta class. If the log level is set to a level where MetaClassHelper logs the method call, toString() on the Groovy class is called for logging purposes, thus beginning an infinite loop and subsequent stack overflow.

This happened simply by specifying ".level=ALL" in my logging properties. Scoping it to just the root package of my application avoided this issue.

For instance, my toString() method creates a StringBuffer and appends various information to build up a String to return. In the attached test case, "this.getClass().getName()" initiates an infinite loop. The infinite loop is caused by the following normalizedValue method in MetaClassHelper because it is initiated by a call in toString() and in turn calls toString() calls the same toString() method.



Brandon Smith added a comment - 19/Feb/08 11:27 AM

Is there any information that I can provide that can help the evaluation of this issue?