[GRADLE-3200] NullPointerException in ProfileEventAdapter.completed(ProfileEventAdapter.java:72) Created: 20/Nov/14  Updated: 25/Jan/17  Resolved: 24/Jan/17

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: None

Type: Task
Reporter: Gradle Forums Assignee: Unassigned
Resolution: Duplicate Votes: 5


 Description   

After upgrading to gradle 2.0 we started seeing this NPE. We didn't see this in the initial QA. It wasn't until we started running a lot of concurrent jobs that this started happening.
Not sure what other info to provide. It's not a stack trace that I've seen anywhere else in this forum or in jira.

Here's the env:

#> gradle -version

------------------------------------------------------------

Gradle 2.0

------------------------------------------------------------

Build time: 2014-07-01 07:45:34 UTC

Build number: none

Revision: b6ead6fa452dfdadec484059191eb641d817226c

Groovy: 2.3.3

Ant: Apache Ant(TM) version 1.9.3 compiled on December 23 2013

JVM: 1.7.0_55 (Oracle Corporation 24.55-b03)

OS: Linux 3.11.0-18-generic amd64

We've been building each job in it's own --gradle-user-home to get around [1]https://issues.gradle.org/browse/GRAD....

gradle --no-daemon -i -b /opt/nim/parserV4/build.gradle -Pcfg=/cbdata/root/rg/chf/2014-07-01/job/151726/buildjob.json -Pstandalone= --stacktrace --gradle-user-home=/cbdata/root/rg/chf/2014-07-01/job/151726/.gradle --project-cache-dir /cbdata/root/rg/chf/2014-07-01/job/151726/.gradle run -PmergeOption=MERGEINDEX

Starting Build

================================================ Start building buildSrc

FAILURE: Build failed with an exception.

  • What went wrong:

java.lang.NullPointerException (no error message)

  • Try:

Run with --debug option to get more log output.

  • Exception is:

java.lang.NullPointerException

at org.gradle.profile.ProfileEventAdapter.completed(ProfileEventAdapter.java:72)

at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)

at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)

at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:83)

at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:31)

at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:83)

at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:31)

at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)

at com.sun.proxy.$Proxy16.completed(Unknown Source)

at org.gradle.initialization.DefaultGradleLauncher.stop(DefaultGradleLauncher.java:193)

at org.gradle.initialization.buildsrc.BuildSourceBuilder.createBuildSourceClasspath(BuildSourceBuilder.java:80)

at org.gradle.initialization.buildsrc.BuildSourceBuilder.buildAndCreateClassLoader(BuildSourceBuilder.java:51)

at org.gradle.initialization.SettingsHandler.findSettingsAndLoadIfAppropriate(SettingsHandler.java:86)

at org.gradle.initialization.SettingsHandler.findAndLoadSettings(SettingsHandler.java:46)

at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:120)

at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:105)

at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:85)

at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:81)

at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)

at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)

at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:39)

at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:29)

at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)

at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)

at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237)

at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)

at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)

at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)

at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)

at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)

at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)

at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)

at org.gradle.launcher.Main.doAction(Main.java:33)

at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)

at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)

at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)

at org.gradle.launcher.GradleMain.main(GradleMain.java:23)

----------------------------------------------------------------------------------------
[1] https://issues.gradle.org/browse/GRADLE-3106



 Comments   
Comment by Gradle Forums [ 20/Nov/14 ]

Seeing this in gradle 2.1 as well. Trace line numbers slightly different but it's the same problem. This is current bug.

gradle --no-daemon -i -b /opt/nim/parserV4/build.gradle -Pcfg=/cbdata/root/enm/ent/2014-05-25/job/151110/buildjob.json -Pstandalone= --stacktrace --gradle-user-home=/cbdata/root/enm/ent/2014-05-25/job/151110/.gradle --project-cache-dir /cbdata/root/enm/ent/2014-05-25/job/151110/.gradle run -PmergeOption=MERGEINDEX

Starting Build

================================================ Start building buildSrc

FAILURE: Build failed with an exception.

  • What went wrong:

java.lang.NullPointerException (no error message)

  • Try:

Run with --debug option to get more log output.

  • Exception is:

java.lang.NullPointerException

at org.gradle.profile.ProfileEventAdapter.completed(ProfileEventAdapter.java:74)

at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)

at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)

at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:83)

at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:31)

at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:83)

at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:31)

at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)

at com.sun.proxy.$Proxy16.completed(Unknown Source)

at org.gradle.initialization.DefaultGradleLauncher.stop(DefaultGradleLauncher.java:194)

at org.gradle.initialization.buildsrc.BuildSourceBuilder.createBuildSourceClasspath(BuildSourceBuilder.java:84)

at org.gradle.initialization.buildsrc.BuildSourceBuilder.buildAndCreateClassLoader(BuildSourceBuilder.java:55)

at org.gradle.initialization.SettingsHandler.findSettingsAndLoadIfAppropriate(SettingsHandler.java:104)

at org.gradle.initialization.SettingsHandler.findAndLoadSettings(SettingsHandler.java:48)

at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:121)

at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:106)

at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:86)

at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:80)

at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)

at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)

at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:36)

at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)

at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:51)

at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)

at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237)

at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)

at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)

at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)

at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)

at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)

at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)

at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)

at org.gradle.launcher.Main.doAction(Main.java:33)

at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)

at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)

at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)

at org.gradle.launcher.GradleMain.main(GradleMain.java:23)

Comment by Gradle Forums [ 20/Nov/14 ]

Can a JIRA issue be created to track this issue? We are seeing this frequently during the development of Grails 3.0 (master branch)

Comment by Abhishek Mukherjee [ 27/Apr/15 ]

For what it's worth, this seems to be failing as a result of:

BuildSourceBuilder.java
GradleLauncher gradleLauncher = buildGradleLauncher(startParameter);
try {
    return buildSrcCache.useCache("rebuild buildSrc", new BuildSrcUpdateFactory(buildSrcCache, gradleLauncher, new BuildSrcBuildListenerFactory()));
} finally {
    gradleLauncher.stop();
}

Which led us to try an rm -rf buildSrc/build. For us the permissions were incorrect and we couldn't actually rm it. Fixing the permissions made the error go away. Fix might be just have a better error message for this, if possible to detect?

Comment by Jim Weir [ 17/Jul/15 ]

I reached a point of getting this stack trace with any attempted Gradle operation. I traced this down to Gradle attempting to grab an exclusive file lock on ROOT/buildSrc/.gradle/noVersion/buildSrc/cache.properties.lock and that operation failing. In my particular scenario I am using Gradle within an SMB mounted folder so really something with Samba is the culprit. Just leaving this here in case it helps the diagnosis.

Comment by Benjamin Muschko [ 15/Nov/16 ]

As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub.

We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to.

Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:

  • Checking that your issues contain requisite context, impact, behaviors, and examples as described in our published guidelines.
  • Leave a comment on the JIRA issue or open a new GitHub issue confirming that the above is complete.

We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle!

Comment by Abhishek Mukherjee [ 16/Nov/16 ]

This is definitely still relevant in that it has bitten more than a trivial number of engineers at my company. I would still advocate for this to get prioritized. Thanks!

Comment by Eric Wendelin [ 24/Jan/17 ]

Moved to https://github.com/gradle/gradle/issues/1247

@Abhishek The code has significantly changed since this was reported, and this issue doesn't have a good steps to reproduce. Could you please provide your environment and a reproducible example in GitHub?

Comment by Abhishek Mukherjee [ 24/Jan/17 ]

I guess I'll comment in the github issue? The short version is it looks like this has been resolved somewhere in the significant changes you mention. The output is now a significantly more reasonable:

$ ./gradlew
Using gradle at '/tmp/test/gradlew' to run buildfile '/tmp/test/build.gradle':


FAILURE: Build failed with an exception.

* What went wrong:
java.io.FileNotFoundException: /private/tmp/test/buildSrc/.gradle/noVersion/buildSrc/cache.properties.lock (Permission denied)
> /private/tmp/test/buildSrc/.gradle/noVersion/buildSrc/cache.properties.lock (Permission denied)

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 1.101 secs
Comment by Benjamin Muschko [ 25/Jan/17 ]

Yes, please comment in the GitHub issue, @Abhishek. We won't track this JIRA issue anymore.

Generated at Wed Jun 30 12:42:38 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.