2017-11-28 4 views
0

Activiti 6.0.0 (스프링 부트 사용)은 비동기 프로세스를 보유하고 프로세스 시작 명령을 발행 할 때 즉시 시작하지 않습니다. (5 분 후에 변수로 프로세스에 전달 된 명령 및 법인)Activision 6은 비동기 프로세스 인스턴스를 시작하기 전에 5 분 기다리기도합니다.

ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processId, variableMap); 

를 발행하면이 오류없이 실행됩니다.

LOG :

15:17:01.158 DEBUG [http-nio-8080-exec-5] c.m.i.e.p.input.impl.ImportingPortImpl : Starting workflow process... [workflowName=batch-main] 
<5 MINUTE TEA BREAK> 
15:22:10.677 DEBUG [SimpleAsyncTaskExecutor-6] c.m.i.e.i.c.analizers.ContentAnalizers : Task really started.. 

이 즉시 시작됩니다 다른 경우에 사례의 약 30 %를, 어떻게, 그래서 이것은 매우 이상한 것입니다.

언제든지 즉시 실행되도록 5 분 타임 아웃을 기다리지 않고 문제를 해결하려면 어떻게해야합니까?

자세한 LOG :

16:53:14.136 DEBUG [http-nio-8080-exec-2] c.m.i.e.r.a.i.IntellivectorImportAdapter : Getting content stream from multipart [multipartIndex=0;fileName=IMPORTED-4e578b1a-e7f6-4b5a-91d0-9e9a40f3328e.tiff;contentType=image/tiff] 

16:53:14.137 DEBUG [http-nio-8080-exec-2] o.h.e.t.internal.TransactionImpl   : begin 
16:53:14.138 INFO [http-nio-8080-exec-2] jdbc.sqlonly        : select count(RES.ID_) from ACT_RE_PROCDEF RES WHERE RES.KEY_ = 'batch-main' 
16:53:14.142 INFO [http-nio-8080-exec-2] jdbc.sqlonly        : select nextval ('iv_batch_id_seq') 
16:53:14.144 INFO [http-nio-8080-exec-2] jdbc.sqlonly        : select nextval ('iv_document_id_seq') 
16:53:14.147 INFO [http-nio-8080-exec-2] jdbc.sqlonly        : insert into iv_batch (created_date, id) values ('11/28/2017 16:53:14.142', 1245) 
16:53:14.148 INFO [http-nio-8080-exec-2] jdbc.sqlonly        : insert into iv_document (batch_id, created_date, id) values (1245, '11/28/2017 16:53:14.144', 1272) 
16:53:14.150 INFO [http-nio-8080-exec-2] jdbc.sqlonly        : insert into iv_document_contents (mime_type, storage_id, document_id, phase) values ('image/tiff', 'c74d06ef-3c92-4c22-8238-7e45e80d53e3', 1272, 'IMPORTED') 
16:53:14.150 INFO [http-nio-8080-exec-2] jdbc.sqlonly        : update iv_document_contents set index_=0 where document_id=1272 and phase='IMPORTED' 

16:53:14.151 DEBUG [http-nio-8080-exec-2] c.m.i.e.p.input.impl.ImportingPortImpl : Imported a batch, starting workflow... [batchId=1245;documentCount=1;workflowName=batch-main] 
16:53:14.151 INFO [http-nio-8080-exec-2] jdbc.sqlonly        : select * from ACT_RE_PROCDEF where KEY_ = 'batch-main' and (TENANT_ID_ = '' or TENANT_ID_ is null) and VERSION_ = (select max(VERSION_) from ACT_RE_PROCDEF where KEY_ = 'batch-main' and (TENANT_ID_ = '' or TENANT_ID_ is null)) 
16:53:14.153 INFO [http-nio-8080-exec-2] jdbc.sqlonly        : insert into ACT_HI_VARINST (ID_, PROC_INST_ID_, EXECUTION_ID_, TASK_ID_, NAME_, REV_, VAR_TYPE_, BYTEARRAY_ID_, DOUBLE_, LONG_ , TEXT_, TEXT2_, CREATE_TIME_, LAST_UPDATED_TIME_) 
values ('5048', '5047', '5047', NULL, 'batchId', 0, 'long', NULL, NULL, 1245, '1245', NULL, '11/28/2017 16:53:14.153', '11/28/2017 16:53:14.153') 

16:53:14.154 INFO [http-nio-8080-exec-2] jdbc.sqlonly        : insert into ACT_HI_PROCINST (ID_, PROC_INST_ID_, BUSINESS_KEY_, PROC_DEF_ID_, START_TIME_, END_TIME_, DURATION_, START_USER_ID_, START_ACT_ID_, END_ACT_ID_, SUPER_PROCESS_INSTANCE_ID_, DELETE_REASON_, TENANT_ID_, NAME_) 
values ('5047', '5047', NULL, 'batch-main:3:5021', '11/28/2017 16:53:14.152', NULL, NULL, NULL, 'theStart', NULL, NULL, NULL, '', NULL) 
16:53:14.156 INFO [http-nio-8080-exec-2] jdbc.sqlonly        : insert into ACT_RU_EXECUTION (ID_, REV_, PROC_INST_ID_, BUSINESS_KEY_, PROC_DEF_ID_, ACT_ID_, IS_ACTIVE_, IS_CONCURRENT_, IS_SCOPE_,IS_EVENT_SCOPE_, IS_MI_ROOT_, PARENT_ID_, SUPER_EXEC_, ROOT_PROC_INST_ID_, SUSPENSION_STATE_, TENANT_ID_, NAME_, START_TIME_, START_USER_ID_, IS_COUNT_ENABLED_, EVT_SUBSCR_COUNT_, TASK_COUNT_, JOB_COUNT_, TIMER_JOB_COUNT_, SUSP_JOB_COUNT_, DEADLETTER_JOB_COUNT_, VAR_COUNT_, ID_LINK_COUNT_) 
values ('5047', 1, '5047', NULL, 'batch-main:3:5021', NULL, 1, 0, 1, 0, 0, NULL, NULL, '5047', 1, '', NULL, '11/28/2017 16:53:14.152', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0) , ('5049', 1, '5047', NULL, 'batch-main:3:5021', 'theStart', 1, 0, 0, 0, 0, '5047', NULL, '5047', 1, '', NULL, '11/28/2017 16:53:14.153', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0) 
16:53:14.157 INFO [http-nio-8080-exec-2] jdbc.sqlonly        : insert into ACT_RU_VARIABLE (ID_, REV_, TYPE_, NAME_, PROC_INST_ID_, EXECUTION_ID_, TASK_ID_, BYTEARRAY_ID_, DOUBLE_, LONG_ , TEXT_, TEXT2_) 
values ('5048', 1, 'long', 'batchId', '5047', '5047', NULL, NULL, NULL, 1245, '1245', NULL) 
16:53:14.159 INFO [http-nio-8080-exec-2] jdbc.sqlonly        : insert into ACT_RU_JOB (ID_, REV_, TYPE_, LOCK_OWNER_, LOCK_EXP_TIME_, EXCLUSIVE_, EXECUTION_ID_, PROCESS_INSTANCE_ID_, PROC_DEF_ID_, RETRIES_, EXCEPTION_STACK_ID_, EXCEPTION_MSG_, DUEDATE_, REPEAT_, HANDLER_TYPE_, HANDLER_CFG_, TENANT_ID_) 
values ('5050', 1, 'message', 'e53309f8-8780-4849-be82-c9acfbffa338', '11/28/2017 16:58:14.153', 1, '5049', '5047', 'batch-main:3:5021', 3, NULL, NULL, NULL, NULL, 'async-continuation', NULL, '') 

    16:53:14.160 DEBUG [http-nio-8080-exec-2] o.h.e.t.internal.TransactionImpl   : begin 
    16:53:14.160 DEBUG [http-nio-8080-exec-2] o.h.e.t.internal.TransactionImpl   : committing 
16:53:14.160 DEBUG [http-nio-8080-exec-2] o.h.e.t.internal.TransactionImpl   : committing 


16:53:14.161 DEBUG [SimpleAsyncTaskExecutor-2] o.h.e.t.internal.TransactionImpl   : begin 
16:53:14.161 INFO [SimpleAsyncTaskExecutor-2] jdbc.sqlonly        : select * from ACT_RU_EXECUTION where ID_ = '5049' 

16:53:14.161 DEBUG [SimpleAsyncTaskExecutor-2] o.h.e.t.internal.TransactionImpl   : committing 
16:53:14.162 DEBUG [SimpleAsyncTaskExecutor-2] o.h.e.t.internal.TransactionImpl   : begin 
16:53:14.162 INFO [SimpleAsyncTaskExecutor-2] jdbc.sqlonly        : select * from ACT_RU_JOB where ID_ = '5050' 

16:53:14.163 DEBUG [SimpleAsyncTaskExecutor-2] o.h.e.t.internal.TransactionImpl   : committing 
16:53:14.163 DEBUG [SimpleAsyncTaskExecutor-2] o.h.e.t.internal.TransactionImpl   : begin 
16:53:14.163 INFO [SimpleAsyncTaskExecutor-2] jdbc.sqlonly        : select * from ACT_RU_EXECUTION where ID_ = '5047' 

16:53:14.164 DEBUG [SimpleAsyncTaskExecutor-2] o.h.e.t.internal.TransactionImpl   : committing 
16:53:22.492 DEBUG [activiti-acquire-async-jobs] o.h.e.t.internal.TransactionImpl   : begin 
16:53:22.493 INFO [activiti-acquire-async-jobs] jdbc.sqlonly        : select RES.* from ACT_RU_JOB RES where LOCK_EXP_TIME_ is null LIMIT 1 OFFSET 0 

16:53:22.493 DEBUG [activiti-acquire-timer-jobs] o.h.e.t.internal.TransactionImpl   : begin 
16:53:22.493 DEBUG [activiti-acquire-async-jobs] o.h.e.t.internal.TransactionImpl   : committing 
16:53:22.493 INFO [activiti-acquire-timer-jobs] jdbc.sqlonly        : select RES.* from ACT_RU_TIMER_JOB RES where DUEDATE_ <= '11/28/2017 16:53:22.493' and LOCK_OWNER_ is null LIMIT 1 OFFSET 0 

16:53:22.495 DEBUG [activiti-acquire-timer-jobs] o.h.e.t.internal.TransactionImpl   : committing 
16:53:22.495 DEBUG [activiti-acquire-timer-jobs] o.h.e.t.internal.TransactionImpl   : begin 
16:53:22.495 DEBUG [activiti-acquire-timer-jobs] o.h.e.t.internal.TransactionImpl   : committing 

<NOT STARTED.... > 

프레스코 스레드 : Async Job Executor only executes job after lock expiration

+0

저는 Activiti에 익숙하지 않습니다. 그러나 Activiti의 메인 스레드는 5 분마다 (아마도 @ Scheduled를 사용하는) 일반적으로 사용되는 패턴을 사용하여 실행을 필요로하는지 확인합니다. 작업 즉시. 또는 현재 실행중인 다른 작업이 병렬 처리가 아닌 순차적으로 실행되도록 구성되어 있기 때문에 작업을 시작하기 전에 완료 될 때까지 기다리는 중일 수 있습니다. – Bohemian

+0

아니요, 다른 작업은 없으며 다른 경우에는 즉시 실행됩니다. 0-5 분의 임의 시간 초과가 아닌 즉시 실행됩니다. 저에게는 타임 아웃이 작업 타임 아웃 인 것으로 보입니다. 장시간 실행되는 작업은 망가 졌다고 가정하고 다시 실행하려고하므로, Activiti는 작업이 실행 중이라고 생각하고 5 분 후에 다시 시도합니다. –

+0

process xml 스키마를 게시 할 수 있습니까? 그리고 프로세스를 시작한 후 정말로 즉시 시작하지 않았 음을 알 수 있습니까? 'Log.info ("프로세스 인스턴스의 수 :"+ runtimeService.createProcessInstanceQuery(). count()); ' – CrazySabbath

답변

-1

이것은 예상 된 동작입니다. 비동기가 태스크에 대해 점검되면 태스크가 다른 스레드와 독립적으로 실행될 수 있음을 의미합니다. Activiti는 내부적으로 우선 순위가 더 높은 스레드가 먼저 실행되도록합니다. 따라서 비동기 작업의 실행이 지연됩니다.

+0

나는 그렇게 생각하지 않는다. 이것이 정상적인 경우 낮은 지연이 중요한 시스템에는 유용하지 않습니다. 그리고 제가 썼을 때, 다른 모든 경우에는 달리기가 즉각적입니다. 낮은 지연 시스템을위한 –

+0

당신은 항상 작업의 우선 순위를 설정할 수 있습니다 :). 기본적으로 모든 작업의 ​​우선 순위는 50입니다. –

+0

다른 작업이 전혀 없을 때는 어떤 종류의 우선 순위가 적용됩니까? 나는 이것이 잘못된 접근이라고 생각하고, 문제가 존재하며, 야외는 이미 그 문제에 대한 스레드를 가지고있다. –

0

열린 거래가 ExecuteAsyncJobCmd와 조합되어있는 것으로 의심되어이 문제가 발생합니다. 명령의 코드베이스에서 :

// We need to refetch the job, as it could have been deleted by another concurrent job 
// For exampel: an embedded subprocess with a couple of async tasks and a timer on the boundary of the subprocess 
// when the timer fires, all executions and thus also the jobs inside of the embedded subprocess are destroyed. 
// However, the async task jobs could already have been fetched and put in the queue.... while in reality they have been deleted. 
// A refetch is thus needed here to be sure that it exists for this transaction. 

Job job = commandContext.getJobEntityManager().findById(jobId); 
if (job == null) { 
    log.debug("Job does not exist anymore and will not be executed. It has most likely been deleted " 
     + "as part of another concurrent part of the process instance."); 
    return null; 
} 

이것은 Activiti 봄 부팅 스타터에서 제공하는 기본 프로세스 엔진 구성을 사용하여, 인 메모리 DB 및 비동기 작업으로 테스트하는 동안 우리가 경험하고 정확한 동작입니다.

관련 문제