Scheduled Workflow not Working


I have a problem with the scheduled workflow not working as I would expect. I have a large number of workflow items that create tasks for users to deal with before other tasks are then generated.

Everything works . . . periodically. When the user closes and saves the tasks it triggers the next task/s to be generated. The issue is when this happens it takes a long time for the tasks to be created and sometimes either the process times out or the user clicks off of the page. I changed the workflows to run on schedule hope I could take the task away from the saving process.

Unfortunately the scheduler isn’t working as I thought it should.
Cron is running in the windows scheduled tasks successfully,
I have no php errors relating to this
the scheduler in the Admin section is reporting success each time.

When looking through the logs in debug mode I can see 225 workflow records loading during the cron process but nothing is done with them as far as I can see.

It is strange how the user can active the workflow via the save but the schedule isn’t working. Maybe I missunderstood the schedule rule (wouldn’t be the first time)

Each workflow is set to
RUN: Always
RUN ON: All Records
STATUS: Active

I check to see if the record has been changed, check the status is either completed or deferred, and that the selected task is related to this workflow.

I have increased the php timeouts but this process can take 5 minutes or more sometimes so not ideal.

SuiteCRM Version 7.8.6
Sugar Version 6.5.23 (Build 1061)

Thank you

Please confirm, in Admin / Schedulers, the job “Process AOW Workflow” says “Last ran successfully” at a recent time? Does that time appear to be in the correct timezone?

Note that Workflows running “on save” or “on scheduler” have two completely different triggering mechanisms, so it’s perfectly possible that one is working and other one still needs to be configured correctly.

Thanks for the reply,

I am in the uk and this is showing 18th of June 2018 at ten thirty five in the evening.

“Process Workflow Tasks done 18/06/2018 22:35 18/06/2018 22:35”

Each workflow is running “always”. I have changed to “Only in the scheduler” but nothing is trigger either.

I’ve been thinking about your case, and I’m suspecting database problems.

Please run the first query in this post

I bet you have an overgrown aow_processed table. This would explain the long delays, and the occasional timeouts that make the process work erratically.

humm interesting, this table also holds a number of tasks still “running” is it worth removing these form the DB or even setting them to Complete.

rows DATA idx total_size idxfrac
job_queue 0.116M 0.076G 0.048G 0.125G 0.631
securitygroups_records 0.067M 0.030G 0.048G 0.078G 1.606
tasks 0.025M 0.012G 0.015G 0.027G 1.245
aow_processed 0.019M 0.008G 0.009G 0.017G 1.172
meetings 0.011M 0.007G 0.007G 0.015G 1.027
aow_processed_aow_actions 0.016M 0.005G 0.009G 0.014G 1.649
meetings_users 0.017M 0.004G 0.008G 0.012G 2.041
calls 0.004M 0.003G 0.004G 0.007G 1.239
aod_indexevent 0.010M 0.004G 0.003G 0.007G 0.693
calls_users 0.005M 0.001G 0.004G 0.006G 3.684

Be very careful when messing directly with the database, make backups, and do things at your own risk, don’t take my word as wisdom :slight_smile:

I’ve seen people do clean-ups with queries like this:

DELETE FROM job_queue
WHERE status = 'done' AND date_entered < '2018-05-01';

About the aow_processed, you might have to be more careful. If you have Workflows that don’t allow “Repeated runs”, then even old information can still be needed. but you should definitely try to make this table lighter, if you can.

About the securitygroups_records, you should not delete these if they are still referring to existing records in the other modules. You could, however, use some clever SQL to delete orphaned entries, where the records they reference were already deleted.

Also, see this link