Project

General

Profile

Actions

Defect #1568

closed

Deleted dependent task - Fail in the task result

Added by Alena Peterová almost 6 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Radek Tomiška
Category:
Scheduler
Target version:
Start date:
03/19/2019
Due date:
% Done:

100%

Estimated time:
Affected versions:
Owner:

Description

Affected versions: 9.3.4, 7.8.2

Steps to reproduce:
  1. Create 2 scheduled tasks
  2. Create a new scheduled start for the task 2 - dependent on the task 1
  3. Run the task 1 -> everything OK
  4. Delete the task 2
  5. Run the task 1 -> the tasks ends with LONG_RUNNING_TASK_FAILED

The problem is that with removing the task 2, the dependent task trigger is not removed.

The error in the log (version 9.3.4):

2019-03-19 13:27:00.245  INFO 18232 --- [task-executor-1] e.b.i.c.a.e.AbstractEntityEventProcessor : Processor [long-running-task-execute-dependent-processor]([core]) start for [LongRunningTaskEvent [type: END, content: eu.bcvsolutions.idm
.core.scheduler.api.dto.IdmLongRunningTaskDto [id= 015c8814-9727-4f2b-b03b-b951fea0f34f], properties: {}]] with order [100].
2019-03-19 13:27:00.250  INFO 18232 --- [task-executor-1] LongRunningTaskExecuteDependentProcessor : Scheduled task [4f8f136e7682-ef9beed7-1136-4b04-a4b0-8a500a470cf1] ended. Dependent task [4f8f136e7682-a171486c-312b-49c4-a7c0-409f24906d9
8] will be executed in dryRun [false].
2019-03-19 13:27:00.251 ERROR 18232 --- [task-executor-1] e.b.i.c.a.e.AbstractEntityEventProcessor : [core:EVENT_EXECUTE_PROCESSOR_FAILED:d4354edf-39c6-4bb3-92b5-d5307e0c8b27] Event [null] failed in processor [long-running-task-execute-dep
endent-processor]. ({eventId=null, processor=long-running-task-execute-dependent-processor})

java.lang.IllegalArgumentException: [Assertion failed] - this argument is required; it must not be null
        at org.springframework.util.Assert.notNull(Assert.java:115)
        at org.springframework.util.Assert.notNull(Assert.java:126)
        at eu.bcvsolutions.idm.core.scheduler.service.impl.DefaultSchedulerManager.createTrigger(DefaultSchedulerManager.java:344)
        at eu.bcvsolutions.idm.core.scheduler.service.impl.DefaultSchedulerManager.runTask(DefaultSchedulerManager.java:320)
        at eu.bcvsolutions.idm.core.scheduler.event.processor.LongRunningTaskExecuteDependentProcessor.lambda$process$246(LongRunningTaskExecuteDependentProcessor.java:85)
        at java.util.ArrayList.forEach(ArrayList.java:1257)
        at eu.bcvsolutions.idm.core.scheduler.event.processor.LongRunningTaskExecuteDependentProcessor.process(LongRunningTaskExecuteDependentProcessor.java:80)
        at eu.bcvsolutions.idm.core.api.event.AbstractEntityEventProcessor.onApplicationEvent(AbstractEntityEventProcessor.java:237)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:166)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:138)
        at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:381)
        at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:348)
        at eu.bcvsolutions.idm.core.model.service.impl.DefaultEntityEventManager.publishEvent(DefaultEntityEventManager.java:276)
        at eu.bcvsolutions.idm.core.model.service.impl.DefaultEntityEventManager$$FastClassBySpringCGLIB$$1694e58f.invoke(<generated>)
        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
        at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:651)
        at eu.bcvsolutions.idm.chmi.model.service.impl.DefaultChmiEntityEventManager$$EnhancerBySpringCGLIB$$e7914aca.publishEvent(<generated>)
        at eu.bcvsolutions.idm.core.scheduler.api.service.AbstractLongRunningTaskExecutor.end(AbstractLongRunningTaskExecutor.java:236)
        at eu.bcvsolutions.idm.core.scheduler.api.service.AbstractLongRunningTaskExecutor.call(AbstractLongRunningTaskExecutor.java:191)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at org.springframework.security.concurrent.DelegatingSecurityContextRunnable.run(DelegatingSecurityContextRunnable.java:80)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)

2019-03-19 13:27:00.254 ERROR 18232 --- [task-executor-1] .c.s.a.s.AbstractLongRunningTaskExecutor : [core:LONG_RUNNING_TASK_FAILED:55a49341-f6e1-4ce5-acd2-6fe6ed433153] Task [015c8814-9727-4f2b-b03b-b951fea0f34f] type [eu.bcvsolutions.idm.core.audit.task.impl.RemoveOldLogsTaskExecutor] ended on instance [idm-primary] with exception. ({taskId=015c8814-9727-4f2b-b03b-b951fea0f34f, taskType=eu.bcvsolutions.idm.core.audit.task.impl.RemoveOldLogsTaskExecutor, instanceId=idm-primary})

java.lang.IllegalArgumentException: [Assertion failed] - this argument is required; it must not be null
        at org.springframework.util.Assert.notNull(Assert.java:115)

The error in the version 7.8.2 is more specific:

eu.bcvsolutions.idm.core.scheduler.exception.SchedulerException: null
    at eu.bcvsolutions.idm.core.scheduler.service.impl.DefaultSchedulerManager.createTriggerInternal(DefaultSchedulerManager.java:390)
    at eu.bcvsolutions.idm.core.scheduler.service.impl.DefaultSchedulerManager.createTrigger(DefaultSchedulerManager.java:342)
    at eu.bcvsolutions.idm.core.scheduler.service.impl.DefaultSchedulerManager.runTask(DefaultSchedulerManager.java:312)
    at eu.bcvsolutions.idm.core.scheduler.service.impl.DefaultSchedulerManager.runTask(DefaultSchedulerManager.java:302)
    at eu.bcvsolutions.idm.core.scheduler.event.processor.LongRunningTaskExecuteDependentProcessor.lambda$process$56(LongRunningTaskExecuteDependentProcessor.java:84)
    at java.util.ArrayList.forEach(ArrayList.java:1257)
    at eu.bcvsolutions.idm.core.scheduler.event.processor.LongRunningTaskExecuteDependentProcessor.process(LongRunningTaskExecuteDependentProcessor.java:80)
    at eu.bcvsolutions.idm.core.api.event.AbstractEntityEventProcessor.onApplicationEvent(AbstractEntityEventProcessor.java:192)
    at eu.bcvsolutions.idm.core.api.event.AbstractEntityEventProcessor.onApplicationEvent(AbstractEntityEventProcessor.java:35)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:166)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:138)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:381)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:348)
    at eu.bcvsolutions.idm.core.model.service.impl.DefaultEntityEventManager.publishEvent(DefaultEntityEventManager.java:120)
    at eu.bcvsolutions.idm.core.scheduler.api.service.AbstractLongRunningTaskExecutor.end(AbstractLongRunningTaskExecutor.java:215)
    at eu.bcvsolutions.idm.core.scheduler.api.service.AbstractLongRunningTaskExecutor.call(AbstractLongRunningTaskExecutor.java:173)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at org.springframework.security.concurrent.DelegatingSecurityContextRunnable.run(DelegatingSecurityContextRunnable.java:80)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: org.quartz.JobPersistenceException: Couldn't store trigger '4f8f136e7682-4053029e-66ec-4816-9995-d9aa346e28e6.0e10849a8360-1c24c1ae-67ec-4a57-a377-e9132baf6c61' for 'default.4f8f136e7682-4053029e-66ec-4816-9995-d9aa346e28e6' job:The job (default.4f8f136e7682-4053029e-66ec-4816-9995-d9aa346e28e6) referenced by the trigger does not exist. [See nested exception: org.quartz.JobPersistenceException: The job (default.4f8f136e7682-4053029e-66ec-4816-9995-d9aa346e28e6) referenced by the trigger does not exist.]
    at org.quartz.impl.jdbcjobstore.JobStoreSupport.storeTrigger(JobStoreSupport.java:1223)
    at org.quartz.impl.jdbcjobstore.JobStoreSupport$4.executeVoid(JobStoreSupport.java:1159)
    at org.quartz.impl.jdbcjobstore.JobStoreSupport$VoidTransactionCallback.execute(JobStoreSupport.java:3719)
    at org.quartz.impl.jdbcjobstore.JobStoreSupport$VoidTransactionCallback.execute(JobStoreSupport.java:3717)
    at org.quartz.impl.jdbcjobstore.JobStoreCMT.executeInLock(JobStoreCMT.java:245)
    at org.quartz.impl.jdbcjobstore.JobStoreSupport.storeTrigger(JobStoreSupport.java:1155)
    at org.quartz.core.QuartzScheduler.scheduleJob(QuartzScheduler.java:932)
    at org.quartz.impl.StdScheduler.scheduleJob(StdScheduler.java:258)
    at eu.bcvsolutions.idm.core.scheduler.service.impl.DefaultSchedulerManager.createTriggerInternal(DefaultSchedulerManager.java:380)
    ... 20 more
Caused by: org.quartz.JobPersistenceException: The job (default.4f8f136e7682-4053029e-66ec-4816-9995-d9aa346e28e6) referenced by the trigger does not exist.
    at org.quartz.impl.jdbcjobstore.JobStoreSupport.storeTrigger(JobStoreSupport.java:1208)
    ... 28 more

Actions #1

Updated by Alena Peterová almost 6 years ago

I tried to fix the inconsistent state by deleting the trigger from idm_dependent_task_trigger. Now the task ends correctly. Is there some other table which should be cleared?

Edit:
This select:
select * from qrtz_job_details where job_name in (select quartz_task_name from idm_scheduled_task)
returns 33 records. Shouldn't it be empty?

Actions #2

Updated by Radek Tomiška almost 6 years ago

qrtz_job_details table is not our table (quartz).

I think you found a correct place - idm_dependent_task_trigger.

Actions #3

Updated by Alena Peterová almost 6 years ago

Sorry, I copied the wrong SQL.

select * from idm_scheduled_task where quartz_task_name not in (select job_name from qrtz_job_details);
This returns 33 records.

The table idm_scheduled_task contains 65 records and only 32 of them are also in the quartz table. This is strange.

Actions #4

Updated by Radek Tomiška over 5 years ago

  • Status changed from New to In Progress
  • Target version set to Quartz (9.6.0)
Actions #5

Updated by Radek Tomiška over 5 years ago

  • Status changed from In Progress to Needs feedback
  • Assignee changed from Radek Tomiška to Vít Švanda
  • Priority changed from Low to Normal
  • % Done changed from 0 to 90

The referential integrity was missing when quartz task was deleted. It's fixed - dependent task trigger is deleted when initiator or dependent task is deleted. I've added chenge script to delete skeletons.

Commit:
https://github.com/bcvsolutions/CzechIdMng/commit/df30097d512b54e88cf1cc307f5bd9db8d71b7a9

Could you do a feedback, please?

Note: about records in idm_scheduled_task table - when quartz task is deleted, then record from qrtz_job_details is deleted only. Records in idm_scheduled_task table are related to standard idm_long_running_task (LRT) record => LRT was exetuted by this idm_scheduled_task. When quartz task is deleted, I can delete idm_scheduled_task and all long running tasks, which were exetuded by idm_scheduled_task (or set LRT's scheduled task to null), but i think it's better to know, why was LRT executed (~ by some scheduled task).

Actions #6

Updated by Vít Švanda over 5 years ago

  • Status changed from Needs feedback to Resolved
  • Assignee changed from Vít Švanda to Radek Tomiška
  • % Done changed from 90 to 100

I reviewed it and works correctly now. Thanks for that.

Actions #7

Updated by Radek Tomiška over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF