New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Catch IllegalAccessError exception to prevent Eclipse hang while creating Gradle daemon #238
Conversation
integration and Eclipse Gradle Plugin. Due to this uncatched exception, Eclipse hangs on building model
Conflicts: subprojects/cli/src/test/groovy/org/gradle/cli/CommandLineParserTest.groovy
Thanks for the pull request. To fix this, I'd rather we changed ExecHandlerRunner to use ProcessLauncher from our native integration (https://github.com/adammurdoch/native-platform), which takes care of this stuff. The change would involve removing the call to ProcessParentingInitializer.intitialize() and ProcessBuilder.start() and replacing them with a call to ProcessLauncher.start(ProcessBuilder). Would you be interested in making this change? |
I've changed ExecHandleRunner so that it uses ProcessLauncher to start the gradle daemon. I hope it's what has to be done. I only have a question about the synchronized block in which the process is started. Is it still mandatory or is the native platforrm take care of the problem? |
Thanks for the changes. Yes, we can get rid of the synchronized block now. Also, can you send us a signed copy of the CLA, as per CONTRIBUTING.md so we can merge your changes. Thanks. |
I've just sent the signed CLA for contributing. I've also simplified the method run by removing the synchronized block. Thanks for your help. |
Thanks for the changes. We'll merge this soon. |
OK, tested and the patch really helps. Adam, do we want to push it to release branch for 1.11? or just master? I will make a simpler/squeezed version of Gregory's change. |
yes, let's apply the changes to the release branch. |
I squashed the commits and pushed as e44d121 into release branch. Thank you for the patch. |
When using both Lombok and Gradle plugin integration, Eclipse hangs on the build model task.
The following bugs from STS issue tracker describe the problem :
https://issuetracker.springsource.com/browse/STS-3419
https://issuetracker.springsource.com/browse/STS-3495
After debugging the Gradle Toolong API, I see that an IllegalAccessError exception occurred while invoking the code : ProcessParentingInitializer.intitialize() in class ExecHandleRunner.
Here is the exception message :
Caused by: java.lang.IllegalAccessError: tried to access method com.sun.jna.Pointer.(J)V from class org.gradle.internal.nativeplatform.jna.Kernel32
at org.gradle.internal.nativeplatform.jna.Kernel32.(Kernel32.java:40)
at org.gradle.internal.nativeplatform.jna.WindowsHandlesManipulator.uninheritStandardStreams(WindowsHandlesManipulator.java:41)
at org.gradle.process.internal.ProcessParentingInitializer$2.create(ProcessParentingInitializer.java:75)
at org.gradle.internal.concurrent.Synchronizer.synchronize(Synchronizer.java:31)
at org.gradle.process.internal.ProcessParentingInitializer.intitialize(ProcessParentingInitializer.java:67)
at org.gradle.process.internal.ProcessParentingInitializer.intitialize(ProcessParentingInitializer.java:42)
at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:62)
I haven't found the problem origin but it seems to be linked with classloading.
If the exception is caught, Eclipse doesn't hang. An error message is displaye. The gradle plugin works well thereafter.