Here is the issue that I am facing.
I am using simple workflow with a script task and I am using below script task.
def x = 0
def y = 5
while ( y > 0 ) {
x++
}
which makes the execution as infinite. I have script task as 'async'. Also the 'lockTimeInMillis' setting i set it to 120000(2 mins).
For above case when I start process the thread hangs in infinite loop and after 2 mins another thread is started to execute the same step and this continues further which increases thread count to 100 and CPU usage as 100%.
Fix done till now:
I dont want retry in my application so I have one class which implements org.activiti.engine.impl.interceptor.Command<Object>.execute() method and make retry count to 0 for that job ID. So I check the task information in my application and if it exist then I throw some exception which is caught by above class and it does not do retry. So the problem of high CPU and threads increasing reduced.
But still the first thread that has started the process waits. Is there a way by which I can kill that thread ?