Bug 177922 - FlexibleProjectContainer refresh logic sporadically leaves project with "missing library" error on rename/delete
Summary: FlexibleProjectContainer refresh logic sporadically leaves project with "miss...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3 RC1   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-03-18 04:27 EDT by Zohar Amir CLA
Modified: 2011-05-20 09:23 EDT (History)
3 users (show)

See Also:
frederic_fusier: review+


Attachments
Repro Project (4.01 KB, application/octet-stream)
2007-04-17 18:44 EDT, Konstantin Komissarchik CLA
no flags Details
Possible fix and regression test (3.51 KB, patch)
2007-05-15 04:55 EDT, Jerome Lanneluc CLA
no flags Details | Diff
Possible fix and improved regression test (3.62 KB, patch)
2007-05-15 05:37 EDT, Jerome Lanneluc CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Zohar Amir CLA 2007-03-18 04:27:30 EDT
Build ID: 3.3.0 - I20070222-0951

Steps To Reproduce:
1.Create a dynamic web project
2.Create a Java project
3.Make the web project depend on the Java project (add it to the "J2EE module dependencies"
4.Refactor the Java project and change its name
5.The web project cannot be compiled, because it is looking 
for a "missing required Java project" (it is looking for a project with the old name)


More information:
using WTP 2.0 M5
Comment 1 Rob Frost CLA 2007-04-11 15:48:14 EDT
Well, this is not an issue with the refactoring logic, that is working fine (the dependent-module element for the dependent Java project is correctly updated to have the new name); if you close and reopen web project, everything is happy; so, looks like an issue with refreshing the web app libraries cp container (either in the virtual comp layer or the cp container impl) - going to debug more into it now and will update and possibly reassign as appropriate.
Comment 2 Rob Frost CLA 2007-04-11 16:01:49 EDT
hmmm, the WebAppLibrariesContainer appears to be updating things correctly - nothing interesting in the log
Comment 3 Rob Frost CLA 2007-04-11 16:15:07 EDT
OK, something interesting: disabling resolution of cp entry-based virtual references appears to fully eliminate this issue; so, there is some bad interaction between that logic and the cp container refresh
Comment 4 Rob Frost CLA 2007-04-11 16:37:55 EDT
False lead - the issue is sporadic
Comment 5 Rob Frost CLA 2007-04-11 17:22:55 EDT
Here is the latest:

-It is sporadic
-When I debug into WebAppLibrariesContainer.refresh(), everything looks OK in terms of the new cp entries that are created based on the computed virtual references
-I've been able to get this to repro with virtual reference computation for cp entries commented out so I believe that is not involved.
-I've been able to get this to repro by just renaming a jar file under the WEB-INF/lib folder so project rename/delete refactoring is not involved.

So, looks like our mechanism of triggering a container refresh/reinstall via a resource change listener (FlexibleProjectContainer.Listener) is no longer working for some reason (likely due to an underlying change in 3.3); Konstantin, looks like listener (and base container class) has been primarily your code so sending you way next.

Let me know if you think the classpath dependency logic looks in any way involved here.
Comment 6 Konstantin Komissarchik CLA 2007-04-17 18:41:22 EDT
Can someone from the JDT team take a look at this repro? I suspect there might be a race condition between the part of the JDT that's in charge of producing this error and the part that's responsible for managing the actual classpath. 

To repro, you can do the following:

1. Get an M6 build of WTP and the dependencies.
2. Import the attached projects (will attach in a sec).
3. Setup your workbench so that you can see Project Explorer, Navigator, and Problems views at the same time.
4. In the Project Explorer view, expand the Web App Libraries classpath container. Note that it has a single jar in it. This classpath container is responsible for putting jars in web app's WEB-INF/lib directory on the project classpath.
5. Find this jar in the Navigator view (WebContent/WEB-INF/lib/stuff.jar).
6. Rename it.
7. You should see the Web App Libraries container in the Project Explorer view update to reflect the new name of the jar.
8. Did you get "Project 'web' is missing required library: 'WebContent/WEB-INF/lib/stuff.jar'" error message in the problems view? If not, repeat steps 6-8. I get this to repro with approx 50% consistency.
9. Once you get into this state, cleaning the project doesn't help, but closing and re-opening it does help.

Reducing the severity since the problem doesn't happen all the time and when it does there is a work-around (close and re-open the project).
Comment 7 Konstantin Komissarchik CLA 2007-04-17 18:44:27 EDT
Created attachment 64116 [details]
Repro Project
Comment 8 Jerome Lanneluc CLA 2007-05-15 04:55:53 EDT
Created attachment 67197 [details]
Possible fix and regression test
Comment 9 Jerome Lanneluc CLA 2007-05-15 05:37:48 EDT
Created attachment 67203 [details]
Possible fix and improved regression test
Comment 10 Jerome Lanneluc CLA 2007-05-15 06:51:37 EDT
Fix and test released for 3.3RC1 in HEAD.
Comment 11 Frederic Fusier CLA 2007-05-16 07:28:00 EDT
Verified for 3.3 RC1 using I20070516-0010