Skip to content
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

Closed
wants to merge 10 commits into from

Conversation

GregoryBevan
Copy link

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.

radimk and others added 4 commits January 22, 2014 16:58
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
@adammurdoch
Copy link
Member

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?

@GregoryBevan
Copy link
Author

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?

@adammurdoch
Copy link
Member

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.

@GregoryBevan
Copy link
Author

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.

@adammurdoch
Copy link
Member

Thanks for the changes. We'll merge this soon.

@radimk
Copy link
Contributor

radimk commented Jan 27, 2014

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.

@adammurdoch
Copy link
Member

yes, let's apply the changes to the release branch.

@radimk
Copy link
Contributor

radimk commented Jan 27, 2014

I squashed the commits and pushed as e44d121 into release branch.

Thank you for the patch.

@radimk radimk closed this Jan 27, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants