[GRADLE-1539] Tooling API should provide cancelation for long running operations Created: 12/May/11  Updated: 05/Aug/14  Resolved: 05/Aug/14

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: 2.1-rc-1

Type: Improvement
Reporter: Kris De Volder Assignee: Radim Kubacki
Resolution: Fixed Votes: 38


With some Gradle operations taking over 10 minutes to run, cancelation is very important.

In the present condition, it is often impossible to gracefully even just shutdown Eclipse without waiting for several minutes for some pending background Gradle task to complete. (A pity really since, if the next thing is shutting down Eclipse, the work done by these tasks is really not needed anymore).

Since there is no API for canceling tasks or model build requests, the cancel button in Eclipse do not work, nor does Eclipse have any way of shutting down tasks prematurely if the result of the task is no longer required (such as when shutting down Eclipse).

This is all potentially very frustrating to users. Often the only way to deal with these hangups is to kill the entire Eclipse process.

Comment by Attila Kelemen [ 04/Sep/12 ]

This is my number one request as well. I would also add, that cancellation is not just important because a task might take too long to execute but if executing the main class of a project is done through a Gradle task, it is important to allow the task to be canceled (and the forked process to be killed) because the code might be buggy and there is no other way to stop it. Also there can be multiple java processes running (including the Gradle daemon) and choosing which to kill is not trivial.

Comment by Vasily Karyaev [ 08/Dec/12 ]

Is there any chance this issue will be resolved within the next 6 months (at least)?

It seems like a design flaw to me.
The issue affects not only the long running operations, but regular builds too. In large and complex projects the builds may take minutes to complete. It is a frequent situation when developers change their mind and decide to stop the build. Going to the command line prompt, searching for the processes and killing them is a real pain, apparently.

Comment by Szczepan Faber [ 10/Dec/12 ]

Thanks guys for feedback. We'll take it into account during the next prioritization session. I say that there is a good chance it will be solved in the next 6 months.

Comment by Jin Chai [ 14/Feb/13 ]

It is the number one for me. It will be very frustrating to kill eclipse every time when the task hangs especially if you have JavaExec task to start long running process.

Comment by Ron Pressler [ 14/Dec/13 ]

With Gradle gaining momentum, more and more IDEs integrate with it, and are expected to integrate well. Not being able to cancel a build, or, more importantly (as Attila said), a run, is a detriment to high quality IDE integration expected from a popular build tool.

Comment by Shevek [ 14/Dec/13 ]

Please, please fix this bug. I love gradle, I expect to use it for all my projects henceforth, but just launching a job and being unable to kill it (e.g. a test case which hung/looped) is a major weakness in gradle's IDE integration. I vote heavily for this bug. Thank you.

Comment by Thorsten Schemm [ 04/Feb/14 ]

I have been wondering if there might be a workaround to this issue. Since the tooling API always uses the daemon process, is there a way to programmatically get the process ID of the daemon process and kill it through platform specific Runtime.exec(..) magic? Lots of folks watching this issue for a while now, maybe someone already found an acceptable workaround?

Comment by Radim Kubacki [ 04/Feb/14 ]

Please bear with us a little longer. Exposing internal details and playing with OS specific tools to kill processes is not a preferred way how to address this.

Comment by Eran Samocha [ 04/May/14 ]

Any updates on this issue? it's very frustrating

Generated at Wed Jun 30 11:58:05 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.