Community
Participate
Working Groups
Created attachment 227060 [details] Project to reproduce the bug OVERVIEW Selecting code fragments or using "Open Declaration" on a selected part of code causes an endless loop in AbstractCommentParser:177 and eclipse generates 100% cpu load on one core. If main thread gets in the loop eclipse is not responding and can only be terminated by task manager with losing all unsaved code. REPRODUCTION Import the attached project in a clean workspace. Open the class "Bug" and scroll to the "TODO" task tag. Double click on "componentShown" in the next line and press F3. RESULT Eclipse is hanging in an endless lopp with 100% cpu load on one core. EXPECTED Eclipse should jump to the marked method. ADDITIONAL INFORMATION The problem is caused by the JavadocParse. The parser tries to parse the package-info.java of a referenced package. After that the actual source is parsed, but the scanner used by the parser has still the source of the package-info.java. This leads to parsing the same source range over and over again. WORKAROUND Disable javadoc comment processing in compiler options. POSSIBLE FIX Initialising the source of the Scanner in org.eclipse.jdt.internal.compiler.parser.JavadocParser:94 CURRENT CODE public boolean checkDeprecation(int commentPtr) { [...] // Parse try { this.source = this.sourceParser.scanner.source; [...] } finally { this.source = null; // release source as soon as finished } return this.deprecated; } CODE FIXING THE PROBLEM public boolean checkDeprecation(int commentPtr) { [...] // Parse try { this.source = this.sourceParser.scanner.source; this.scanner.setSource(this.source); //updating source in scanner [...] } finally { this.source = null; // release source as soon as finished this.scanner.setSource((char[]) null); //release source in scanner } return this.deprecated; }
Manoj, As this causes data loss, we need to fix this asap. I have set the target to M6. Please take a look.
(In reply to comment #0) > POSSIBLE FIX > Initialising the source of the Scanner in > org.eclipse.jdt.internal.compiler.parser.JavadocParser:94 Thomas, Thanks for the detailed analysis and a possible fix.
Created attachment 227393 [details] Proposed Patch using the suggested fix Srikanth, The bug was reproduced with the given attachment. The fix suggested was verified to solve the issue as mentioned by Thomas. The above patch (created out of the suggested fix) has cleared all the tests as well.
(In reply to comment #3) > Created attachment 227393 [details] > Proposed Patch using the suggested fix Patch looks good. Manoj, do you think it's possible to come up with a regression test for this scenario?
(In reply to comment #4) > Patch looks good. Manoj, do you think it's possible to come up with a > regression test for this scenario? Manoj, Have you had a chance to look into this ?
Patch and test released in separate commits and the current HEAD is here: http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=07e9b0e8791371fe37d0b3154d25a43e023b50c9
Resolving.
Verified for 4.3 M6 with build I20130311-2000