The final word on Google Eclipse plugin OSX crashes

I’ve blogged about the subject of GWT JVM crashes far too much (here and here).  This is, I hope, the final word on the subject.  I spent some time disassembling the Google Eclipse plugin (did I agree not to do that in one of the EULAs? ;) ) and discovered that they are launching the JVM without using the Eclipse infrastructure.  This means that the JVM arguments are effectively hardcoded, except in one case where -startOnFirstThread is passed for OSX clients.  For those interested, the buggy classes of note are GWTDeploymentParticipant and LaunchUtils.

I posted a note on the contributor’s list and received a response from a Googler suggesting that I wrap my Java executable in a shell script.  Not one to shy away from wrapping system executables with scripts, I decided to give it a shot tonight.  My first shell script attempt was a disaster (dear lazyweb: how can you get bash to respect quoted spaces when using $@?), so I gave it a whack in Python.

This is tested and somewhat guaranteed to work for JVM 1.6 under OSX:

cd /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin
sudo mv java java_wrapped
sudo nano java

And the script:

#!/usr/bin/env python
import sys
import os

print sys.argv
cmd = os.path.dirname(sys.argv[0]) + '/java_wrapped'

args = ['',
        '-XX:CompileCommand=exclude,org/eclipse/core/internal/dtree/DataTreeNode,forwardDeltaWith',
        '-XX:CompileCommand=exclude,org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding,<init>',
        '-XX:CompileCommand=exclude,org/eclipse/jdt/internal/compiler/lookup/ParameterizedMethodBinding,<init>']

args.extend(sys.argv[1:])

print cmd
print args
print ""

os.execv(cmd, args)

If you have any suggestions on how to improve my Python, I’d be glad to hear them in the comments.

UPDATE: Thanks to Vitali, I got a bash script working as well:

#!/bin/bash
`dirname $0`/java_wrapped \
        "-XX:CompileCommand=exclude,org/eclipse/core/internal/dtree/DataTreeNode,forwardDeltaWith" \
        "-XX:CompileCommand=exclude,org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding,<init>" \
        "-XX:CompileCommand=exclude,org/eclipse/jdt/internal/compiler/lookup/ParameterizedMethodBinding,<init>" \
        "$@"

10 Responses to “The final word on Google Eclipse plugin OSX crashes”

  1. [...] Google eats GWT dogfood The final word on Google Eclipse plugin OSX crashes [...]

  2. Vitali says:

    For bash, “$@” will properly quote all the arugments for you.

  3. matthew says:

    Vitali,

    Thanks for the hint! My bash-fu is not as strong as it could be. I’ll update the post if I can get it working w/ a bash script.

  4. 4F2E4A2E says:

    thx alot for this!
    i got it almost…
    ==============================================
    CompilerOracle: exclude org/eclipse/core/internal/dtree/DataTreeNode.forwardDeltaWith
    CompilerOracle: exclude org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.
    CompilerOracle: exclude org/eclipse/jdt/internal/compiler/lookup/ParameterizedMethodBinding.
    Compiling module org.aaa.bbb.Lkjh
    ### Excluding compile: org.eclipse.jdt.internal.compiler.lookup.ParameterizedMethodBinding::
    Compiling 5 permutations
    Permutation compile succeeded
    Linking into war
    Link succeeded
    Compilation succeeded — 27,729s
    ==============================================

    it does compile (10sec more than normal) now but i can’t run it:

    ==============================================
    CompilerOracle: exclude org/eclipse/core/internal/dtree/DataTreeNode.forwardDeltaWith
    CompilerOracle: exclude org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.
    CompilerOracle: exclude org/eclipse/jdt/internal/compiler/lookup/ParameterizedMethodBinding.
    CompilerOracle: exclude org/eclipse/core/internal/dtree/DataTreeNode.forwardDeltaWith
    CompilerOracle: exclude org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.
    CompilerOracle: exclude org/eclipse/jdt/internal/compiler/lookup/ParameterizedMethodBinding.
    You must use a Java 1.5 runtime to use GWT Hosted Mode on Mac OS X.
    ==============================================

  5. 4F2E4A2E says:

    thats the point i need 1.6 :/

    • Unfortunately there’s no way to run 1.6 on OSX if you want hosted mode (SWT doesn’t support OSX 64-bit’s java). The best you can hope for is the ability to compile code with the 1.6 JVM (allowing you to run 1.6 on the Google servers).

      OOPHM will likely solve this issue.

  6. helmers says:

    Thanks! I used the bash script and it works like a charm…

    Scary shit hacking the JVM like this, I have no clue what it’s doing, but at least I can deploy apps to Google AppEngine again ;)

  7. Paul Hassinger says:

    I’ve been using Galileo Eclipse on Mac OS X 64-bit Java 1.6, since it’s all that’s out there to run on 1.6. I’ve tried both using the shell script above and modifying the eclipse.ini file with it still crashing with the forwardDeltaWith error.

    Any other ideas? Maybe running SoyLatte might fix this? Anyone have any experience with it?

    I use Java 1.6 with J2EE servers running under 1.6 and running Eclipse under 1.5 is a pain when testing apps because of class version errors. It sounds like this is really something that can only get fixed by Apple releasing an updated 1.6 Java. It’s frustrating and I may just give up on using Mac at all and boot under Ubuntu or heck, even Windows so I can actually develop and be productive.

  8. Delisa Rekus says:

    Hehe, the website took a long time to load but it was worth it