You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is related to #2406, where we discussed that the use case wasn't valid, however, this time, I think it is important to fix regardless of the use case.
Expected Behavior
Gradle 4.0 should not hang when a Task method annotated with @OutputFiles throws any kind of exception.
Current Behavior
I executed gw myPreceedingTask --stacktrace --info with the example build script below, and I was expecting an NPE to be reported.
> Task :myPreceedingTask
Putting task artifact state for task ':myPreceedingTask' into context took 0.0 secs.
Executing task ':myPreceedingTask' (up-to-date check took 0.0 secs) due to:
Task has not declared any outputs.
Hello from myPreceedingTask!
:myPreceedingTask (Thread[Task worker Thread 2,5,main]) completed. Took 0.014 secs.
<======-------> 50% EXECUTING [4m 6s]
> IDLE
^C
It just does not terminate.
I did some debugging, and found that the related code part that is interesting for us is org.gradle.execution.taskgraph.DefaultTaskExecutionPlan#executeWithTask:
Then, TaskInfo.isRequired is false for both :myTestTask and :myPreceedingTask, causing the build to hang. I think one of those should still be required.
If I replace the association from myPreceedingTask.finalizedBy myTestTask to myPreceedingTask.dependsOn myTestTask, then I get the right error message and the build terminates.
Context
In my actual code, the task that I represented here with myTestTask, is actually not a finalizer, but I have no idea why it is not required in the TaskInfo.
The text was updated successfully, but these errors were encountered:
rkrisztian
changed the title
Exceptions in @OutputFiles method can hang Gradle without reporting the exceptions
Exceptions in @OutputFiles method can hang Gradle 4.0 without reporting the exceptions
Jul 7, 2017
@rkrisztian Thanks for reporting. This is indeed a bug. That logic is intended to allow finalizer tasks to run when task execution fails, but when we have a failure while walking the task graph, we should abort all tasks. We'll get this fixed.
This is related to #2406, where we discussed that the use case wasn't valid, however, this time, I think it is important to fix regardless of the use case.
Expected Behavior
Gradle 4.0 should not hang when a
Task
method annotated with@OutputFiles
throws any kind of exception.Current Behavior
I executed
gw myPreceedingTask --stacktrace --info
with the example build script below, and I was expecting an NPE to be reported.It just does not terminate.
I did some debugging, and found that the related code part that is interesting for us is
org.gradle.execution.taskgraph.DefaultTaskExecutionPlan#executeWithTask
:where:
where:
Then,
TaskInfo.isRequired
isfalse
for both:myTestTask
and:myPreceedingTask
, causing the build to hang. I think one of those should still be required.If I replace the association from
myPreceedingTask.finalizedBy myTestTask
tomyPreceedingTask.dependsOn myTestTask
, then I get the right error message and the build terminates.Context
In my actual code, the task that I represented here with
myTestTask
, is actually not a finalizer, but I have no idea why it is not required in theTaskInfo
.Steps to Reproduce (for bugs)
This time my
gradle.build
looks like this:Your Environment
Still shouldn't matter.
The text was updated successfully, but these errors were encountered: