Bug 368483 - Mac OSX JDT launching plugin needs to check new VM locations on Snow Leopard and Lion
Summary: Mac OSX JDT launching plugin needs to check new VM locations on Snow Leopard ...
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.8   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P2 major with 1 vote (vote)
Target Milestone: 4.3 M6   Edit
Assignee: Michael Rennie CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks: 369524
  Show dependency tree
 
Reported: 2012-01-12 15:01 EST by Joel Regen CLA
Modified: 2013-02-21 11:58 EST (History)
9 users (show)

See Also:


Attachments
Stack Trace 1 (13.80 KB, text/plain)
2012-01-12 16:34 EST, Joel Regen CLA
no flags Details
Stack Trace 2 (14.31 KB, text/plain)
2012-01-12 16:35 EST, Joel Regen CLA
no flags Details
Stack Trace 3 (14.31 KB, text/plain)
2012-01-12 16:35 EST, Joel Regen CLA
no flags Details
Stack Trace 4 (14.31 KB, text/plain)
2012-01-12 16:36 EST, Joel Regen CLA
no flags Details
Stack Trace 5 (13.19 KB, text/plain)
2012-01-12 16:36 EST, Joel Regen CLA
no flags Details
work in progress (3.80 KB, patch)
2013-02-15 12:13 EST, Michael Rennie CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joel Regen CLA 2012-01-12 15:01:57 EST
Build Identifier: 20100617-1415

running eclipse Helios 3.6 (64 bit) on Mac OS X (10.6.8).
java -version:
java version "1.6.0_29"
Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-10M3527)
Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02-402, mixed mode)
GWT plugin, 2.4, installed.

On start up the 'initializing java tooling: 30%' status displays for about a minute if VPN (Cisco anyconnect) is running.  < 2 seconds (or not at all) without VPN running.

Also, can get the SBOD (spinning beachball of death) if I have a GWT project with a run or debug configuration and try to edit it (or create one).  Locks up the launch config dialog.

This happens with only one project in workspace (or more).
This happens with or without the split tunnel setup (multi-home).
Happens with Indigo or Helios, 32 bit or 64 bit.


  

Reproducible: Always

Steps to Reproduce:
1. Start the cisco VPN Anyconnect client
2. Start eclipse
3. Watch the 'initialzing java tooling' status for about a minute.
4. Try creating a new Debug configuration for a GWT project.
5. Watch the SBOD for about 20 minutes.
Comment 1 Stephan Herrmann CLA 2012-01-12 16:09:06 EST
Can you get a stack dump when it hangs?
Comment 2 Joel Regen CLA 2012-01-12 16:33:02 EST
Stack traces attached. Taken in order, about 5 seconds apart during hang, starting with stack-trace.1 through stack-trace.5.
Comment 3 Joel Regen CLA 2012-01-12 16:34:44 EST
Created attachment 209410 [details]
Stack Trace 1
Comment 4 Joel Regen CLA 2012-01-12 16:35:20 EST
Created attachment 209411 [details]
Stack Trace 2
Comment 5 Joel Regen CLA 2012-01-12 16:35:45 EST
Created attachment 209412 [details]
Stack Trace 3
Comment 6 Joel Regen CLA 2012-01-12 16:36:10 EST
Created attachment 209413 [details]
Stack Trace 4
Comment 7 Joel Regen CLA 2012-01-12 16:36:41 EST
Created attachment 209414 [details]
Stack Trace 5
Comment 8 Stephan Herrmann CLA 2012-01-12 17:06:33 EST
Thanks, this seems to be the culprit:

"Worker-4" prio=5 tid=11e436800 nid=0x121d10000 runnable [121d0f000]
   java.lang.Thread.State: RUNNABLE
	at java.io.UnixFileSystem.getBooleanAttributes0(Native Method)
	at java.io.UnixFileSystem.getBooleanAttributes(UnixFileSystem.java:228)
	at java.io.File.isFile(File.java:778)
	at org.eclipse.jdt.internal.launching.macosx.MacOSXVMInstallType.getDefaultSystemLibrarySource(MacOSXVMInstallType.java:189)
	at org.eclipse.jdt.internal.launching.StandardVMType.getDefaultLibraryLocations(StandardVMType.java:310)
	at org.eclipse.jdt.launching.JavaRuntime.getLibraryLocations(JavaRuntime.java:1639)
	at org.eclipse.jdt.internal.launching.JREContainer.computeClasspathEntries(JREContainer.java:293)
	at org.eclipse.jdt.internal.launching.JREContainer.getClasspathEntries(JREContainer.java:267)
	at org.eclipse.jdt.internal.launching.JREContainer.getClasspathEntries(JREContainer.java:371)
	at org.eclipse.jdt.internal.core.JavaProject.resolveClasspath(JavaProject.java:2651)
	at org.eclipse.jdt.internal.core.JavaProject.resolveClasspath(JavaProject.java:2783)
	at org.eclipse.jdt.internal.core.JavaProject.getResolvedClasspath(JavaProject.java:1915)
	at org.eclipse.jdt.core.JavaCore.initializeAfterLoad(JavaCore.java:3496)
	at org.eclipse.jdt.internal.ui.InitializeAfterLoadJob$RealJob.run(InitializeAfterLoadJob.java:35)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

Searching bugzilla for getBooleanAttributes0 yields a number of bugs
with similar stack traces, e.g.: bug 312038, bug 338251, bug 336302,
bug 312959. In some of these bugs things have been improved by avoiding
file access through caching. However, the bottom line seems to be that
file system access is just unbearably slow, be it remotely mounted or huge 
or what ever.

Could you please check whether toggling your VPN affects access to any
part of your file system? In particular check any location where we
might look for sources of your JRE.
Comment 9 Joel Regen CLA 2012-01-12 18:05:42 EST
not sure what I should be looking for at this point.
Comment 10 Stephan Herrmann CLA 2012-01-13 07:20:53 EST
(In reply to comment #9)
> not sure what I should be looking for at this point.

My impression is that this bug is not a misbehavior of the JDT but
an issue between your VM and your file system.

I was hoping that either you can verify that other ways to access the
file system show a similar delay or from reading through those other
bugs with the same symptom you would get a better understanding of
the root cause and/or hints how to work around.

I'm reassigning to JDT/Debug (who own the jdt.launching implementation)
- perhaps they can give more advice.
Comment 11 Joel Regen CLA 2012-01-13 09:50:45 EST
OK..  bug 312038 provided me with some very helpful insight. Especially this:

************************
"I have found out what the problem is. The code which is looking for src.jar and
src.zip is not finding the file as eclipse is looking in the following
directory.

/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home

But the src.jar is in the new location.

/Library/Java/JavaVirtualMachines/1.6.0_22-b04-307.jdk/Contents/Home/src.jar

I copied the src.jar file into the old location and now it works.

I found this out as it was also hanging when I went into the Preferences to
look at the installed JRE's and it was hanging there. I then did a thread dump
and looked for the source code which told me it was looking for the src.jar or
src.zip file."
************************


I was able to also copy my src.jar from new install to old location and problem disappeared.  Now I'm trying to figure out how it got messed up.

I had very recently run a Mac OS X update which DID update the JVM and I suspect that Eclipse just somehow did not find the new src.jar location.

Any insight to that would be appreciated.
Comment 12 Joel Regen CLA 2012-01-13 10:28:19 EST
this was also interesting:
http://stackoverflow.com/questions/6614380/jdk-on-osx-10-7-lion
Comment 13 Michael Rennie CLA 2012-01-17 12:30:42 EST
(In reply to comment #12)
> this was also interesting:
> http://stackoverflow.com/questions/6614380/jdk-on-osx-10-7-lion

The problem comes from our jdt.launching.macosx bundle. In the VM type we have search cues for where to find the JRE / SDK installs. These cues have not been updated to support the new location of snow leopard / lion, so we end up following links and searching pretty much the whole HD.

See org.eclipse.jdt.internal.launching.macosx.MacOSXVMInstallType#getDefaultJavadocLocation for more info.
Comment 14 Michael Rennie CLA 2012-05-02 11:41:10 EDT
> (In reply to comment #12)
 
> The problem comes from our jdt.launching.macosx bundle. 

There is a bit deeper problem here. During an upgrade the old VM is moved to the new location, but in Eclipse you have a JRE defined that references the old location, so when we try to resolve the JRE we fail (causing delays, etc). Even if we did update the search cues it would not help us to know where the VM Eclipse used to reference has moved to. In this case we should be doing a better job of ignoring the VM if it has completely moved - but I am guessing the link for the VM is remaining but the actual guts have been removed.

As I see it there is really two workarounds for this:

1. copy the source jar back to the old location
2. go to the Installed JREs page and remove the old JRE and hit the search button to find the new one.

We should update our JRE resolution code to ignore this and remove 'moved' VMs (I am surprised we don't already)

Fixing this could have an effect on how we re-resolve JREs for Mac (or in general), so I am going to defer this until 4.3 so we can spend more time on it (and not risk breaking M7).
Comment 15 John Arthorne CLA 2012-06-05 09:59:20 EDT
P1 priority means we will not ship Juno without it. Since it is already
targetted to 4.3/Kepler I will move to P2 priority.
Comment 16 David Williams CLA 2012-10-23 09:32:43 EDT
Just to cross reference, see bug 392434 for similar (but less complicated) issue.
Comment 17 Michael Rennie CLA 2013-02-15 12:13:55 EST
Created attachment 227141 [details]
work in progress

This patch updates the library location source / library info resolution to rely on the new locations.
Comment 18 Michael Rennie CLA 2013-02-21 11:58:34 EST
Pushed patch + updates to: 

http://git.eclipse.org/c/jdt/eclipse.jdt.debug.git/commit/?id=deac7a650c763324df6eaf51ef88d4d23a88d0d9

The fix adds some bounds for searching and makes sure to check for src.jar and src.zip. It is still clunky though, and could be made a lot faster if we cached the locations for the default libraries (see bug 401432) - reason being, that when you add the JRE / JDK or when you start Eclipse these source locations are re-computed for each default library, one at a time.