This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 337842 - Stack overflow during refactoring operation if any TS projects have circular references
Summary: Stack overflow during refactoring operation if any TS projects have circular ...
Status: CLOSED FIXED
Alias: None
Product: Tigerstripe (Archived)
Classification: Technology
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 0.5M0   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-22 09:57 EST by Valentin Yerastov CLA
Modified: 2011-04-04 16:42 EDT (History)
3 users (show)

See Also:


Attachments
337842.patch (42.81 KB, text/plain)
2011-03-11 08:51 EST, Valentin Yerastov CLA
no flags Details
337842_2.txt (3.99 KB, text/plain)
2011-03-24 18:15 EDT, Valentin Yerastov CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Valentin Yerastov CLA 2011-02-22 09:57:45 EST
Build Identifier: 

Problem in org.eclipse.tigerstripe.workbench.internal.api.impl.TigerstripeOssjProjectHandle.getReferencingModels(int) method, which call self recursively for all projects, without checking cycles.

Reproducible: Always

Steps to Reproduce:
1. Make circular references between the two TS projects.
2. Try rename a entity in any project into workspace(not necessarily in the previous two).
Notice: during rename operation you get the stack overflow.
Comment 1 Chris Hartley CLA 2011-02-23 20:17:45 EST
The circular reference should be blocked in step 1.

In fact when adding project dependencies, only projects that aren't directly or indirectly dependent on the project should be listed.

A safeguard for getReferencingModels(int)
might be to throw an error and exit if it ever gets a handle to itself (to at least terminate before causing an infinite loop).
Comment 2 Navid Mehregani CLA 2011-02-24 11:32:51 EST
(In reply to comment #1)
> The circular reference should be blocked in step 1.

It's not trivial to do this in JDT.  Circular dependencies can be quite complex and involve many projects.  It's not always two projects (that's the simplest case).  It's not worth the effort and the amount of changes required to do this.  JDT doesn't do it either.  It simply warns the user when there is a circular dependency and we should do the same.
Comment 3 Valentin Yerastov CLA 2011-02-24 12:38:14 EST
I think one of approaches we should detect circular references and report errors(using problem markers) at the stage of change dependencies as it do maven eclipse plugin. But we can continue to work with the project and we can do any operation in artifact manager and it is should not cause any problems(stackoverflow...) if we have circular references.
Comment 4 Navid Mehregani CLA 2011-02-24 12:44:05 EST
(In reply to comment #3)
> I think one of approaches we should detect circular references and report
> errors(using problem markers) at the stage of change dependencies as it do
> maven eclipse plugin. But we can continue to work with the project and we can
> do any operation in artifact manager and it is should not cause any
> problems(stackoverflow...) if we have circular references.

Agree.
That's exactly how I expect it to behave.
Comment 5 Chris Hartley CLA 2011-02-24 16:20:35 EST
OK with me then.

It would be good if the circular reference can be detected when the project is added and not have to wait for a rename or other operation.
Comment 6 Valentin Yerastov CLA 2011-03-11 08:51:13 EST
Created attachment 190979 [details]
337842.patch

Done.
Comment 7 Yuri Strot CLA 2011-03-14 07:07:03 EDT
Valentin's patch applied.
Comment 8 Navid Mehregani CLA 2011-03-16 17:45:46 EDT
I'm still able to reproduce this issue.  The StackOverflow error is still logged.
Comment 9 Valentin Yerastov CLA 2011-03-24 18:15:10 EDT
Created attachment 191877 [details]
337842_2.txt

Done.
Comment 10 Yuri Strot CLA 2011-03-24 18:41:27 EDT
337842_2 patch applied.
Comment 11 Navid Mehregani CLA 2011-04-04 16:42:05 EDT
Verfieid. Thanks!