This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 244085 - Project structure with cyclical symlinks to a common root results in infinite looping and heap space OOM
Summary: Project structure with cyclical symlinks to a common root results in infinite...
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Project (show other bugs)
Version: 8.0
Hardware: PC Linux
: P3 normal with 1 vote (vote)
Assignee: Tomas Zezula
URL:
Keywords:
: 243988 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-04-25 18:53 UTC by snilek
Modified: 2015-03-28 08:19 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
project structure that positively locks while loading (237 bytes, application/x-gzip)
2014-04-25 18:53 UTC, snilek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description snilek 2014-04-25 18:53:05 UTC
Created attachment 146946 [details]
project structure that positively locks while loading

SUMMARY:

When loading a project with multiple cyclical symlinks that are both under the same root directory, the project never loads.  The cyclic symlink auto-detection fails and finally results in OutOfMemmoryError.

The scanning thus fails and is restarted one again after new launch of NetBeans (and repeats until the directory structure is fixed or the project closed/removed/deleted).


STEPS TO REPRODUCE the bug:

1. Create following project structure:

src/
src/folder1/
src/folder2/
src/folder1/link -> ../../src/
src/folder2/link -> ../../src/

(the "ide-locking" file structure that I used is attached as an archive)

2. Try to load this structure as a new project with existing sources.  It is irrelevant whether it is a Java project or some other type of project.  I tested the bug using Java project with existing sources and Python project with existing sources.

3. The IDE is trying to scan sources.  Note, that in the above structure, there are no source files.  The scanning never stops.

My _guess_ as to the origin of the bug is that the auto-detection of cyclical symlinks is not working for a directory structure that allows the generation of an infinite combination of directory sequences WITHOUT ANY REPETITION — which is true for a structure with more than one link to a common root.

That this might be the case is indicated by the fat that by deleting on of the links in the structure the problem does not occur.

Hope this helps to find/solve the bug.

Best regards & thanks for this wonderful IDE,
Jan Jansky
Comment 1 snilek 2014-04-25 18:57:21 UTC
*** Bug 243988 has been marked as a duplicate of this bug. ***
Comment 2 Jaroslav Havlin 2014-06-02 16:07:23 UTC
I can reproduce this bug. Occurs after adding a new source folder to the project with existing sources.
A modal progress bar is shown and runs infinitely (although it can be cancelled).

This method is called recursively: o.n.spi.java.project.support.JavadocAndSourceRootDetection.findAllSourceRoots().
It seems that no check for symlink is performed. 

Reassigning to java/Project. Please evaluate it. If some support from filesystem API is required, we can revitalize bug 237882.
Thank you.
Comment 3 Tomas Zezula 2015-03-27 12:56:19 UTC
Fixed jet-main df5fee6e6f46.
Fixed in generic java project support. The support should be used by all java type projects. The fixed was tested with j2se project, jfx project, web project.
As the detection is language specific (it finds the first java or class file, parses package and uses it to find the root) I cannot help with python project. The python project probably has some similar logic.
Thanks for perfect report with test case!
Comment 4 Quality Engineering 2015-03-28 08:19:29 UTC
Integrated into 'main-silver', will be available in build *201503280001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/df5fee6e6f46
User: Tomas Zezula <tzezula@netbeans.org>
Log: #244085:Project structure with cyclical symlinks to a common root results in infinite looping and heap space OOM