GithubHelp home page GithubHelp logo

Comments (5)

filiphr avatar filiphr commented on August 28, 2024

@Sbruk from what I can see in the lock it seems like the job cannot get executed because the process instance is exclusively locked:

2024-02-15 08:34:09,588 DEBUG [org.flo.job.ser.imp.cmd.LockExclusiveJobCmd] (flowable-async-job-executor-thread-55) Executing lock exclusive job 97234 97230
2024-02-15 08:34:09,592 DEBUG [org.flo.job.ser.imp.asy.ExecuteAsyncRunnable] (flowable-async-job-executor-thread-55) Could not lock exclusive job. Unlocking job so it can be acquired again. Caught exception: Could not lock process instance

This means that either there are multiple async exclusive jobs for a single process instance or the process instance is locked, but it has never been released.

Locking a job from act_ru_job is not what is happening.

protected long acquireAndExecuteJobs(CommandExecutor commandExecutor, int remainingCapacity)

this is indeed locking a job for executing it. Then in ExecuteAsyncRunnable#lockJob the lock is done to do an exclusive lock on the process instance if the job is an exclusive lock.

How many jobs are there for the process instance of the execution with id 97230?

from flowable-engine.

Sbruk avatar Sbruk commented on August 28, 2024

Hello @filiphr,
Thanks for your prompt answer!

Following the restart, for a given process_instance_id_ there is exactly one entry in act_ru_job.
Please find below some additional information:

  • At the time I stop my application, I have 100+ entries in this table and upon restart, only 8 remain stuck "forever", which is the default value of the executor service's corePoolSize if I'm not mistaken. All the other entries are properly executed by flowable.
  • My serviceTask does not define explicitly the flag exclusive and is using a JavaDelegate class for its execution.
  • In case it helps, here is an extract of the table: act_ru_job.xlsx. The IDs have changed as I re-created my DB compared to my initial set of logs but the issue remains.

Thanks again for your help!

from flowable-engine.

filiphr avatar filiphr commented on August 28, 2024

I see that you are using some dummy model. Is this easily reproducible? Can you perhaps create a minimal example that we can run and test?

My serviceTask does not define explicitly the flag exclusive and is using a JavaDelegate class for its execution.

The default is that it is exclusive, so it you do not set it then it is true. It is an opt-out value. So you need to put exclusive to be false for it to be disable.

In any case, can you perhaps also share the act_ru_execution table. I assume that it would have the lock_time_ and lock_owner_ columns set.

Since you are not using Spring Boot. Are you properly closing the engine when the application shuts down? There is ProcessEngine#close that would do

if (asyncExecutor != null) {
    commandExecutor.execute(new ClearProcessInstanceLockTimesCmd(asyncExecutor.getLockOwner()));
}

that would clear the lock time on the process instances. If you wait for 1 hour those jobs would eventually get executed, 1 hour is the default lock time for the jobs, which is the same time the process instance would get locked.

from flowable-engine.

Sbruk avatar Sbruk commented on August 28, 2024

Indeed, I've missed the lock on the act_ru_execution table during my test / manual operations. I've done some extra tests this morning following your feedback and it looks all good now. Regarding the shutdown, I'm more interested in the case of an unexpected shutdown so I cannot guarantee the execution of the close method anyway...
Thanks a lot for your help @filiphr !

from flowable-engine.

filiphr avatar filiphr commented on August 28, 2024

Glad that it got resolved for you @Sbruk.

Indeed if the application shuts down without going through all the close methods it can be in a state that you are seeing. It will eventually be cleared up, after 1 hour passes. I mentioned the close, because the jobs should have been locked as well (if there was an unexpected shutdown).

from flowable-engine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.