status
stringclasses
1 value
repo_name
stringclasses
31 values
repo_url
stringclasses
31 values
issue_id
int64
1
104k
title
stringlengths
4
233
body
stringlengths
0
186k
issue_url
stringlengths
38
56
pull_url
stringlengths
37
54
before_fix_sha
stringlengths
40
40
after_fix_sha
stringlengths
40
40
report_datetime
timestamp[us, tz=UTC]
language
stringclasses
5 values
commit_datetime
timestamp[us, tz=UTC]
updated_file
stringlengths
7
188
chunk_content
stringlengths
1
1.03M
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,243
[Bug] [Alert] Some types of alarms can't display project name
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened In some types of alarm contents, the project names cannot be displayed correctly ### What you expected to happen The project name can be displayed normally ### How to reproduce For example, timeout alarm ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9243
https://github.com/apache/dolphinscheduler/pull/9244
03a0c9f54429956cd399de0829aa70c11b67934d
85e56b5e2a083a904bbee4debd459dd8313b84e6
2022-03-28T12:06:05Z
java
2022-03-28T12:45:01Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/alert/ProcessAlertManager.java
} /** * getTaskAlterContent * @param taskInstance TaskInstance * @return String String */ public String getTaskAlterContent(TaskInstance taskInstance) { TaskAlertContent content = TaskAlertContent.newBuilder() .processInstanceName(taskInstance.getProcessInstanceName()) .processInstanceId(taskInstance.getProcessInstanceId()) .taskInstanceId(taskInstance.getId()) .taskName(taskInstance.getName()) .taskType(taskInstance.getTaskType()) .state(taskInstance.getState()) .startTime(taskInstance.getStartTime()) .endTime(taskInstance.getEndTime()) .host(taskInstance.getHost()) .logPath(taskInstance.getLogPath()) .build(); return JSONUtils.toJsonString(content); } public void sendTaskTimeoutAlert(ProcessInstance processInstance, TaskInstance taskInstance, TaskDefinition taskDefinition) { alertDao.sendTaskTimeoutAlert(processInstance, taskInstance, taskDefinition); } /** * * check node type and process blocking flag, then insert a block record into db * * @param processInstance process instance * @param projectUser the project owner
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,243
[Bug] [Alert] Some types of alarms can't display project name
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened In some types of alarm contents, the project names cannot be displayed correctly ### What you expected to happen The project name can be displayed normally ### How to reproduce For example, timeout alarm ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9243
https://github.com/apache/dolphinscheduler/pull/9244
03a0c9f54429956cd399de0829aa70c11b67934d
85e56b5e2a083a904bbee4debd459dd8313b84e6
2022-03-28T12:06:05Z
java
2022-03-28T12:45:01Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/alert/ProcessAlertManager.java
*/ public void sendProcessBlockingAlert(ProcessInstance processInstance, ProjectUser projectUser) { Alert alert = new Alert(); String cmdName = getCommandCnName(processInstance.getCommandType()); List<ProcessAlertContent> blockingNodeList = new ArrayList<>(1); ProcessAlertContent processAlertContent = ProcessAlertContent.newBuilder() .projectId(projectUser.getProjectId()) .projectName(projectUser.getProjectName()) .owner(projectUser.getUserName()) .processId(processInstance.getId()) .processName(processInstance.getName()) .processType(processInstance.getCommandType()) .processState(processInstance.getState()) .runTimes(processInstance.getRunTimes()) .processStartTime(processInstance.getStartTime()) .processEndTime(processInstance.getEndTime()) .processHost(processInstance.getHost()) .build(); blockingNodeList.add(processAlertContent); String content = JSONUtils.toJsonString(blockingNodeList); alert.setTitle(cmdName + " Blocked"); alert.setContent(content); alert.setAlertGroupId(processInstance.getWarningGroupId()); alert.setCreateTime(new Date()); alertDao.addAlert(alert); logger.info("add alert to db, alert: {}",alert); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,222
[Bug] [master] A node starts multiple master-server, the slot is same value
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened A node starts multiple master-server, the slot is same value. In the method of `refreshMasterList`, the key is `host`, not `host:port`, so, when master have same host, the slot is same also. ![image](https://user-images.githubusercontent.com/29919212/160278700-aca5ae6e-0865-4832-a607-8dc85827a80a.png) ### What you expected to happen I think It is very possible to deploy multiple master-server on a node, I hope the multiple masters have the correct slot value. ### How to reproduce Deploy multiple master-server with different ports in a node. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9222
https://github.com/apache/dolphinscheduler/pull/9240
860771f922fd3201f76abca20db9ac09dc9eafd9
e2c1cc057918c8c70fd468d21e9ed727547ddc56
2022-03-27T11:17:38Z
java
2022-03-29T14:46:02Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.server.master.registry; import static org.apache.dolphinscheduler.common.Constants.REGISTRY_DOLPHINSCHEDULER_MASTERS; import static org.apache.dolphinscheduler.common.Constants.REGISTRY_DOLPHINSCHEDULER_WORKERS; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.NodeType; import org.apache.dolphinscheduler.common.model.Server; import org.apache.dolphinscheduler.common.utils.NetUtils; import org.apache.dolphinscheduler.dao.AlertDao; import org.apache.dolphinscheduler.dao.entity.WorkerGroup; import org.apache.dolphinscheduler.dao.mapper.WorkerGroupMapper; import org.apache.dolphinscheduler.registry.api.Event;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,222
[Bug] [master] A node starts multiple master-server, the slot is same value
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened A node starts multiple master-server, the slot is same value. In the method of `refreshMasterList`, the key is `host`, not `host:port`, so, when master have same host, the slot is same also. ![image](https://user-images.githubusercontent.com/29919212/160278700-aca5ae6e-0865-4832-a607-8dc85827a80a.png) ### What you expected to happen I think It is very possible to deploy multiple master-server on a node, I hope the multiple masters have the correct slot value. ### How to reproduce Deploy multiple master-server with different ports in a node. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9222
https://github.com/apache/dolphinscheduler/pull/9240
860771f922fd3201f76abca20db9ac09dc9eafd9
e2c1cc057918c8c70fd468d21e9ed727547ddc56
2022-03-27T11:17:38Z
java
2022-03-29T14:46:02Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
import org.apache.dolphinscheduler.registry.api.Event.Type; import org.apache.dolphinscheduler.registry.api.SubscribeListener; import org.apache.dolphinscheduler.remote.utils.NamedThreadFactory; import org.apache.dolphinscheduler.service.queue.MasterPriorityQueue; import org.apache.dolphinscheduler.service.registry.RegistryClient; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringUtils; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import javax.annotation.PreDestroy; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; /** * server node manager */ @Service
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,222
[Bug] [master] A node starts multiple master-server, the slot is same value
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened A node starts multiple master-server, the slot is same value. In the method of `refreshMasterList`, the key is `host`, not `host:port`, so, when master have same host, the slot is same also. ![image](https://user-images.githubusercontent.com/29919212/160278700-aca5ae6e-0865-4832-a607-8dc85827a80a.png) ### What you expected to happen I think It is very possible to deploy multiple master-server on a node, I hope the multiple masters have the correct slot value. ### How to reproduce Deploy multiple master-server with different ports in a node. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9222
https://github.com/apache/dolphinscheduler/pull/9240
860771f922fd3201f76abca20db9ac09dc9eafd9
e2c1cc057918c8c70fd468d21e9ed727547ddc56
2022-03-27T11:17:38Z
java
2022-03-29T14:46:02Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
public class ServerNodeManager implements InitializingBean { private final Logger logger = LoggerFactory.getLogger(ServerNodeManager.class); /** * master lock */ private final Lock masterLock = new ReentrantLock(); /** * worker group lock */ private final Lock workerGroupLock = new ReentrantLock();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,222
[Bug] [master] A node starts multiple master-server, the slot is same value
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened A node starts multiple master-server, the slot is same value. In the method of `refreshMasterList`, the key is `host`, not `host:port`, so, when master have same host, the slot is same also. ![image](https://user-images.githubusercontent.com/29919212/160278700-aca5ae6e-0865-4832-a607-8dc85827a80a.png) ### What you expected to happen I think It is very possible to deploy multiple master-server on a node, I hope the multiple masters have the correct slot value. ### How to reproduce Deploy multiple master-server with different ports in a node. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9222
https://github.com/apache/dolphinscheduler/pull/9240
860771f922fd3201f76abca20db9ac09dc9eafd9
e2c1cc057918c8c70fd468d21e9ed727547ddc56
2022-03-27T11:17:38Z
java
2022-03-29T14:46:02Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
/** * worker node info lock */ private final Lock workerNodeInfoLock = new ReentrantLock(); /** * worker group nodes */ private final ConcurrentHashMap<String, Set<String>> workerGroupNodes = new ConcurrentHashMap<>(); /** * master nodes */ private final Set<String> masterNodes = new HashSet<>(); /** * worker node info */ private final Map<String, String> workerNodeInfo = new HashMap<>(); /** * executor service */ private ScheduledExecutorService executorService; @Autowired private RegistryClient registryClient; /** * eg : /node/worker/group/127.0.0.1:xxx */ private static final int WORKER_LISTENER_CHECK_LENGTH = 5; /** * worker group mapper */ @Autowired
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,222
[Bug] [master] A node starts multiple master-server, the slot is same value
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened A node starts multiple master-server, the slot is same value. In the method of `refreshMasterList`, the key is `host`, not `host:port`, so, when master have same host, the slot is same also. ![image](https://user-images.githubusercontent.com/29919212/160278700-aca5ae6e-0865-4832-a607-8dc85827a80a.png) ### What you expected to happen I think It is very possible to deploy multiple master-server on a node, I hope the multiple masters have the correct slot value. ### How to reproduce Deploy multiple master-server with different ports in a node. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9222
https://github.com/apache/dolphinscheduler/pull/9240
860771f922fd3201f76abca20db9ac09dc9eafd9
e2c1cc057918c8c70fd468d21e9ed727547ddc56
2022-03-27T11:17:38Z
java
2022-03-29T14:46:02Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
private WorkerGroupMapper workerGroupMapper; private final MasterPriorityQueue masterPriorityQueue = new MasterPriorityQueue(); /** * alert dao */ @Autowired private AlertDao alertDao; private static volatile int MASTER_SLOT = 0; private static volatile int MASTER_SIZE = 0; public static int getSlot() { return MASTER_SLOT; } public static int getMasterSize() { return MASTER_SIZE; } /** * init listener * * @throws Exception if error throws Exception */ @Override public void afterPropertiesSet() throws Exception { /** * load nodes from zookeeper */ load(); /** * init executor service */ executorService = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("ServerNodeManagerExecutor"));
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,222
[Bug] [master] A node starts multiple master-server, the slot is same value
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened A node starts multiple master-server, the slot is same value. In the method of `refreshMasterList`, the key is `host`, not `host:port`, so, when master have same host, the slot is same also. ![image](https://user-images.githubusercontent.com/29919212/160278700-aca5ae6e-0865-4832-a607-8dc85827a80a.png) ### What you expected to happen I think It is very possible to deploy multiple master-server on a node, I hope the multiple masters have the correct slot value. ### How to reproduce Deploy multiple master-server with different ports in a node. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9222
https://github.com/apache/dolphinscheduler/pull/9240
860771f922fd3201f76abca20db9ac09dc9eafd9
e2c1cc057918c8c70fd468d21e9ed727547ddc56
2022-03-27T11:17:38Z
java
2022-03-29T14:46:02Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
executorService.scheduleWithFixedDelay(new WorkerNodeInfoAndGroupDbSyncTask(), 0, 10, TimeUnit.SECONDS); /* * init MasterNodeListener listener */ registryClient.subscribe(REGISTRY_DOLPHINSCHEDULER_MASTERS, new MasterDataListener()); /* * init WorkerNodeListener listener */ registryClient.subscribe(REGISTRY_DOLPHINSCHEDULER_WORKERS, new WorkerDataListener()); } /** * load nodes from zookeeper */ public void load() { /* * master nodes from zookeeper */ updateMasterNodes(); /* * worker group nodes from zookeeper */ Collection<String> workerGroups = registryClient.getWorkerGroupDirectly(); for (String workerGroup : workerGroups) { syncWorkerGroupNodes(workerGroup, registryClient.getWorkerGroupNodesDirectly(workerGroup)); } } /** * worker node info and worker group db sync task */ class WorkerNodeInfoAndGroupDbSyncTask implements Runnable {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,222
[Bug] [master] A node starts multiple master-server, the slot is same value
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened A node starts multiple master-server, the slot is same value. In the method of `refreshMasterList`, the key is `host`, not `host:port`, so, when master have same host, the slot is same also. ![image](https://user-images.githubusercontent.com/29919212/160278700-aca5ae6e-0865-4832-a607-8dc85827a80a.png) ### What you expected to happen I think It is very possible to deploy multiple master-server on a node, I hope the multiple masters have the correct slot value. ### How to reproduce Deploy multiple master-server with different ports in a node. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9222
https://github.com/apache/dolphinscheduler/pull/9240
860771f922fd3201f76abca20db9ac09dc9eafd9
e2c1cc057918c8c70fd468d21e9ed727547ddc56
2022-03-27T11:17:38Z
java
2022-03-29T14:46:02Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
@Override public void run() { try { Map<String, String> newWorkerNodeInfo = registryClient.getServerMaps(NodeType.WORKER, true); syncAllWorkerNodeInfo(newWorkerNodeInfo); List<WorkerGroup> workerGroupList = workerGroupMapper.queryAllWorkerGroup(); if (CollectionUtils.isNotEmpty(workerGroupList)) { for (WorkerGroup wg : workerGroupList) { String workerGroup = wg.getName(); Set<String> nodes = new HashSet<>(); String[] addrs = wg.getAddrList().split(Constants.COMMA); for (String addr : addrs) { if (newWorkerNodeInfo.containsKey(addr)) { nodes.add(addr); } } if (!nodes.isEmpty()) { syncWorkerGroupNodes(workerGroup, nodes); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,222
[Bug] [master] A node starts multiple master-server, the slot is same value
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened A node starts multiple master-server, the slot is same value. In the method of `refreshMasterList`, the key is `host`, not `host:port`, so, when master have same host, the slot is same also. ![image](https://user-images.githubusercontent.com/29919212/160278700-aca5ae6e-0865-4832-a607-8dc85827a80a.png) ### What you expected to happen I think It is very possible to deploy multiple master-server on a node, I hope the multiple masters have the correct slot value. ### How to reproduce Deploy multiple master-server with different ports in a node. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9222
https://github.com/apache/dolphinscheduler/pull/9240
860771f922fd3201f76abca20db9ac09dc9eafd9
e2c1cc057918c8c70fd468d21e9ed727547ddc56
2022-03-27T11:17:38Z
java
2022-03-29T14:46:02Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
} } catch (Exception e) { logger.error("WorkerNodeInfoAndGroupDbSyncTask error:", e); } } } /** * worker group node listener */ class WorkerDataListener implements SubscribeListener { @Override public void notify(Event event) { final String path = event.path(); final Type type = event.type(); final String data = event.data(); if (registryClient.isWorkerPath(path)) { try { if (type == Type.ADD) { logger.info("worker group node : {} added.", path); String group = parseGroup(path); Collection<String> currentNodes = registryClient.getWorkerGroupNodesDirectly(group); logger.info("currentNodes : {}", currentNodes); syncWorkerGroupNodes(group, currentNodes); } else if (type == Type.REMOVE) { logger.info("worker group node : {} down.", path); String group = parseGroup(path); Collection<String> currentNodes = registryClient.getWorkerGroupNodesDirectly(group); syncWorkerGroupNodes(group, currentNodes); alertDao.sendServerStopedAlert(1, path, "WORKER"); } else if (type == Type.UPDATE) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,222
[Bug] [master] A node starts multiple master-server, the slot is same value
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened A node starts multiple master-server, the slot is same value. In the method of `refreshMasterList`, the key is `host`, not `host:port`, so, when master have same host, the slot is same also. ![image](https://user-images.githubusercontent.com/29919212/160278700-aca5ae6e-0865-4832-a607-8dc85827a80a.png) ### What you expected to happen I think It is very possible to deploy multiple master-server on a node, I hope the multiple masters have the correct slot value. ### How to reproduce Deploy multiple master-server with different ports in a node. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9222
https://github.com/apache/dolphinscheduler/pull/9240
860771f922fd3201f76abca20db9ac09dc9eafd9
e2c1cc057918c8c70fd468d21e9ed727547ddc56
2022-03-27T11:17:38Z
java
2022-03-29T14:46:02Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
logger.debug("worker group node : {} update, data: {}", path, data); String group = parseGroup(path); Collection<String> currentNodes = registryClient.getWorkerGroupNodesDirectly(group); syncWorkerGroupNodes(group, currentNodes); String node = parseNode(path); syncSingleWorkerNodeInfo(node, data); } } catch (IllegalArgumentException ex) { logger.warn(ex.getMessage()); } catch (Exception ex) { logger.error("WorkerGroupListener capture data change and get data failed", ex); } } } private String parseGroup(String path) { String[] parts = path.split("/"); if (parts.length < WORKER_LISTENER_CHECK_LENGTH) { throw new IllegalArgumentException(String.format("worker group path : %s is not valid, ignore", path)); } return parts[parts.length - 2]; } private String parseNode(String path) { String[] parts = path.split("/"); if (parts.length < WORKER_LISTENER_CHECK_LENGTH) { throw new IllegalArgumentException(String.format("worker group path : %s is not valid, ignore", path)); } return parts[parts.length - 1]; } } class MasterDataListener implements SubscribeListener {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,222
[Bug] [master] A node starts multiple master-server, the slot is same value
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened A node starts multiple master-server, the slot is same value. In the method of `refreshMasterList`, the key is `host`, not `host:port`, so, when master have same host, the slot is same also. ![image](https://user-images.githubusercontent.com/29919212/160278700-aca5ae6e-0865-4832-a607-8dc85827a80a.png) ### What you expected to happen I think It is very possible to deploy multiple master-server on a node, I hope the multiple masters have the correct slot value. ### How to reproduce Deploy multiple master-server with different ports in a node. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9222
https://github.com/apache/dolphinscheduler/pull/9240
860771f922fd3201f76abca20db9ac09dc9eafd9
e2c1cc057918c8c70fd468d21e9ed727547ddc56
2022-03-27T11:17:38Z
java
2022-03-29T14:46:02Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
@Override public void notify(Event event) { final String path = event.path(); final Type type = event.type(); if (registryClient.isMasterPath(path)) { try { if (type.equals(Type.ADD)) { logger.info("master node : {} added.", path); updateMasterNodes(); } if (type.equals(Type.REMOVE)) { logger.info("master node : {} down.", path); updateMasterNodes(); alertDao.sendServerStopedAlert(1, path, "MASTER"); } } catch (Exception ex) { logger.error("MasterNodeListener capture data change and get data failed.", ex); } } } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,222
[Bug] [master] A node starts multiple master-server, the slot is same value
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened A node starts multiple master-server, the slot is same value. In the method of `refreshMasterList`, the key is `host`, not `host:port`, so, when master have same host, the slot is same also. ![image](https://user-images.githubusercontent.com/29919212/160278700-aca5ae6e-0865-4832-a607-8dc85827a80a.png) ### What you expected to happen I think It is very possible to deploy multiple master-server on a node, I hope the multiple masters have the correct slot value. ### How to reproduce Deploy multiple master-server with different ports in a node. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9222
https://github.com/apache/dolphinscheduler/pull/9240
860771f922fd3201f76abca20db9ac09dc9eafd9
e2c1cc057918c8c70fd468d21e9ed727547ddc56
2022-03-27T11:17:38Z
java
2022-03-29T14:46:02Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
private void updateMasterNodes() { MASTER_SLOT = 0; MASTER_SIZE = 0; this.masterNodes.clear(); String nodeLock = Constants.REGISTRY_DOLPHINSCHEDULER_LOCK_MASTERS; try { registryClient.getLock(nodeLock); Collection<String> currentNodes = registryClient.getMasterNodesDirectly(); List<Server> masterNodes = registryClient.getServerList(NodeType.MASTER); syncMasterNodes(currentNodes, masterNodes); } catch (Exception e) { logger.error("update master nodes error", e); } finally { registryClient.releaseLock(nodeLock); } } /** * get master nodes * * @return master nodes */ public Set<String> getMasterNodes() { masterLock.lock(); try { return Collections.unmodifiableSet(masterNodes); } finally { masterLock.unlock(); } } /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,222
[Bug] [master] A node starts multiple master-server, the slot is same value
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened A node starts multiple master-server, the slot is same value. In the method of `refreshMasterList`, the key is `host`, not `host:port`, so, when master have same host, the slot is same also. ![image](https://user-images.githubusercontent.com/29919212/160278700-aca5ae6e-0865-4832-a607-8dc85827a80a.png) ### What you expected to happen I think It is very possible to deploy multiple master-server on a node, I hope the multiple masters have the correct slot value. ### How to reproduce Deploy multiple master-server with different ports in a node. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9222
https://github.com/apache/dolphinscheduler/pull/9240
860771f922fd3201f76abca20db9ac09dc9eafd9
e2c1cc057918c8c70fd468d21e9ed727547ddc56
2022-03-27T11:17:38Z
java
2022-03-29T14:46:02Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
* sync master nodes * * @param nodes master nodes */ private void syncMasterNodes(Collection<String> nodes, List<Server> masterNodes) { masterLock.lock(); try { String host = NetUtils.getHost(); this.masterNodes.addAll(nodes); this.masterPriorityQueue.clear(); this.masterPriorityQueue.putList(masterNodes); int index = masterPriorityQueue.getIndex(host); if (index >= 0) { MASTER_SIZE = nodes.size(); MASTER_SLOT = index; } else { logger.warn("current host:{} is not in active master list", host); } logger.info("update master nodes, master size: {}, slot: {}", MASTER_SIZE, MASTER_SLOT); } finally { masterLock.unlock(); } } /** * sync worker group nodes * * @param workerGroup worker group * @param nodes worker nodes */ private void syncWorkerGroupNodes(String workerGroup, Collection<String> nodes) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,222
[Bug] [master] A node starts multiple master-server, the slot is same value
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened A node starts multiple master-server, the slot is same value. In the method of `refreshMasterList`, the key is `host`, not `host:port`, so, when master have same host, the slot is same also. ![image](https://user-images.githubusercontent.com/29919212/160278700-aca5ae6e-0865-4832-a607-8dc85827a80a.png) ### What you expected to happen I think It is very possible to deploy multiple master-server on a node, I hope the multiple masters have the correct slot value. ### How to reproduce Deploy multiple master-server with different ports in a node. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9222
https://github.com/apache/dolphinscheduler/pull/9240
860771f922fd3201f76abca20db9ac09dc9eafd9
e2c1cc057918c8c70fd468d21e9ed727547ddc56
2022-03-27T11:17:38Z
java
2022-03-29T14:46:02Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
workerGroupLock.lock(); try { Set<String> workerNodes = workerGroupNodes.getOrDefault(workerGroup, new HashSet<>()); workerNodes.clear(); workerNodes.addAll(nodes); workerGroupNodes.put(workerGroup, workerNodes); } finally { workerGroupLock.unlock(); } } public Map<String, Set<String>> getWorkerGroupNodes() { return Collections.unmodifiableMap(workerGroupNodes); } /** * get worker group nodes * * @param workerGroup workerGroup * @return worker nodes */ public Set<String> getWorkerGroupNodes(String workerGroup) { workerGroupLock.lock(); try { if (StringUtils.isEmpty(workerGroup)) { workerGroup = Constants.DEFAULT_WORKER_GROUP; } Set<String> nodes = workerGroupNodes.get(workerGroup); if (CollectionUtils.isNotEmpty(nodes)) { return Collections.unmodifiableSet(nodes); } return nodes;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,222
[Bug] [master] A node starts multiple master-server, the slot is same value
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened A node starts multiple master-server, the slot is same value. In the method of `refreshMasterList`, the key is `host`, not `host:port`, so, when master have same host, the slot is same also. ![image](https://user-images.githubusercontent.com/29919212/160278700-aca5ae6e-0865-4832-a607-8dc85827a80a.png) ### What you expected to happen I think It is very possible to deploy multiple master-server on a node, I hope the multiple masters have the correct slot value. ### How to reproduce Deploy multiple master-server with different ports in a node. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9222
https://github.com/apache/dolphinscheduler/pull/9240
860771f922fd3201f76abca20db9ac09dc9eafd9
e2c1cc057918c8c70fd468d21e9ed727547ddc56
2022-03-27T11:17:38Z
java
2022-03-29T14:46:02Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
} finally { workerGroupLock.unlock(); } } /** * get worker node info * * @return worker node info */ public Map<String, String> getWorkerNodeInfo() { return Collections.unmodifiableMap(workerNodeInfo); } /** * get worker node info * * @param workerNode worker node * @return worker node info */ public String getWorkerNodeInfo(String workerNode) { workerNodeInfoLock.lock(); try { return workerNodeInfo.getOrDefault(workerNode, null); } finally { workerNodeInfoLock.unlock(); } } /** * sync worker node info * * @param newWorkerNodeInfo new worker node info
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,222
[Bug] [master] A node starts multiple master-server, the slot is same value
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened A node starts multiple master-server, the slot is same value. In the method of `refreshMasterList`, the key is `host`, not `host:port`, so, when master have same host, the slot is same also. ![image](https://user-images.githubusercontent.com/29919212/160278700-aca5ae6e-0865-4832-a607-8dc85827a80a.png) ### What you expected to happen I think It is very possible to deploy multiple master-server on a node, I hope the multiple masters have the correct slot value. ### How to reproduce Deploy multiple master-server with different ports in a node. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9222
https://github.com/apache/dolphinscheduler/pull/9240
860771f922fd3201f76abca20db9ac09dc9eafd9
e2c1cc057918c8c70fd468d21e9ed727547ddc56
2022-03-27T11:17:38Z
java
2022-03-29T14:46:02Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
*/ private void syncAllWorkerNodeInfo(Map<String, String> newWorkerNodeInfo) { workerNodeInfoLock.lock(); try { workerNodeInfo.clear(); workerNodeInfo.putAll(newWorkerNodeInfo); } finally { workerNodeInfoLock.unlock(); } } /** * sync single worker node info */ private void syncSingleWorkerNodeInfo(String node, String info) { workerNodeInfoLock.lock(); try { workerNodeInfo.put(node, info); } finally { workerNodeInfoLock.unlock(); } } /** * destroy */ @PreDestroy public void destroy() { executorService.shutdownNow(); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,222
[Bug] [master] A node starts multiple master-server, the slot is same value
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened A node starts multiple master-server, the slot is same value. In the method of `refreshMasterList`, the key is `host`, not `host:port`, so, when master have same host, the slot is same also. ![image](https://user-images.githubusercontent.com/29919212/160278700-aca5ae6e-0865-4832-a607-8dc85827a80a.png) ### What you expected to happen I think It is very possible to deploy multiple master-server on a node, I hope the multiple masters have the correct slot value. ### How to reproduce Deploy multiple master-server with different ports in a node. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9222
https://github.com/apache/dolphinscheduler/pull/9240
860771f922fd3201f76abca20db9ac09dc9eafd9
e2c1cc057918c8c70fd468d21e9ed727547ddc56
2022-03-27T11:17:38Z
java
2022-03-29T14:46:02Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/queue/MasterPriorityQueue.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.service.queue; import org.apache.dolphinscheduler.common.model.Server; import java.util.Comparator; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.concurrent.PriorityBlockingQueue; import java.util.concurrent.TimeUnit; public class MasterPriorityQueue implements TaskPriorityQueue<Server> {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,222
[Bug] [master] A node starts multiple master-server, the slot is same value
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened A node starts multiple master-server, the slot is same value. In the method of `refreshMasterList`, the key is `host`, not `host:port`, so, when master have same host, the slot is same also. ![image](https://user-images.githubusercontent.com/29919212/160278700-aca5ae6e-0865-4832-a607-8dc85827a80a.png) ### What you expected to happen I think It is very possible to deploy multiple master-server on a node, I hope the multiple masters have the correct slot value. ### How to reproduce Deploy multiple master-server with different ports in a node. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9222
https://github.com/apache/dolphinscheduler/pull/9240
860771f922fd3201f76abca20db9ac09dc9eafd9
e2c1cc057918c8c70fd468d21e9ed727547ddc56
2022-03-27T11:17:38Z
java
2022-03-29T14:46:02Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/queue/MasterPriorityQueue.java
/** * queue size */ private static final Integer QUEUE_MAX_SIZE = 20; /** * queue */ private PriorityBlockingQueue<Server> queue = new PriorityBlockingQueue<>(QUEUE_MAX_SIZE, new ServerComparator()); private HashMap<String, Integer> hostIndexMap = new HashMap<>(); @Override public void put(Server serverInfo) { this.queue.put(serverInfo); refreshMasterList(); } @Override public Server take() throws InterruptedException { return queue.take(); } @Override public Server poll(long timeout, TimeUnit unit) { return queue.poll(); } @Override public int size() { return queue.size(); } public void putList(List<Server> serverList) { for (Server server : serverList) { this.queue.put(server);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,222
[Bug] [master] A node starts multiple master-server, the slot is same value
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened A node starts multiple master-server, the slot is same value. In the method of `refreshMasterList`, the key is `host`, not `host:port`, so, when master have same host, the slot is same also. ![image](https://user-images.githubusercontent.com/29919212/160278700-aca5ae6e-0865-4832-a607-8dc85827a80a.png) ### What you expected to happen I think It is very possible to deploy multiple master-server on a node, I hope the multiple masters have the correct slot value. ### How to reproduce Deploy multiple master-server with different ports in a node. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9222
https://github.com/apache/dolphinscheduler/pull/9240
860771f922fd3201f76abca20db9ac09dc9eafd9
e2c1cc057918c8c70fd468d21e9ed727547ddc56
2022-03-27T11:17:38Z
java
2022-03-29T14:46:02Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/queue/MasterPriorityQueue.java
} refreshMasterList(); } public void remove(Server server) { this.queue.remove(server); } public void clear() { queue.clear(); refreshMasterList(); } private void refreshMasterList() { hostIndexMap.clear(); Iterator<Server> iterator = queue.iterator(); int index = 0; while (iterator.hasNext()) { Server server = iterator.next(); hostIndexMap.put(server.getHost(), index); index += 1; } } public int getIndex(String host) { if (!hostIndexMap.containsKey(host)) { return -1; } return hostIndexMap.get(host); } /** * server comparator, used to sort server by createTime in reverse order. */ private class ServerComparator implements Comparator<Server> {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,222
[Bug] [master] A node starts multiple master-server, the slot is same value
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened A node starts multiple master-server, the slot is same value. In the method of `refreshMasterList`, the key is `host`, not `host:port`, so, when master have same host, the slot is same also. ![image](https://user-images.githubusercontent.com/29919212/160278700-aca5ae6e-0865-4832-a607-8dc85827a80a.png) ### What you expected to happen I think It is very possible to deploy multiple master-server on a node, I hope the multiple masters have the correct slot value. ### How to reproduce Deploy multiple master-server with different ports in a node. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9222
https://github.com/apache/dolphinscheduler/pull/9240
860771f922fd3201f76abca20db9ac09dc9eafd9
e2c1cc057918c8c70fd468d21e9ed727547ddc56
2022-03-27T11:17:38Z
java
2022-03-29T14:46:02Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/queue/MasterPriorityQueue.java
@Override public int compare(Server o1, Server o2) { return o2.getCreateTime().compareTo(o1.getCreateTime()); } } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,270
[Bug] [Server] Too many open file
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I run workflow concurrently, I found that error log `too many open file` and master-server can not work continue. ![image](https://user-images.githubusercontent.com/11962619/160625320-31eab858-68cb-4542-893e-2e44ef37fa00.png) The reason is that too many task log file was created by master-server. ### What you expected to happen server can work continuously. ### How to reproduce create a workflow with a easy shell task, and then run concurrently until over the system ulimit. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9270
https://github.com/apache/dolphinscheduler/pull/9274
11d9859c407caa6ad287b1a9c64bbfda4b669b87
df519f8044a699911c34675c6e66de14d3f13308
2022-03-29T13:47:16Z
java
2022-03-30T03:42:47Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/FailoverExecuteThread.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,270
[Bug] [Server] Too many open file
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I run workflow concurrently, I found that error log `too many open file` and master-server can not work continue. ![image](https://user-images.githubusercontent.com/11962619/160625320-31eab858-68cb-4542-893e-2e44ef37fa00.png) The reason is that too many task log file was created by master-server. ### What you expected to happen server can work continuously. ### How to reproduce create a workflow with a easy shell task, and then run concurrently until over the system ulimit. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9270
https://github.com/apache/dolphinscheduler/pull/9274
11d9859c407caa6ad287b1a9c64bbfda4b669b87
df519f8044a699911c34675c6e66de14d3f13308
2022-03-29T13:47:16Z
java
2022-03-30T03:42:47Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/FailoverExecuteThread.java
* (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.server.master.runner; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.NodeType; import org.apache.dolphinscheduler.common.thread.Stopper; import org.apache.dolphinscheduler.common.thread.ThreadUtils; import org.apache.dolphinscheduler.server.master.config.MasterConfig; import org.apache.dolphinscheduler.server.master.registry.MasterRegistryClient; import org.apache.dolphinscheduler.service.process.ProcessService; import org.apache.dolphinscheduler.service.registry.RegistryClient; import org.apache.commons.collections4.CollectionUtils; import java.util.Iterator; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service public class FailoverExecuteThread extends Thread { private static final Logger logger = LoggerFactory.getLogger(FailoverExecuteThread.class);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,270
[Bug] [Server] Too many open file
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I run workflow concurrently, I found that error log `too many open file` and master-server can not work continue. ![image](https://user-images.githubusercontent.com/11962619/160625320-31eab858-68cb-4542-893e-2e44ef37fa00.png) The reason is that too many task log file was created by master-server. ### What you expected to happen server can work continuously. ### How to reproduce create a workflow with a easy shell task, and then run concurrently until over the system ulimit. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9270
https://github.com/apache/dolphinscheduler/pull/9274
11d9859c407caa6ad287b1a9c64bbfda4b669b87
df519f8044a699911c34675c6e66de14d3f13308
2022-03-29T13:47:16Z
java
2022-03-30T03:42:47Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/FailoverExecuteThread.java
@Autowired private MasterRegistryClient masterRegistryClient; @Autowired private RegistryClient registryClient; @Autowired private MasterConfig masterConfig; /** * process service */ @Autowired private ProcessService processService; @Override public synchronized void start() { super.setName("FailoverExecuteThread"); super.start(); } @Override public void run() { while (Stopper.isRunning()) { logger.info("failover execute started"); try { List<String> hosts = getNeedFailoverMasterServers(); if (CollectionUtils.isEmpty(hosts)) { continue; } logger.info("need failover hosts:{}", hosts); for (String host : hosts) { String failoverPath = masterRegistryClient.getFailoverLockPath(NodeType.MASTER, host); try { registryClient.getLock(failoverPath);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,270
[Bug] [Server] Too many open file
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I run workflow concurrently, I found that error log `too many open file` and master-server can not work continue. ![image](https://user-images.githubusercontent.com/11962619/160625320-31eab858-68cb-4542-893e-2e44ef37fa00.png) The reason is that too many task log file was created by master-server. ### What you expected to happen server can work continuously. ### How to reproduce create a workflow with a easy shell task, and then run concurrently until over the system ulimit. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9270
https://github.com/apache/dolphinscheduler/pull/9274
11d9859c407caa6ad287b1a9c64bbfda4b669b87
df519f8044a699911c34675c6e66de14d3f13308
2022-03-29T13:47:16Z
java
2022-03-30T03:42:47Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/FailoverExecuteThread.java
masterRegistryClient.failoverMaster(host); } catch (Exception e) { logger.error("{} server failover failed, host:{}", NodeType.MASTER, host, e); } finally { registryClient.releaseLock(failoverPath); } } } catch (Exception e) { logger.error("failover execute error", e); } finally { ThreadUtils.sleep((long) Constants.SLEEP_TIME_MILLIS * masterConfig.getFailoverInterval() * 60); } } } private List<String> getNeedFailoverMasterServers() { List<String> hosts = processService.queryNeedFailoverProcessInstanceHost(); Iterator<String> iterator = hosts.iterator(); while (iterator.hasNext()) { String host = iterator.next(); if (registryClient.checkNodeExists(host, NodeType.MASTER)) { if (!host.equals(masterRegistryClient.getLocalAddress())) { iterator.remove(); } } } return hosts; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,270
[Bug] [Server] Too many open file
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I run workflow concurrently, I found that error log `too many open file` and master-server can not work continue. ![image](https://user-images.githubusercontent.com/11962619/160625320-31eab858-68cb-4542-893e-2e44ef37fa00.png) The reason is that too many task log file was created by master-server. ### What you expected to happen server can work continuously. ### How to reproduce create a workflow with a easy shell task, and then run concurrently until over the system ulimit. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9270
https://github.com/apache/dolphinscheduler/pull/9274
11d9859c407caa6ad287b1a9c64bbfda4b669b87
df519f8044a699911c34675c6e66de14d3f13308
2022-03-29T13:47:16Z
java
2022-03-30T03:42:47Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThreadPool.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.server.master.runner; import org.apache.dolphinscheduler.common.enums.Flag; import org.apache.dolphinscheduler.common.enums.StateEvent; import org.apache.dolphinscheduler.common.enums.StateEventType;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,270
[Bug] [Server] Too many open file
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I run workflow concurrently, I found that error log `too many open file` and master-server can not work continue. ![image](https://user-images.githubusercontent.com/11962619/160625320-31eab858-68cb-4542-893e-2e44ef37fa00.png) The reason is that too many task log file was created by master-server. ### What you expected to happen server can work continuously. ### How to reproduce create a workflow with a easy shell task, and then run concurrently until over the system ulimit. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9270
https://github.com/apache/dolphinscheduler/pull/9274
11d9859c407caa6ad287b1a9c64bbfda4b669b87
df519f8044a699911c34675c6e66de14d3f13308
2022-03-29T13:47:16Z
java
2022-03-30T03:42:47Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThreadPool.java
import org.apache.dolphinscheduler.common.utils.NetUtils; import org.apache.dolphinscheduler.dao.entity.ProcessInstance; import org.apache.dolphinscheduler.dao.entity.TaskInstance; import org.apache.dolphinscheduler.plugin.task.api.enums.ExecutionStatus; import org.apache.dolphinscheduler.remote.command.StateEventChangeCommand; import org.apache.dolphinscheduler.remote.processor.StateEventCallbackService; import org.apache.dolphinscheduler.server.master.cache.ProcessInstanceExecCacheManager; import org.apache.dolphinscheduler.server.master.config.MasterConfig; import org.apache.dolphinscheduler.service.process.ProcessService; import org.apache.commons.lang.StringUtils; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import javax.annotation.PostConstruct; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.stereotype.Component; import org.springframework.util.concurrent.ListenableFuture; import org.springframework.util.concurrent.ListenableFutureCallback; @Component public class WorkflowExecuteThreadPool extends ThreadPoolTaskExecutor { private static final Logger logger = LoggerFactory.getLogger(WorkflowExecuteThreadPool.class); @Autowired private MasterConfig masterConfig; @Autowired private ProcessService processService; @Autowired private ProcessInstanceExecCacheManager processInstanceExecCacheManager; @Autowired
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,270
[Bug] [Server] Too many open file
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I run workflow concurrently, I found that error log `too many open file` and master-server can not work continue. ![image](https://user-images.githubusercontent.com/11962619/160625320-31eab858-68cb-4542-893e-2e44ef37fa00.png) The reason is that too many task log file was created by master-server. ### What you expected to happen server can work continuously. ### How to reproduce create a workflow with a easy shell task, and then run concurrently until over the system ulimit. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9270
https://github.com/apache/dolphinscheduler/pull/9274
11d9859c407caa6ad287b1a9c64bbfda4b669b87
df519f8044a699911c34675c6e66de14d3f13308
2022-03-29T13:47:16Z
java
2022-03-30T03:42:47Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThreadPool.java
private StateEventCallbackService stateEventCallbackService; @Autowired private StateWheelExecuteThread stateWheelExecuteThread; /** * multi-thread filter, avoid handling workflow at the same time */ private ConcurrentHashMap<String, WorkflowExecuteThread> multiThreadFilterMap = new ConcurrentHashMap(); @PostConstruct private void init() { this.setDaemon(true); this.setThreadNamePrefix("Workflow-Execute-Thread-"); this.setMaxPoolSize(masterConfig.getExecThreads()); this.setCorePoolSize(masterConfig.getExecThreads()); } /** * submit state event */ public void submitStateEvent(StateEvent stateEvent) { WorkflowExecuteThread workflowExecuteThread = processInstanceExecCacheManager.getByProcessInstanceId(stateEvent.getProcessInstanceId()); if (workflowExecuteThread == null) { logger.error("workflowExecuteThread is null, processInstanceId:{}", stateEvent.getProcessInstanceId()); return; } workflowExecuteThread.addStateEvent(stateEvent); } /** * start workflow */ public void startWorkflow(WorkflowExecuteThread workflowExecuteThread) { submit(workflowExecuteThread::startProcess);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,270
[Bug] [Server] Too many open file
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I run workflow concurrently, I found that error log `too many open file` and master-server can not work continue. ![image](https://user-images.githubusercontent.com/11962619/160625320-31eab858-68cb-4542-893e-2e44ef37fa00.png) The reason is that too many task log file was created by master-server. ### What you expected to happen server can work continuously. ### How to reproduce create a workflow with a easy shell task, and then run concurrently until over the system ulimit. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9270
https://github.com/apache/dolphinscheduler/pull/9274
11d9859c407caa6ad287b1a9c64bbfda4b669b87
df519f8044a699911c34675c6e66de14d3f13308
2022-03-29T13:47:16Z
java
2022-03-30T03:42:47Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThreadPool.java
} /** * execute workflow */ public void executeEvent(WorkflowExecuteThread workflowExecuteThread) { if (!workflowExecuteThread.isStart() || workflowExecuteThread.eventSize() == 0) { return; } if (multiThreadFilterMap.containsKey(workflowExecuteThread.getKey())) { return; } int processInstanceId = workflowExecuteThread.getProcessInstance().getId(); ListenableFuture future = this.submitListenable(() -> { workflowExecuteThread.handleEvents(); multiThreadFilterMap.put(workflowExecuteThread.getKey(), workflowExecuteThread); }); future.addCallback(new ListenableFutureCallback() { @Override public void onFailure(Throwable ex) { logger.error("handle events {} failed", processInstanceId, ex); multiThreadFilterMap.remove(workflowExecuteThread.getKey()); } @Override public void onSuccess(Object result) { try { if (workflowExecuteThread.workFlowFinish()) { stateWheelExecuteThread.removeProcess4TimeoutCheck(workflowExecuteThread.getProcessInstance()); processInstanceExecCacheManager.removeByProcessInstanceId(processInstanceId);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,270
[Bug] [Server] Too many open file
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I run workflow concurrently, I found that error log `too many open file` and master-server can not work continue. ![image](https://user-images.githubusercontent.com/11962619/160625320-31eab858-68cb-4542-893e-2e44ef37fa00.png) The reason is that too many task log file was created by master-server. ### What you expected to happen server can work continuously. ### How to reproduce create a workflow with a easy shell task, and then run concurrently until over the system ulimit. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9270
https://github.com/apache/dolphinscheduler/pull/9274
11d9859c407caa6ad287b1a9c64bbfda4b669b87
df519f8044a699911c34675c6e66de14d3f13308
2022-03-29T13:47:16Z
java
2022-03-30T03:42:47Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThreadPool.java
notifyProcessChanged(workflowExecuteThread.getProcessInstance()); logger.info("process instance {} finished.", processInstanceId); } } catch (Exception e) { logger.error("handle events {} success, but notify changed error", processInstanceId, e); } multiThreadFilterMap.remove(workflowExecuteThread.getKey()); } }); } /** * notify process change */ private void notifyProcessChanged(ProcessInstance finishProcessInstance) { if (Flag.NO == finishProcessInstance.getIsSubProcess()) { return; } Map<ProcessInstance, TaskInstance> fatherMaps = processService.notifyProcessList(finishProcessInstance.getId()); for (ProcessInstance processInstance : fatherMaps.keySet()) { String address = NetUtils.getAddr(masterConfig.getListenPort()); if (processInstance.getHost().equalsIgnoreCase(address)) { this.notifyMyself(processInstance, fatherMaps.get(processInstance)); } else { this.notifyProcess(finishProcessInstance, processInstance, fatherMaps.get(processInstance)); } } } /** * notify myself */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,270
[Bug] [Server] Too many open file
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I run workflow concurrently, I found that error log `too many open file` and master-server can not work continue. ![image](https://user-images.githubusercontent.com/11962619/160625320-31eab858-68cb-4542-893e-2e44ef37fa00.png) The reason is that too many task log file was created by master-server. ### What you expected to happen server can work continuously. ### How to reproduce create a workflow with a easy shell task, and then run concurrently until over the system ulimit. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9270
https://github.com/apache/dolphinscheduler/pull/9274
11d9859c407caa6ad287b1a9c64bbfda4b669b87
df519f8044a699911c34675c6e66de14d3f13308
2022-03-29T13:47:16Z
java
2022-03-30T03:42:47Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThreadPool.java
private void notifyMyself(ProcessInstance processInstance, TaskInstance taskInstance) { logger.info("notify process {} task {} state change", processInstance.getId(), taskInstance.getId()); if (!processInstanceExecCacheManager.contains(processInstance.getId())) { return; } StateEvent stateEvent = new StateEvent(); stateEvent.setTaskInstanceId(taskInstance.getId()); stateEvent.setType(StateEventType.TASK_STATE_CHANGE); stateEvent.setProcessInstanceId(processInstance.getId()); stateEvent.setExecutionStatus(ExecutionStatus.RUNNING_EXECUTION); this.submitStateEvent(stateEvent); } /** * notify process's master */ private void notifyProcess(ProcessInstance finishProcessInstance, ProcessInstance processInstance, TaskInstance taskInstance) { String host = processInstance.getHost(); if (StringUtils.isEmpty(host)) { logger.error("process {} host is empty, cannot notify task {} now", processInstance.getId(), taskInstance.getId()); return; } String address = host.split(":")[0]; int port = Integer.parseInt(host.split(":")[1]); StateEventChangeCommand stateEventChangeCommand = new StateEventChangeCommand( finishProcessInstance.getId(), 0, finishProcessInstance.getState(), processInstance.getId(), taskInstance.getId() ); stateEventCallbackService.sendResult(address, port, stateEventChangeCommand.convert2Command()); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,270
[Bug] [Server] Too many open file
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I run workflow concurrently, I found that error log `too many open file` and master-server can not work continue. ![image](https://user-images.githubusercontent.com/11962619/160625320-31eab858-68cb-4542-893e-2e44ef37fa00.png) The reason is that too many task log file was created by master-server. ### What you expected to happen server can work continuously. ### How to reproduce create a workflow with a easy shell task, and then run concurrently until over the system ulimit. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9270
https://github.com/apache/dolphinscheduler/pull/9274
11d9859c407caa6ad287b1a9c64bbfda4b669b87
df519f8044a699911c34675c6e66de14d3f13308
2022-03-29T13:47:16Z
java
2022-03-30T03:42:47Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/CommonTaskProcessor.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.server.master.runner.task; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext; import org.apache.dolphinscheduler.plugin.task.api.enums.ExecutionStatus; import org.apache.dolphinscheduler.remote.command.TaskKillRequestCommand; import org.apache.dolphinscheduler.remote.utils.Host; import org.apache.dolphinscheduler.server.master.dispatch.context.ExecutionContext; import org.apache.dolphinscheduler.server.master.dispatch.enums.ExecutorType; import org.apache.dolphinscheduler.server.master.dispatch.exceptions.ExecuteException; import org.apache.dolphinscheduler.server.master.dispatch.executor.NettyExecutorManager;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,270
[Bug] [Server] Too many open file
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I run workflow concurrently, I found that error log `too many open file` and master-server can not work continue. ![image](https://user-images.githubusercontent.com/11962619/160625320-31eab858-68cb-4542-893e-2e44ef37fa00.png) The reason is that too many task log file was created by master-server. ### What you expected to happen server can work continuously. ### How to reproduce create a workflow with a easy shell task, and then run concurrently until over the system ulimit. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9270
https://github.com/apache/dolphinscheduler/pull/9274
11d9859c407caa6ad287b1a9c64bbfda4b669b87
df519f8044a699911c34675c6e66de14d3f13308
2022-03-29T13:47:16Z
java
2022-03-30T03:42:47Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/CommonTaskProcessor.java
import org.apache.dolphinscheduler.service.bean.SpringApplicationContext; import org.apache.dolphinscheduler.service.queue.TaskPriority; import org.apache.dolphinscheduler.service.queue.TaskPriorityQueue; import org.apache.dolphinscheduler.service.queue.TaskPriorityQueueImpl; import org.apache.commons.lang.StringUtils; import java.util.Date; import com.google.auto.service.AutoService; /** * common task processor */ @AutoService(ITaskProcessor.class) public class CommonTaskProcessor extends BaseTaskProcessor { private TaskPriorityQueue taskUpdateQueue; private NettyExecutorManager nettyExecutorManager = SpringApplicationContext.getBean(NettyExecutorManager.class); @Override protected boolean submitTask() { this.taskInstance = processService.submitTaskWithRetry(processInstance, taskInstance, maxRetryTimes, commitInterval); if (this.taskInstance == null) { return false; } this.setTaskExecutionLogger(); int taskGroupId = taskInstance.getTaskGroupId(); if (taskGroupId > 0) { boolean acquireTaskGroup = processService.acquireTaskGroup(taskInstance.getId(), taskInstance.getName(), taskGroupId, taskInstance.getProcessInstanceId(), taskInstance.getTaskInstancePriority().getCode()); if (!acquireTaskGroup) { logger.info("submit task name :{}, but the first time to try to acquire task group failed", taskInstance.getName());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,270
[Bug] [Server] Too many open file
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I run workflow concurrently, I found that error log `too many open file` and master-server can not work continue. ![image](https://user-images.githubusercontent.com/11962619/160625320-31eab858-68cb-4542-893e-2e44ef37fa00.png) The reason is that too many task log file was created by master-server. ### What you expected to happen server can work continuously. ### How to reproduce create a workflow with a easy shell task, and then run concurrently until over the system ulimit. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9270
https://github.com/apache/dolphinscheduler/pull/9274
11d9859c407caa6ad287b1a9c64bbfda4b669b87
df519f8044a699911c34675c6e66de14d3f13308
2022-03-29T13:47:16Z
java
2022-03-30T03:42:47Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/CommonTaskProcessor.java
return true; } } dispatchTask(); return true; } @Override public boolean runTask() { return true; } @Override protected boolean taskTimeout() { return true; } /** * common task cannot be paused */ @Override protected boolean pauseTask() { return true; } @Override public String getType() { return Constants.COMMON_TASK_TYPE; } @Override public boolean dispatchTask() { try { if (taskUpdateQueue == null) { this.initQueue();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,270
[Bug] [Server] Too many open file
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I run workflow concurrently, I found that error log `too many open file` and master-server can not work continue. ![image](https://user-images.githubusercontent.com/11962619/160625320-31eab858-68cb-4542-893e-2e44ef37fa00.png) The reason is that too many task log file was created by master-server. ### What you expected to happen server can work continuously. ### How to reproduce create a workflow with a easy shell task, and then run concurrently until over the system ulimit. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9270
https://github.com/apache/dolphinscheduler/pull/9274
11d9859c407caa6ad287b1a9c64bbfda4b669b87
df519f8044a699911c34675c6e66de14d3f13308
2022-03-29T13:47:16Z
java
2022-03-30T03:42:47Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/CommonTaskProcessor.java
} if (taskInstance.getState().typeIsFinished()) { logger.info(String.format("submit task , but task [%s] state [%s] is already finished. ", taskInstance.getName(), taskInstance.getState().toString())); return true; } if (taskInstance.getState() == ExecutionStatus.RUNNING_EXECUTION || taskInstance.getState() == ExecutionStatus.DELAY_EXECUTION) { logger.info("submit task, but the status of the task {} is already running or delayed.", taskInstance.getName()); return true; } logger.info("task ready to submit: {}", taskInstance); TaskPriority taskPriority = new TaskPriority(processInstance.getProcessInstancePriority().getCode(), processInstance.getId(), taskInstance.getProcessInstancePriority().getCode(), taskInstance.getId(), org.apache.dolphinscheduler.common.Constants.DEFAULT_WORKER_GROUP); TaskExecutionContext taskExecutionContext = getTaskExecutionContext(taskInstance); taskPriority.setTaskExecutionContext(taskExecutionContext); taskUpdateQueue.put(taskPriority); logger.info(String.format("master submit success, task : %s", taskInstance.getName())); return true; } catch (Exception e) { logger.error("submit task error", e); return false; } } public void initQueue() { this.taskUpdateQueue = SpringApplicationContext.getBean(TaskPriorityQueueImpl.class); } @Override public boolean killTask() {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,270
[Bug] [Server] Too many open file
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I run workflow concurrently, I found that error log `too many open file` and master-server can not work continue. ![image](https://user-images.githubusercontent.com/11962619/160625320-31eab858-68cb-4542-893e-2e44ef37fa00.png) The reason is that too many task log file was created by master-server. ### What you expected to happen server can work continuously. ### How to reproduce create a workflow with a easy shell task, and then run concurrently until over the system ulimit. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9270
https://github.com/apache/dolphinscheduler/pull/9274
11d9859c407caa6ad287b1a9c64bbfda4b669b87
df519f8044a699911c34675c6e66de14d3f13308
2022-03-29T13:47:16Z
java
2022-03-30T03:42:47Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/CommonTaskProcessor.java
try { taskInstance = processService.findTaskInstanceById(taskInstance.getId()); if (taskInstance == null) { return true; } if (taskInstance.getState().typeIsFinished()) { return true; } if (StringUtils.isBlank(taskInstance.getHost())) { taskInstance.setState(ExecutionStatus.KILL); taskInstance.setEndTime(new Date()); processService.updateTaskInstance(taskInstance); return true; } TaskKillRequestCommand killCommand = new TaskKillRequestCommand(); killCommand.setTaskInstanceId(taskInstance.getId()); ExecutionContext executionContext = new ExecutionContext(killCommand.convert2Command(), ExecutorType.WORKER); Host host = Host.of(taskInstance.getHost()); executionContext.setHost(host); nettyExecutorManager.executeDirectly(executionContext); } catch (ExecuteException e) { logger.error("kill task error:", e); return false; } logger.info("master kill taskInstance name :{} taskInstance id:{}", taskInstance.getName(), taskInstance.getId()); return true; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,288
[Improvement][Master] increase the speed of task event consumption
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Now ds master consum task event is a single thread, which is slowly when stress test. It's better to handle by multi threads. branch: dev ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9288
https://github.com/apache/dolphinscheduler/pull/9293
192ee9987606593ff258012e7103f7f1f305dc0d
52ba2c6475042ad2bd65d2987b7a2e2d23ddd8fa
2022-03-30T09:53:47Z
java
2022-03-31T06:13:33Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/processor/queue/TaskEventService.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.server.master.processor.queue; import org.apache.dolphinscheduler.common.enums.Event; import org.apache.dolphinscheduler.common.enums.StateEvent; import org.apache.dolphinscheduler.common.enums.StateEventType; import org.apache.dolphinscheduler.common.thread.Stopper; import org.apache.dolphinscheduler.dao.entity.TaskInstance; import org.apache.dolphinscheduler.plugin.task.api.enums.ExecutionStatus; import org.apache.dolphinscheduler.remote.command.TaskExecuteResponseAckCommand; import org.apache.dolphinscheduler.remote.command.TaskExecuteRunningAckCommand; import org.apache.dolphinscheduler.server.master.cache.ProcessInstanceExecCacheManager; import org.apache.dolphinscheduler.server.master.runner.WorkflowExecuteThread; import org.apache.dolphinscheduler.server.master.runner.WorkflowExecuteThreadPool; import org.apache.dolphinscheduler.server.utils.DataQualityResultOperator;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,288
[Improvement][Master] increase the speed of task event consumption
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Now ds master consum task event is a single thread, which is slowly when stress test. It's better to handle by multi threads. branch: dev ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9288
https://github.com/apache/dolphinscheduler/pull/9293
192ee9987606593ff258012e7103f7f1f305dc0d
52ba2c6475042ad2bd65d2987b7a2e2d23ddd8fa
2022-03-30T09:53:47Z
java
2022-03-31T06:13:33Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/processor/queue/TaskEventService.java
import org.apache.dolphinscheduler.service.process.ProcessService; import java.util.ArrayList; import java.util.List; import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import io.netty.channel.Channel; /** * task manager */ @Component public class TaskEventService { /** * logger */ private final Logger logger = LoggerFactory.getLogger(TaskEventService.class); /** * attemptQueue */ private final BlockingQueue<TaskEvent> eventQueue = new LinkedBlockingQueue<>(); /** * process service */ @Autowired private ProcessService processService;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,288
[Improvement][Master] increase the speed of task event consumption
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Now ds master consum task event is a single thread, which is slowly when stress test. It's better to handle by multi threads. branch: dev ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9288
https://github.com/apache/dolphinscheduler/pull/9293
192ee9987606593ff258012e7103f7f1f305dc0d
52ba2c6475042ad2bd65d2987b7a2e2d23ddd8fa
2022-03-30T09:53:47Z
java
2022-03-31T06:13:33Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/processor/queue/TaskEventService.java
/** * data quality result operator */ @Autowired private DataQualityResultOperator dataQualityResultOperator; /** * task event worker */ private Thread taskEventWorker; @Autowired private ProcessInstanceExecCacheManager processInstanceExecCacheManager; @Autowired private WorkflowExecuteThreadPool workflowExecuteThreadPool; @PostConstruct public void start() { this.taskEventWorker = new TaskEventWorker(); this.taskEventWorker.setName("TaskStateEventWorker"); this.taskEventWorker.start(); } @PreDestroy public void stop() { try { this.taskEventWorker.interrupt(); if (!eventQueue.isEmpty()) { List<TaskEvent> remainEvents = new ArrayList<>(eventQueue.size()); eventQueue.drainTo(remainEvents); for (TaskEvent event : remainEvents) { this.persist(event); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,288
[Improvement][Master] increase the speed of task event consumption
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Now ds master consum task event is a single thread, which is slowly when stress test. It's better to handle by multi threads. branch: dev ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9288
https://github.com/apache/dolphinscheduler/pull/9293
192ee9987606593ff258012e7103f7f1f305dc0d
52ba2c6475042ad2bd65d2987b7a2e2d23ddd8fa
2022-03-30T09:53:47Z
java
2022-03-31T06:13:33Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/processor/queue/TaskEventService.java
} catch (Exception e) { logger.error("stop error:", e); } } /** * add event to queue * * @param taskEvent taskEvent */ public void addEvent(TaskEvent taskEvent) { try { eventQueue.put(taskEvent); } catch (InterruptedException e) { logger.error("add task event : {} error :{}", taskEvent, e); Thread.currentThread().interrupt(); } } /** * task worker thread */ class TaskEventWorker extends Thread { @Override public void run() { while (Stopper.isRunning()) { try { TaskEvent taskEvent = eventQueue.take(); persist(taskEvent); } catch (InterruptedException e) { Thread.currentThread().interrupt();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,288
[Improvement][Master] increase the speed of task event consumption
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Now ds master consum task event is a single thread, which is slowly when stress test. It's better to handle by multi threads. branch: dev ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9288
https://github.com/apache/dolphinscheduler/pull/9293
192ee9987606593ff258012e7103f7f1f305dc0d
52ba2c6475042ad2bd65d2987b7a2e2d23ddd8fa
2022-03-30T09:53:47Z
java
2022-03-31T06:13:33Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/processor/queue/TaskEventService.java
break; } catch (Exception e) { logger.error("persist task error", e); } } logger.info("StateEventResponseWorker stopped"); } } /** * persist task event * * @param taskEvent taskEvent */ private void persist(TaskEvent taskEvent) { Event event = taskEvent.getEvent(); int taskInstanceId = taskEvent.getTaskInstanceId(); int processInstanceId = taskEvent.getProcessInstanceId(); TaskInstance taskInstance; WorkflowExecuteThread workflowExecuteThread = this.processInstanceExecCacheManager.getByProcessInstanceId(processInstanceId); if (workflowExecuteThread != null && workflowExecuteThread.checkTaskInstanceById(taskInstanceId)) { taskInstance = workflowExecuteThread.getTaskInstance(taskInstanceId); } else { taskInstance = processService.findTaskInstanceById(taskInstanceId); } switch (event) { case DISPATCH: handleDispatchEvent(taskEvent, taskInstance); return; case DELAY:
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,288
[Improvement][Master] increase the speed of task event consumption
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Now ds master consum task event is a single thread, which is slowly when stress test. It's better to handle by multi threads. branch: dev ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9288
https://github.com/apache/dolphinscheduler/pull/9293
192ee9987606593ff258012e7103f7f1f305dc0d
52ba2c6475042ad2bd65d2987b7a2e2d23ddd8fa
2022-03-30T09:53:47Z
java
2022-03-31T06:13:33Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/processor/queue/TaskEventService.java
case RUNNING: handleRunningEvent(taskEvent, taskInstance); break; case RESULT: handleResultEvent(taskEvent, taskInstance); break; default: throw new IllegalArgumentException("invalid event type : " + event); } StateEvent stateEvent = new StateEvent(); stateEvent.setProcessInstanceId(taskEvent.getProcessInstanceId()); stateEvent.setTaskInstanceId(taskEvent.getTaskInstanceId()); stateEvent.setExecutionStatus(taskEvent.getState()); stateEvent.setType(StateEventType.TASK_STATE_CHANGE); workflowExecuteThreadPool.submitStateEvent(stateEvent); } /** * handle dispatch event */ private void handleDispatchEvent(TaskEvent taskEvent, TaskInstance taskInstance) { if (taskInstance == null) { logger.error("taskInstance is null"); return; } if (taskInstance.getState() != ExecutionStatus.SUBMITTED_SUCCESS) { return; } taskInstance.setState(ExecutionStatus.DISPATCH); taskInstance.setHost(taskEvent.getWorkerAddress()); processService.saveTaskInstance(taskInstance);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,288
[Improvement][Master] increase the speed of task event consumption
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Now ds master consum task event is a single thread, which is slowly when stress test. It's better to handle by multi threads. branch: dev ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9288
https://github.com/apache/dolphinscheduler/pull/9293
192ee9987606593ff258012e7103f7f1f305dc0d
52ba2c6475042ad2bd65d2987b7a2e2d23ddd8fa
2022-03-30T09:53:47Z
java
2022-03-31T06:13:33Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/processor/queue/TaskEventService.java
} /** * handle running event */ private void handleRunningEvent(TaskEvent taskEvent, TaskInstance taskInstance) { Channel channel = taskEvent.getChannel(); try { if (taskInstance != null) { if (taskInstance.getState().typeIsFinished()) { logger.warn("task is finish, running event is meaningless, taskInstanceId:{}, state:{}", taskInstance.getId(), taskInstance.getState()); } else { taskInstance.setState(taskEvent.getState()); taskInstance.setStartTime(taskEvent.getStartTime()); taskInstance.setHost(taskEvent.getWorkerAddress()); taskInstance.setLogPath(taskEvent.getLogPath()); taskInstance.setExecutePath(taskEvent.getExecutePath()); taskInstance.setPid(taskEvent.getProcessId()); taskInstance.setAppLink(taskEvent.getAppIds()); processService.saveTaskInstance(taskInstance); } } TaskExecuteRunningAckCommand taskExecuteRunningAckCommand = new TaskExecuteRunningAckCommand(ExecutionStatus.SUCCESS.getCode(), taskEvent.getTaskInstanceId()); channel.writeAndFlush(taskExecuteRunningAckCommand.convert2Command()); } catch (Exception e) { logger.error("worker ack master error", e); TaskExecuteRunningAckCommand taskExecuteRunningAckCommand = new TaskExecuteRunningAckCommand(ExecutionStatus.FAILURE.getCode(), -1); channel.writeAndFlush(taskExecuteRunningAckCommand.convert2Command()); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,288
[Improvement][Master] increase the speed of task event consumption
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Now ds master consum task event is a single thread, which is slowly when stress test. It's better to handle by multi threads. branch: dev ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9288
https://github.com/apache/dolphinscheduler/pull/9293
192ee9987606593ff258012e7103f7f1f305dc0d
52ba2c6475042ad2bd65d2987b7a2e2d23ddd8fa
2022-03-30T09:53:47Z
java
2022-03-31T06:13:33Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/processor/queue/TaskEventService.java
/** * handle result event */ private void handleResultEvent(TaskEvent taskEvent, TaskInstance taskInstance) { Channel channel = taskEvent.getChannel(); try { if (taskInstance != null) { dataQualityResultOperator.operateDqExecuteResult(taskEvent, taskInstance); taskInstance.setStartTime(taskEvent.getStartTime()); taskInstance.setHost(taskEvent.getWorkerAddress()); taskInstance.setLogPath(taskEvent.getLogPath()); taskInstance.setExecutePath(taskEvent.getExecutePath()); taskInstance.setPid(taskEvent.getProcessId()); taskInstance.setAppLink(taskEvent.getAppIds()); taskInstance.setState(taskEvent.getState()); taskInstance.setEndTime(taskEvent.getEndTime()); taskInstance.setVarPool(taskEvent.getVarPool()); processService.changeOutParam(taskInstance); processService.saveTaskInstance(taskInstance); } TaskExecuteResponseAckCommand taskExecuteResponseAckCommand = new TaskExecuteResponseAckCommand(ExecutionStatus.SUCCESS.getCode(), taskEvent.getTaskInstanceId()); channel.writeAndFlush(taskExecuteResponseAckCommand.convert2Command()); } catch (Exception e) { logger.error("worker response master error", e); TaskExecuteResponseAckCommand taskExecuteResponseAckCommand = new TaskExecuteResponseAckCommand(ExecutionStatus.FAILURE.getCode(), -1); channel.writeAndFlush(taskExecuteResponseAckCommand.convert2Command()); } } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,288
[Improvement][Master] increase the speed of task event consumption
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Now ds master consum task event is a single thread, which is slowly when stress test. It's better to handle by multi threads. branch: dev ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9288
https://github.com/apache/dolphinscheduler/pull/9293
192ee9987606593ff258012e7103f7f1f305dc0d
52ba2c6475042ad2bd65d2987b7a2e2d23ddd8fa
2022-03-30T09:53:47Z
java
2022-03-31T06:13:33Z
dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/processor/queue/TaskResponseServiceTest.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,288
[Improvement][Master] increase the speed of task event consumption
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Now ds master consum task event is a single thread, which is slowly when stress test. It's better to handle by multi threads. branch: dev ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9288
https://github.com/apache/dolphinscheduler/pull/9293
192ee9987606593ff258012e7103f7f1f305dc0d
52ba2c6475042ad2bd65d2987b7a2e2d23ddd8fa
2022-03-30T09:53:47Z
java
2022-03-31T06:13:33Z
dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/processor/queue/TaskResponseServiceTest.java
* * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.server.master.processor.queue; import org.apache.dolphinscheduler.dao.entity.TaskInstance; import org.apache.dolphinscheduler.plugin.task.api.enums.ExecutionStatus; import org.apache.dolphinscheduler.remote.command.TaskExecuteResponseCommand; import org.apache.dolphinscheduler.remote.command.TaskExecuteRunningCommand; import org.apache.dolphinscheduler.server.master.cache.impl.ProcessInstanceExecCacheManagerImpl; import org.apache.dolphinscheduler.server.master.runner.WorkflowExecuteThreadPool; import org.apache.dolphinscheduler.server.utils.DataQualityResultOperator; import org.apache.dolphinscheduler.service.process.ProcessService; import java.net.InetSocketAddress; import java.util.Date; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; import io.netty.channel.Channel; @RunWith(MockitoJUnitRunner.class)
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,288
[Improvement][Master] increase the speed of task event consumption
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Now ds master consum task event is a single thread, which is slowly when stress test. It's better to handle by multi threads. branch: dev ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9288
https://github.com/apache/dolphinscheduler/pull/9293
192ee9987606593ff258012e7103f7f1f305dc0d
52ba2c6475042ad2bd65d2987b7a2e2d23ddd8fa
2022-03-30T09:53:47Z
java
2022-03-31T06:13:33Z
dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/processor/queue/TaskResponseServiceTest.java
public class TaskResponseServiceTest { @Mock(name = "processService") private ProcessService processService; @InjectMocks TaskEventService taskEventService; @Mock private Channel channel; private TaskEvent ackEvent; private TaskEvent resultEvent; private TaskInstance taskInstance; @Mock private ProcessInstanceExecCacheManagerImpl processInstanceExecCacheManager; @Mock private DataQualityResultOperator dataQualityResultOperator; @Mock private WorkflowExecuteThreadPool workflowExecuteThreadPool; @Before public void before() { taskEventService.start(); Mockito.when(channel.remoteAddress()).thenReturn(InetSocketAddress.createUnresolved("127.0.0.1", 1234)); TaskExecuteRunningCommand taskExecuteRunningCommand = new TaskExecuteRunningCommand(); taskExecuteRunningCommand.setProcessId(1); taskExecuteRunningCommand.setTaskInstanceId(22); taskExecuteRunningCommand.setStatus(ExecutionStatus.RUNNING_EXECUTION.getCode()); taskExecuteRunningCommand.setExecutePath("path"); taskExecuteRunningCommand.setLogPath("logPath"); taskExecuteRunningCommand.setHost("127.*.*.*");
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,288
[Improvement][Master] increase the speed of task event consumption
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Now ds master consum task event is a single thread, which is slowly when stress test. It's better to handle by multi threads. branch: dev ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9288
https://github.com/apache/dolphinscheduler/pull/9293
192ee9987606593ff258012e7103f7f1f305dc0d
52ba2c6475042ad2bd65d2987b7a2e2d23ddd8fa
2022-03-30T09:53:47Z
java
2022-03-31T06:13:33Z
dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/processor/queue/TaskResponseServiceTest.java
taskExecuteRunningCommand.setStartTime(new Date()); ackEvent = TaskEvent.newRunningEvent(taskExecuteRunningCommand, channel); TaskExecuteResponseCommand taskExecuteResponseCommand = new TaskExecuteResponseCommand(); taskExecuteResponseCommand.setProcessInstanceId(1); taskExecuteResponseCommand.setTaskInstanceId(22); taskExecuteResponseCommand.setStatus(ExecutionStatus.SUCCESS.getCode()); taskExecuteResponseCommand.setEndTime(new Date()); taskExecuteResponseCommand.setVarPool("varPol"); taskExecuteResponseCommand.setAppIds("ids"); taskExecuteResponseCommand.setProcessId(1); resultEvent = TaskEvent.newResultEvent(taskExecuteResponseCommand, channel); taskInstance = new TaskInstance(); taskInstance.setId(22); taskInstance.setState(ExecutionStatus.RUNNING_EXECUTION); } @Test public void testAddResponse() { Mockito.when(processService.findTaskInstanceById(Mockito.any())).thenReturn(taskInstance); Mockito.when(channel.writeAndFlush(Mockito.any())).thenReturn(null); taskEventService.addEvent(ackEvent); taskEventService.addEvent(resultEvent); } @After public void after() { if (taskEventService != null) { taskEventService.stop(); } } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,295
[Bug] [Master] repeated submit task
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened ![image](https://user-images.githubusercontent.com/11962619/160961599-2e83ba72-d0d3-41af-b509-2edca70747ff.png) ### What you expected to happen every task submit once. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/160961554-35f7cf4a-720c-4e34-96aa-09d8fb602aec.png) ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9295
https://github.com/apache/dolphinscheduler/pull/9304
81f9b876f9f5865a7e65b668008af0cde580b326
1073fcae443e417b082ac4a745454bdef1da1f7d
2022-03-31T02:05:01Z
java
2022-03-31T13:10:09Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumer.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.server.master.consumer; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.thread.Stopper; import org.apache.dolphinscheduler.common.thread.ThreadUtils; import org.apache.dolphinscheduler.dao.entity.TaskInstance; import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext; import org.apache.dolphinscheduler.remote.command.Command;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,295
[Bug] [Master] repeated submit task
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened ![image](https://user-images.githubusercontent.com/11962619/160961599-2e83ba72-d0d3-41af-b509-2edca70747ff.png) ### What you expected to happen every task submit once. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/160961554-35f7cf4a-720c-4e34-96aa-09d8fb602aec.png) ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9295
https://github.com/apache/dolphinscheduler/pull/9304
81f9b876f9f5865a7e65b668008af0cde580b326
1073fcae443e417b082ac4a745454bdef1da1f7d
2022-03-31T02:05:01Z
java
2022-03-31T13:10:09Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumer.java
import org.apache.dolphinscheduler.remote.command.TaskExecuteRequestCommand; import org.apache.dolphinscheduler.server.master.cache.ProcessInstanceExecCacheManager; import org.apache.dolphinscheduler.server.master.config.MasterConfig; import org.apache.dolphinscheduler.server.master.dispatch.ExecutorDispatcher; import org.apache.dolphinscheduler.server.master.dispatch.context.ExecutionContext; import org.apache.dolphinscheduler.server.master.dispatch.enums.ExecutorType; import org.apache.dolphinscheduler.server.master.dispatch.exceptions.ExecuteException; import org.apache.dolphinscheduler.server.master.processor.queue.TaskEvent; import org.apache.dolphinscheduler.server.master.processor.queue.TaskEventService; import org.apache.dolphinscheduler.service.exceptions.TaskPriorityQueueException; import org.apache.dolphinscheduler.service.process.ProcessService; import org.apache.dolphinscheduler.service.queue.TaskPriority; import org.apache.dolphinscheduler.service.queue.TaskPriorityQueue; import org.apache.dolphinscheduler.spi.utils.JSONUtils; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Objects; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import javax.annotation.PostConstruct; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; /** * TaskUpdateQueue consumer */ @Component
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,295
[Bug] [Master] repeated submit task
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened ![image](https://user-images.githubusercontent.com/11962619/160961599-2e83ba72-d0d3-41af-b509-2edca70747ff.png) ### What you expected to happen every task submit once. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/160961554-35f7cf4a-720c-4e34-96aa-09d8fb602aec.png) ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9295
https://github.com/apache/dolphinscheduler/pull/9304
81f9b876f9f5865a7e65b668008af0cde580b326
1073fcae443e417b082ac4a745454bdef1da1f7d
2022-03-31T02:05:01Z
java
2022-03-31T13:10:09Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumer.java
public class TaskPriorityQueueConsumer extends Thread { /** * logger of TaskUpdateQueueConsumer */ private static final Logger logger = LoggerFactory.getLogger(TaskPriorityQueueConsumer.class); /** * taskUpdateQueue */ @Autowired private TaskPriorityQueue<TaskPriority> taskPriorityQueue; /** * processService */ @Autowired private ProcessService processService; /** * executor dispatcher */ @Autowired private ExecutorDispatcher dispatcher; /** * processInstance cache manager */ @Autowired private ProcessInstanceExecCacheManager processInstanceExecCacheManager; /** * master config */ @Autowired private MasterConfig masterConfig;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,295
[Bug] [Master] repeated submit task
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened ![image](https://user-images.githubusercontent.com/11962619/160961599-2e83ba72-d0d3-41af-b509-2edca70747ff.png) ### What you expected to happen every task submit once. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/160961554-35f7cf4a-720c-4e34-96aa-09d8fb602aec.png) ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9295
https://github.com/apache/dolphinscheduler/pull/9304
81f9b876f9f5865a7e65b668008af0cde580b326
1073fcae443e417b082ac4a745454bdef1da1f7d
2022-03-31T02:05:01Z
java
2022-03-31T13:10:09Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumer.java
/** * task response service */ @Autowired private TaskEventService taskEventService; /** * consumer thread pool */ private ThreadPoolExecutor consumerThreadPoolExecutor; @PostConstruct public void init() { this.consumerThreadPoolExecutor = (ThreadPoolExecutor) ThreadUtils.newDaemonFixedThreadExecutor("TaskUpdateQueueConsumerThread", masterConfig.getDispatchTaskNumber()); super.start(); } @Override public void run() { int fetchTaskNum = masterConfig.getDispatchTaskNumber(); while (Stopper.isRunning()) { try { List<TaskPriority> failedDispatchTasks = this.batchDispatch(fetchTaskNum); if (!failedDispatchTasks.isEmpty()) { for (TaskPriority dispatchFailedTask : failedDispatchTasks) { taskPriorityQueue.put(dispatchFailedTask); } if (taskPriorityQueue.size() <= failedDispatchTasks.size()) { TimeUnit.MILLISECONDS.sleep(Constants.SLEEP_TIME_MILLIS); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,295
[Bug] [Master] repeated submit task
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened ![image](https://user-images.githubusercontent.com/11962619/160961599-2e83ba72-d0d3-41af-b509-2edca70747ff.png) ### What you expected to happen every task submit once. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/160961554-35f7cf4a-720c-4e34-96aa-09d8fb602aec.png) ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9295
https://github.com/apache/dolphinscheduler/pull/9304
81f9b876f9f5865a7e65b668008af0cde580b326
1073fcae443e417b082ac4a745454bdef1da1f7d
2022-03-31T02:05:01Z
java
2022-03-31T13:10:09Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumer.java
} catch (Exception e) { logger.error("dispatcher task error", e); } } } /** * batch dispatch with thread pool */ private List<TaskPriority> batchDispatch(int fetchTaskNum) throws TaskPriorityQueueException, InterruptedException { List<TaskPriority> failedDispatchTasks = Collections.synchronizedList(new ArrayList<>()); CountDownLatch latch = new CountDownLatch(fetchTaskNum); for (int i = 0; i < fetchTaskNum; i++) { TaskPriority taskPriority = taskPriorityQueue.poll(Constants.SLEEP_TIME_MILLIS, TimeUnit.MILLISECONDS); if (Objects.isNull(taskPriority)) { latch.countDown(); continue; } consumerThreadPoolExecutor.submit(() -> { boolean dispatchResult = this.dispatchTask(taskPriority); if (!dispatchResult) { failedDispatchTasks.add(taskPriority); } latch.countDown(); }); } latch.await(); return failedDispatchTasks; } /** * dispatch task
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,295
[Bug] [Master] repeated submit task
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened ![image](https://user-images.githubusercontent.com/11962619/160961599-2e83ba72-d0d3-41af-b509-2edca70747ff.png) ### What you expected to happen every task submit once. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/160961554-35f7cf4a-720c-4e34-96aa-09d8fb602aec.png) ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9295
https://github.com/apache/dolphinscheduler/pull/9304
81f9b876f9f5865a7e65b668008af0cde580b326
1073fcae443e417b082ac4a745454bdef1da1f7d
2022-03-31T02:05:01Z
java
2022-03-31T13:10:09Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumer.java
* * @param taskPriority taskPriority * @return result */ protected boolean dispatchTask(TaskPriority taskPriority) { boolean result = false; try { TaskExecutionContext context = taskPriority.getTaskExecutionContext(); ExecutionContext executionContext = new ExecutionContext(toCommand(context), ExecutorType.WORKER, context.getWorkerGroup()); if (isTaskNeedToCheck(taskPriority)) { if (taskInstanceIsFinalState(taskPriority.getTaskId())) { return true; } } result = dispatcher.dispatch(executionContext); if (result) { addDispatchEvent(context, executionContext); } } catch (RuntimeException | ExecuteException e) { logger.error("dispatch error: {}", e.getMessage(), e); } return result; } /** * add dispatch event */ private void addDispatchEvent(TaskExecutionContext context, ExecutionContext executionContext) { TaskEvent taskEvent = TaskEvent.newDispatchEvent(context.getProcessInstanceId(), context.getTaskInstanceId(), executionContext.getHost().getAddress()); taskEventService.addEvent(taskEvent);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,295
[Bug] [Master] repeated submit task
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened ![image](https://user-images.githubusercontent.com/11962619/160961599-2e83ba72-d0d3-41af-b509-2edca70747ff.png) ### What you expected to happen every task submit once. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/160961554-35f7cf4a-720c-4e34-96aa-09d8fb602aec.png) ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9295
https://github.com/apache/dolphinscheduler/pull/9304
81f9b876f9f5865a7e65b668008af0cde580b326
1073fcae443e417b082ac4a745454bdef1da1f7d
2022-03-31T02:05:01Z
java
2022-03-31T13:10:09Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumer.java
} private Command toCommand(TaskExecutionContext taskExecutionContext) { TaskExecuteRequestCommand requestCommand = new TaskExecuteRequestCommand(); requestCommand.setTaskExecutionContext(JSONUtils.toJsonString(taskExecutionContext)); return requestCommand.convert2Command(); } /** * taskInstance is final state * success,failure,kill,stop,pause,threadwaiting is final state * * @param taskInstanceId taskInstanceId * @return taskInstance is final state */ public Boolean taskInstanceIsFinalState(int taskInstanceId) { TaskInstance taskInstance = processService.findTaskInstanceById(taskInstanceId); return taskInstance.getState().typeIsFinished(); } /** * check if task need to check state, if true, refresh the checkpoint */ private boolean isTaskNeedToCheck(TaskPriority taskPriority) { long now = System.currentTimeMillis(); if (now - taskPriority.getCheckpoint() > Constants.SECOND_TIME_MILLIS) { taskPriority.setCheckpoint(now); return true; } return false; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,295
[Bug] [Master] repeated submit task
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened ![image](https://user-images.githubusercontent.com/11962619/160961599-2e83ba72-d0d3-41af-b509-2edca70747ff.png) ### What you expected to happen every task submit once. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/160961554-35f7cf4a-720c-4e34-96aa-09d8fb602aec.png) ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9295
https://github.com/apache/dolphinscheduler/pull/9304
81f9b876f9f5865a7e65b668008af0cde580b326
1073fcae443e417b082ac4a745454bdef1da1f7d
2022-03-31T02:05:01Z
java
2022-03-31T13:10:09Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/processor/queue/TaskExecuteThreadPool.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.server.master.processor.queue; import org.apache.dolphinscheduler.server.master.cache.ProcessInstanceExecCacheManager; import org.apache.dolphinscheduler.server.master.config.MasterConfig; import org.apache.dolphinscheduler.server.master.runner.WorkflowExecuteThreadPool; import org.apache.dolphinscheduler.server.utils.DataQualityResultOperator; import org.apache.dolphinscheduler.service.process.ProcessService; import java.util.concurrent.ConcurrentHashMap; import javax.annotation.PostConstruct; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.stereotype.Component;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,295
[Bug] [Master] repeated submit task
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened ![image](https://user-images.githubusercontent.com/11962619/160961599-2e83ba72-d0d3-41af-b509-2edca70747ff.png) ### What you expected to happen every task submit once. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/160961554-35f7cf4a-720c-4e34-96aa-09d8fb602aec.png) ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9295
https://github.com/apache/dolphinscheduler/pull/9304
81f9b876f9f5865a7e65b668008af0cde580b326
1073fcae443e417b082ac4a745454bdef1da1f7d
2022-03-31T02:05:01Z
java
2022-03-31T13:10:09Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/processor/queue/TaskExecuteThreadPool.java
import org.springframework.util.concurrent.ListenableFuture; import org.springframework.util.concurrent.ListenableFutureCallback; @Component public class TaskExecuteThreadPool extends ThreadPoolTaskExecutor { private static final Logger logger = LoggerFactory.getLogger(TaskExecuteThreadPool.class); private final ConcurrentHashMap<String, TaskExecuteThread> multiThreadFilterMap = new ConcurrentHashMap<>(); @Autowired private MasterConfig masterConfig; @Autowired private ProcessInstanceExecCacheManager processInstanceExecCacheManager; /** * process service */ @Autowired private ProcessService processService; /** * data quality result operator */ @Autowired private DataQualityResultOperator dataQualityResultOperator; @Autowired private WorkflowExecuteThreadPool workflowExecuteThreadPool; /** * task event thread map */ private final ConcurrentHashMap<Integer, TaskExecuteThread> taskExecuteThreadMap = new ConcurrentHashMap<>(); @PostConstruct private void init() { this.setDaemon(true); this.setThreadNamePrefix("Task-Execute-Thread-");
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,295
[Bug] [Master] repeated submit task
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened ![image](https://user-images.githubusercontent.com/11962619/160961599-2e83ba72-d0d3-41af-b509-2edca70747ff.png) ### What you expected to happen every task submit once. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/160961554-35f7cf4a-720c-4e34-96aa-09d8fb602aec.png) ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9295
https://github.com/apache/dolphinscheduler/pull/9304
81f9b876f9f5865a7e65b668008af0cde580b326
1073fcae443e417b082ac4a745454bdef1da1f7d
2022-03-31T02:05:01Z
java
2022-03-31T13:10:09Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/processor/queue/TaskExecuteThreadPool.java
this.setMaxPoolSize(masterConfig.getExecThreads()); this.setCorePoolSize(masterConfig.getExecThreads()); } public void submitTaskEvent(TaskEvent taskEvent) { if (!processInstanceExecCacheManager.contains(taskEvent.getProcessInstanceId())) { logger.warn("workflowExecuteThread is null, event: {}", taskEvent); return; } if (!taskExecuteThreadMap.containsKey(taskEvent.getProcessInstanceId())) { TaskExecuteThread taskExecuteThread = new TaskExecuteThread( taskEvent.getProcessInstanceId(), processService, workflowExecuteThreadPool, processInstanceExecCacheManager, dataQualityResultOperator); taskExecuteThreadMap.put(taskEvent.getProcessInstanceId(), taskExecuteThread); } TaskExecuteThread taskExecuteThread = taskExecuteThreadMap.get(taskEvent.getProcessInstanceId()); if (taskExecuteThread != null) { taskExecuteThread.addEvent(taskEvent); } } public void eventHandler() { for (TaskExecuteThread taskExecuteThread: taskExecuteThreadMap.values()) { executeEvent(taskExecuteThread); } } public void executeEvent(TaskExecuteThread taskExecuteThread) { if (taskExecuteThread.eventSize() == 0) { return; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,295
[Bug] [Master] repeated submit task
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened ![image](https://user-images.githubusercontent.com/11962619/160961599-2e83ba72-d0d3-41af-b509-2edca70747ff.png) ### What you expected to happen every task submit once. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/160961554-35f7cf4a-720c-4e34-96aa-09d8fb602aec.png) ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9295
https://github.com/apache/dolphinscheduler/pull/9304
81f9b876f9f5865a7e65b668008af0cde580b326
1073fcae443e417b082ac4a745454bdef1da1f7d
2022-03-31T02:05:01Z
java
2022-03-31T13:10:09Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/processor/queue/TaskExecuteThreadPool.java
if (multiThreadFilterMap.containsKey(taskExecuteThread.getKey())) { return; } ListenableFuture future = this.submitListenable(() -> { taskExecuteThread.run(); multiThreadFilterMap.put(taskExecuteThread.getKey(), taskExecuteThread); }); future.addCallback(new ListenableFutureCallback() { @Override public void onFailure(Throwable ex) { logger.error("handle event {} failed: {}", taskExecuteThread.getProcessInstanceId(), ex); if (!processInstanceExecCacheManager.contains(taskExecuteThread.getProcessInstanceId())) { taskExecuteThreadMap.remove(taskExecuteThread.getProcessInstanceId()); logger.info("remove process instance: {}", taskExecuteThread.getProcessInstanceId()); } multiThreadFilterMap.remove(taskExecuteThread.getKey()); } @Override public void onSuccess(Object result) { logger.info("persist events {} succeeded.", taskExecuteThread.getProcessInstanceId()); if (!processInstanceExecCacheManager.contains(taskExecuteThread.getProcessInstanceId())) { taskExecuteThreadMap.remove(taskExecuteThread.getProcessInstanceId()); logger.info("remove process instance: {}", taskExecuteThread.getProcessInstanceId()); } multiThreadFilterMap.remove(taskExecuteThread.getKey()); } }); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,295
[Bug] [Master] repeated submit task
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened ![image](https://user-images.githubusercontent.com/11962619/160961599-2e83ba72-d0d3-41af-b509-2edca70747ff.png) ### What you expected to happen every task submit once. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/160961554-35f7cf4a-720c-4e34-96aa-09d8fb602aec.png) ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9295
https://github.com/apache/dolphinscheduler/pull/9304
81f9b876f9f5865a7e65b668008af0cde580b326
1073fcae443e417b082ac4a745454bdef1da1f7d
2022-03-31T02:05:01Z
java
2022-03-31T13:10:09Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThreadPool.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.server.master.runner; import org.apache.dolphinscheduler.common.enums.Flag; import org.apache.dolphinscheduler.common.enums.StateEvent; import org.apache.dolphinscheduler.common.enums.StateEventType;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,295
[Bug] [Master] repeated submit task
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened ![image](https://user-images.githubusercontent.com/11962619/160961599-2e83ba72-d0d3-41af-b509-2edca70747ff.png) ### What you expected to happen every task submit once. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/160961554-35f7cf4a-720c-4e34-96aa-09d8fb602aec.png) ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9295
https://github.com/apache/dolphinscheduler/pull/9304
81f9b876f9f5865a7e65b668008af0cde580b326
1073fcae443e417b082ac4a745454bdef1da1f7d
2022-03-31T02:05:01Z
java
2022-03-31T13:10:09Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThreadPool.java
import org.apache.dolphinscheduler.common.utils.NetUtils; import org.apache.dolphinscheduler.dao.entity.ProcessInstance; import org.apache.dolphinscheduler.dao.entity.TaskInstance; import org.apache.dolphinscheduler.plugin.task.api.enums.ExecutionStatus; import org.apache.dolphinscheduler.remote.command.StateEventChangeCommand; import org.apache.dolphinscheduler.remote.processor.StateEventCallbackService; import org.apache.dolphinscheduler.server.master.cache.ProcessInstanceExecCacheManager; import org.apache.dolphinscheduler.server.master.config.MasterConfig; import org.apache.dolphinscheduler.service.process.ProcessService; import org.apache.commons.lang.StringUtils; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import javax.annotation.PostConstruct; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.stereotype.Component; import org.springframework.util.concurrent.ListenableFuture; import org.springframework.util.concurrent.ListenableFutureCallback; @Component public class WorkflowExecuteThreadPool extends ThreadPoolTaskExecutor { private static final Logger logger = LoggerFactory.getLogger(WorkflowExecuteThreadPool.class); @Autowired private MasterConfig masterConfig; @Autowired private ProcessService processService; @Autowired private ProcessInstanceExecCacheManager processInstanceExecCacheManager; @Autowired
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,295
[Bug] [Master] repeated submit task
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened ![image](https://user-images.githubusercontent.com/11962619/160961599-2e83ba72-d0d3-41af-b509-2edca70747ff.png) ### What you expected to happen every task submit once. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/160961554-35f7cf4a-720c-4e34-96aa-09d8fb602aec.png) ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9295
https://github.com/apache/dolphinscheduler/pull/9304
81f9b876f9f5865a7e65b668008af0cde580b326
1073fcae443e417b082ac4a745454bdef1da1f7d
2022-03-31T02:05:01Z
java
2022-03-31T13:10:09Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThreadPool.java
private StateEventCallbackService stateEventCallbackService; @Autowired private StateWheelExecuteThread stateWheelExecuteThread; /** * multi-thread filter, avoid handling workflow at the same time */ private ConcurrentHashMap<String, WorkflowExecuteThread> multiThreadFilterMap = new ConcurrentHashMap(); @PostConstruct private void init() { this.setDaemon(true); this.setThreadNamePrefix("Workflow-Execute-Thread-"); this.setMaxPoolSize(masterConfig.getExecThreads()); this.setCorePoolSize(masterConfig.getExecThreads()); } /** * submit state event */ public void submitStateEvent(StateEvent stateEvent) { WorkflowExecuteThread workflowExecuteThread = processInstanceExecCacheManager.getByProcessInstanceId(stateEvent.getProcessInstanceId()); if (workflowExecuteThread == null) { logger.warn("workflowExecuteThread is null, stateEvent:{}", stateEvent); return; } workflowExecuteThread.addStateEvent(stateEvent); } /** * start workflow */ public void startWorkflow(WorkflowExecuteThread workflowExecuteThread) { submit(workflowExecuteThread::startProcess);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,295
[Bug] [Master] repeated submit task
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened ![image](https://user-images.githubusercontent.com/11962619/160961599-2e83ba72-d0d3-41af-b509-2edca70747ff.png) ### What you expected to happen every task submit once. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/160961554-35f7cf4a-720c-4e34-96aa-09d8fb602aec.png) ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9295
https://github.com/apache/dolphinscheduler/pull/9304
81f9b876f9f5865a7e65b668008af0cde580b326
1073fcae443e417b082ac4a745454bdef1da1f7d
2022-03-31T02:05:01Z
java
2022-03-31T13:10:09Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThreadPool.java
} /** * execute workflow */ public void executeEvent(WorkflowExecuteThread workflowExecuteThread) { if (!workflowExecuteThread.isStart() || workflowExecuteThread.eventSize() == 0) { return; } if (multiThreadFilterMap.containsKey(workflowExecuteThread.getKey())) { return; } int processInstanceId = workflowExecuteThread.getProcessInstance().getId(); ListenableFuture future = this.submitListenable(() -> { workflowExecuteThread.handleEvents(); multiThreadFilterMap.put(workflowExecuteThread.getKey(), workflowExecuteThread); }); future.addCallback(new ListenableFutureCallback() { @Override public void onFailure(Throwable ex) { logger.error("handle events {} failed", processInstanceId, ex); multiThreadFilterMap.remove(workflowExecuteThread.getKey()); } @Override public void onSuccess(Object result) { try { if (workflowExecuteThread.workFlowFinish()) { stateWheelExecuteThread.removeProcess4TimeoutCheck(workflowExecuteThread.getProcessInstance()); processInstanceExecCacheManager.removeByProcessInstanceId(processInstanceId);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,295
[Bug] [Master] repeated submit task
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened ![image](https://user-images.githubusercontent.com/11962619/160961599-2e83ba72-d0d3-41af-b509-2edca70747ff.png) ### What you expected to happen every task submit once. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/160961554-35f7cf4a-720c-4e34-96aa-09d8fb602aec.png) ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9295
https://github.com/apache/dolphinscheduler/pull/9304
81f9b876f9f5865a7e65b668008af0cde580b326
1073fcae443e417b082ac4a745454bdef1da1f7d
2022-03-31T02:05:01Z
java
2022-03-31T13:10:09Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThreadPool.java
notifyProcessChanged(workflowExecuteThread.getProcessInstance()); logger.info("process instance {} finished.", processInstanceId); } } catch (Exception e) { logger.error("handle events {} success, but notify changed error", processInstanceId, e); } multiThreadFilterMap.remove(workflowExecuteThread.getKey()); } }); } /** * notify process change */ private void notifyProcessChanged(ProcessInstance finishProcessInstance) { if (Flag.NO == finishProcessInstance.getIsSubProcess()) { return; } Map<ProcessInstance, TaskInstance> fatherMaps = processService.notifyProcessList(finishProcessInstance.getId()); for (ProcessInstance processInstance : fatherMaps.keySet()) { String address = NetUtils.getAddr(masterConfig.getListenPort()); if (processInstance.getHost().equalsIgnoreCase(address)) { this.notifyMyself(processInstance, fatherMaps.get(processInstance)); } else { this.notifyProcess(finishProcessInstance, processInstance, fatherMaps.get(processInstance)); } } } /** * notify myself */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,295
[Bug] [Master] repeated submit task
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened ![image](https://user-images.githubusercontent.com/11962619/160961599-2e83ba72-d0d3-41af-b509-2edca70747ff.png) ### What you expected to happen every task submit once. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/160961554-35f7cf4a-720c-4e34-96aa-09d8fb602aec.png) ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9295
https://github.com/apache/dolphinscheduler/pull/9304
81f9b876f9f5865a7e65b668008af0cde580b326
1073fcae443e417b082ac4a745454bdef1da1f7d
2022-03-31T02:05:01Z
java
2022-03-31T13:10:09Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThreadPool.java
private void notifyMyself(ProcessInstance processInstance, TaskInstance taskInstance) { logger.info("notify process {} task {} state change", processInstance.getId(), taskInstance.getId()); if (!processInstanceExecCacheManager.contains(processInstance.getId())) { return; } StateEvent stateEvent = new StateEvent(); stateEvent.setTaskInstanceId(taskInstance.getId()); stateEvent.setType(StateEventType.TASK_STATE_CHANGE); stateEvent.setProcessInstanceId(processInstance.getId()); stateEvent.setExecutionStatus(ExecutionStatus.RUNNING_EXECUTION); this.submitStateEvent(stateEvent); } /** * notify process's master */ private void notifyProcess(ProcessInstance finishProcessInstance, ProcessInstance processInstance, TaskInstance taskInstance) { String host = processInstance.getHost(); if (StringUtils.isEmpty(host)) { logger.error("process {} host is empty, cannot notify task {} now", processInstance.getId(), taskInstance.getId()); return; } String address = host.split(":")[0]; int port = Integer.parseInt(host.split(":")[1]); StateEventChangeCommand stateEventChangeCommand = new StateEventChangeCommand( finishProcessInstance.getId(), 0, finishProcessInstance.getState(), processInstance.getId(), taskInstance.getId() ); stateEventCallbackService.sendResult(address, port, stateEventChangeCommand.convert2Command()); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,065
[Bug] [Master] When there is only one task and the submit failed, the state of Process Instance is Incorrect
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened BG : The Process Instance have only one task In the method of `submitPostNode`, the task successfully added to `readyToSubmitTaskQueue`, then submit task from queue, if submit failed, such as DB error, the `taskFailedSubmit` is true and `readyToSubmitTaskQueue` size is not empty. when execute the method of `updateProcessInstanceState`, case one: FailureStrategy is END, it return state of `FAILURE`, and update state; case two: FailureStrategy is CONTINUE, it return state of `RUNNING_EXECUTION`, and remain the same state forever; More seriously, both cases will cause `processInstanceExecCacheManager` not remove `WorkflowExecuteThread` ![image](https://user-images.githubusercontent.com/29919212/159254253-7d306b96-3a26-4b40-9fd7-1875a4404dec.png) ![image](https://user-images.githubusercontent.com/29919212/159262647-67b8351f-8073-4de3-8e60-dfe9e4c53d2a.png) ### What you expected to happen the process instance can update the state normally and can terminate normally. I hope it will be resolved in v2.0.6 ### How to reproduce Refer to `What happened` ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9065
https://github.com/apache/dolphinscheduler/pull/9186
6b2a4e31eadf707272381ced26a81eaa557e60c0
3e5781b6e1c38675ba134048b21941be63723cb6
2022-03-21T12:46:10Z
java
2022-04-01T14:23:35Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
/* * Lcensed to the Apache Software Foundaton (ASF) under one or more * contrbutor lcense agreements. See the NOTICE fle dstrbuted wth * ths work for addtonal nformaton regardng copyrght ownershp. * The ASF lcenses ths fle to You under the Apache Lcense, Verson 2.0 * (the "Lcense"); you may not use ths fle except n complance wth * the Lcense. You may obtan a copy of the Lcense at * * http://www.apache.org/lcenses/LICENSE-2.0
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,065
[Bug] [Master] When there is only one task and the submit failed, the state of Process Instance is Incorrect
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened BG : The Process Instance have only one task In the method of `submitPostNode`, the task successfully added to `readyToSubmitTaskQueue`, then submit task from queue, if submit failed, such as DB error, the `taskFailedSubmit` is true and `readyToSubmitTaskQueue` size is not empty. when execute the method of `updateProcessInstanceState`, case one: FailureStrategy is END, it return state of `FAILURE`, and update state; case two: FailureStrategy is CONTINUE, it return state of `RUNNING_EXECUTION`, and remain the same state forever; More seriously, both cases will cause `processInstanceExecCacheManager` not remove `WorkflowExecuteThread` ![image](https://user-images.githubusercontent.com/29919212/159254253-7d306b96-3a26-4b40-9fd7-1875a4404dec.png) ![image](https://user-images.githubusercontent.com/29919212/159262647-67b8351f-8073-4de3-8e60-dfe9e4c53d2a.png) ### What you expected to happen the process instance can update the state normally and can terminate normally. I hope it will be resolved in v2.0.6 ### How to reproduce Refer to `What happened` ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9065
https://github.com/apache/dolphinscheduler/pull/9186
6b2a4e31eadf707272381ced26a81eaa557e60c0
3e5781b6e1c38675ba134048b21941be63723cb6
2022-03-21T12:46:10Z
java
2022-04-01T14:23:35Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
* * Unless requred by applcable law or agreed to n wrtng, software * dstrbuted under the Lcense s dstrbuted on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, ether express or mpled. * See the Lcense for the specfc language governng permssons and * lmtatons under the Lcense. */ package org.apache.dolphnscheduler.server.master.runner; mport com.google.common.collect.Lsts; mport org.apache.commons.collectons.CollectonUtls; mport org.apache.commons.lang.StrngUtls; mport org.apache.commons.lang.math.NumberUtls; mport org.apache.dolphnscheduler.common.Constants; mport org.apache.dolphnscheduler.common.enums.CommandType; mport org.apache.dolphnscheduler.common.enums.FalureStrategy; mport org.apache.dolphnscheduler.common.enums.Flag; mport org.apache.dolphnscheduler.common.enums.Prorty; mport org.apache.dolphnscheduler.common.enums.StateEvent; mport org.apache.dolphnscheduler.common.enums.StateEventType; mport org.apache.dolphnscheduler.common.enums.TaskDependType; mport org.apache.dolphnscheduler.common.enums.TaskGroupQueueStatus; mport org.apache.dolphnscheduler.common.enums.TmeoutFlag; mport org.apache.dolphnscheduler.common.graph.DAG; mport org.apache.dolphnscheduler.common.model.TaskNode; mport org.apache.dolphnscheduler.common.model.TaskNodeRelaton; mport org.apache.dolphnscheduler.common.process.ProcessDag; mport org.apache.dolphnscheduler.common.utls.DateUtls; mport org.apache.dolphnscheduler.common.utls.JSONUtls; mport org.apache.dolphnscheduler.common.utls.NetUtls; mport org.apache.dolphnscheduler.common.utls.ParameterUtls;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,065
[Bug] [Master] When there is only one task and the submit failed, the state of Process Instance is Incorrect
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened BG : The Process Instance have only one task In the method of `submitPostNode`, the task successfully added to `readyToSubmitTaskQueue`, then submit task from queue, if submit failed, such as DB error, the `taskFailedSubmit` is true and `readyToSubmitTaskQueue` size is not empty. when execute the method of `updateProcessInstanceState`, case one: FailureStrategy is END, it return state of `FAILURE`, and update state; case two: FailureStrategy is CONTINUE, it return state of `RUNNING_EXECUTION`, and remain the same state forever; More seriously, both cases will cause `processInstanceExecCacheManager` not remove `WorkflowExecuteThread` ![image](https://user-images.githubusercontent.com/29919212/159254253-7d306b96-3a26-4b40-9fd7-1875a4404dec.png) ![image](https://user-images.githubusercontent.com/29919212/159262647-67b8351f-8073-4de3-8e60-dfe9e4c53d2a.png) ### What you expected to happen the process instance can update the state normally and can terminate normally. I hope it will be resolved in v2.0.6 ### How to reproduce Refer to `What happened` ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9065
https://github.com/apache/dolphinscheduler/pull/9186
6b2a4e31eadf707272381ced26a81eaa557e60c0
3e5781b6e1c38675ba134048b21941be63723cb6
2022-03-21T12:46:10Z
java
2022-04-01T14:23:35Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
mport org.apache.dolphnscheduler.dao.entty.Command; mport org.apache.dolphnscheduler.dao.entty.Envronment; mport org.apache.dolphnscheduler.dao.entty.ProcessDefnton; mport org.apache.dolphnscheduler.dao.entty.ProcessInstance; mport org.apache.dolphnscheduler.dao.entty.ProcessTaskRelaton; mport org.apache.dolphnscheduler.dao.entty.ProjectUser; mport org.apache.dolphnscheduler.dao.entty.Schedule; mport org.apache.dolphnscheduler.dao.entty.TaskDefntonLog; mport org.apache.dolphnscheduler.dao.entty.TaskGroupQueue; mport org.apache.dolphnscheduler.dao.entty.TaskInstance; mport org.apache.dolphnscheduler.dao.utls.DagHelper; mport org.apache.dolphnscheduler.plugn.task.ap.enums.DependResult; mport org.apache.dolphnscheduler.plugn.task.ap.enums.Drect; mport org.apache.dolphnscheduler.plugn.task.ap.enums.ExecutonStatus; mport org.apache.dolphnscheduler.plugn.task.ap.enums.TaskTmeoutStrategy; mport org.apache.dolphnscheduler.plugn.task.ap.model.Property; mport org.apache.dolphnscheduler.plugn.task.ap.parameters.BlockngParameters; mport org.apache.dolphnscheduler.remote.command.HostUpdateCommand; mport org.apache.dolphnscheduler.remote.utls.Host; mport org.apache.dolphnscheduler.server.master.confg.MasterConfg; mport org.apache.dolphnscheduler.server.master.dspatch.executor.NettyExecutorManager; mport org.apache.dolphnscheduler.server.master.runner.task.ITaskProcessor; mport org.apache.dolphnscheduler.server.master.runner.task.TaskActon; mport org.apache.dolphnscheduler.server.master.runner.task.TaskProcessorFactory; mport org.apache.dolphnscheduler.servce.alert.ProcessAlertManager; mport org.apache.dolphnscheduler.servce.process.ProcessServce; mport org.apache.dolphnscheduler.servce.quartz.cron.CronUtls; mport org.apache.dolphnscheduler.servce.queue.PeerTaskInstancePrortyQueue; mport org.slf4j.Logger; mport org.slf4j.LoggerFactory;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,065
[Bug] [Master] When there is only one task and the submit failed, the state of Process Instance is Incorrect
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened BG : The Process Instance have only one task In the method of `submitPostNode`, the task successfully added to `readyToSubmitTaskQueue`, then submit task from queue, if submit failed, such as DB error, the `taskFailedSubmit` is true and `readyToSubmitTaskQueue` size is not empty. when execute the method of `updateProcessInstanceState`, case one: FailureStrategy is END, it return state of `FAILURE`, and update state; case two: FailureStrategy is CONTINUE, it return state of `RUNNING_EXECUTION`, and remain the same state forever; More seriously, both cases will cause `processInstanceExecCacheManager` not remove `WorkflowExecuteThread` ![image](https://user-images.githubusercontent.com/29919212/159254253-7d306b96-3a26-4b40-9fd7-1875a4404dec.png) ![image](https://user-images.githubusercontent.com/29919212/159262647-67b8351f-8073-4de3-8e60-dfe9e4c53d2a.png) ### What you expected to happen the process instance can update the state normally and can terminate normally. I hope it will be resolved in v2.0.6 ### How to reproduce Refer to `What happened` ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9065
https://github.com/apache/dolphinscheduler/pull/9186
6b2a4e31eadf707272381ced26a81eaa557e60c0
3e5781b6e1c38675ba134048b21941be63723cb6
2022-03-21T12:46:10Z
java
2022-04-01T14:23:35Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
mport java.utl.ArrayLst; mport java.utl.Arrays; mport java.utl.Collecton; mport java.utl.Date; mport java.utl.HashMap; mport java.utl.Iterator; mport java.utl.Lst; mport java.utl.Map; mport java.utl.Map.Entry; mport java.utl.Objects; mport java.utl.Set; mport java.utl.concurrent.ConcurrentHashMap; mport java.utl.concurrent.ConcurrentLnkedQueue; mport java.utl.concurrent.atomc.AtomcBoolean; mport java.utl.stream.Collectors; mport statc org.apache.dolphnscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_END_DATE; mport statc org.apache.dolphnscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_START_DATE; mport statc org.apache.dolphnscheduler.common.Constants.CMD_PARAM_RECOVERY_START_NODE_STRING; mport statc org.apache.dolphnscheduler.common.Constants.CMD_PARAM_RECOVER_PROCESS_ID_STRING; mport statc org.apache.dolphnscheduler.common.Constants.CMD_PARAM_START_NODES; mport statc org.apache.dolphnscheduler.common.Constants.DEFAULT_WORKER_GROUP; mport statc org.apache.dolphnscheduler.plugn.task.ap.TaskConstants.TASK_TYPE_BLOCKING; /** * master exec thread,splt dag */ publc class WorkflowExecuteThread { /** * logger of WorkflowExecuteThread */ prvate statc fnal Logger logger = LoggerFactory.getLogger(WorkflowExecuteThread.class);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,065
[Bug] [Master] When there is only one task and the submit failed, the state of Process Instance is Incorrect
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened BG : The Process Instance have only one task In the method of `submitPostNode`, the task successfully added to `readyToSubmitTaskQueue`, then submit task from queue, if submit failed, such as DB error, the `taskFailedSubmit` is true and `readyToSubmitTaskQueue` size is not empty. when execute the method of `updateProcessInstanceState`, case one: FailureStrategy is END, it return state of `FAILURE`, and update state; case two: FailureStrategy is CONTINUE, it return state of `RUNNING_EXECUTION`, and remain the same state forever; More seriously, both cases will cause `processInstanceExecCacheManager` not remove `WorkflowExecuteThread` ![image](https://user-images.githubusercontent.com/29919212/159254253-7d306b96-3a26-4b40-9fd7-1875a4404dec.png) ![image](https://user-images.githubusercontent.com/29919212/159262647-67b8351f-8073-4de3-8e60-dfe9e4c53d2a.png) ### What you expected to happen the process instance can update the state normally and can terminate normally. I hope it will be resolved in v2.0.6 ### How to reproduce Refer to `What happened` ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9065
https://github.com/apache/dolphinscheduler/pull/9186
6b2a4e31eadf707272381ced26a81eaa557e60c0
3e5781b6e1c38675ba134048b21941be63723cb6
2022-03-21T12:46:10Z
java
2022-04-01T14:23:35Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
/** * master confg */ prvate MasterConfg masterConfg; /** * process servce */ prvate ProcessServce processServce; /** * alert manager */ prvate ProcessAlertManager processAlertManager; /** * netty executor manager */ prvate NettyExecutorManager nettyExecutorManager; /** * process nstance */ prvate ProcessInstance processInstance; /** * process defnton */ prvate ProcessDefnton processDefnton; /** * the object of DAG */ prvate DAG<Strng, TaskNode, TaskNodeRelaton> dag; /** * key of workflow
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,065
[Bug] [Master] When there is only one task and the submit failed, the state of Process Instance is Incorrect
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened BG : The Process Instance have only one task In the method of `submitPostNode`, the task successfully added to `readyToSubmitTaskQueue`, then submit task from queue, if submit failed, such as DB error, the `taskFailedSubmit` is true and `readyToSubmitTaskQueue` size is not empty. when execute the method of `updateProcessInstanceState`, case one: FailureStrategy is END, it return state of `FAILURE`, and update state; case two: FailureStrategy is CONTINUE, it return state of `RUNNING_EXECUTION`, and remain the same state forever; More seriously, both cases will cause `processInstanceExecCacheManager` not remove `WorkflowExecuteThread` ![image](https://user-images.githubusercontent.com/29919212/159254253-7d306b96-3a26-4b40-9fd7-1875a4404dec.png) ![image](https://user-images.githubusercontent.com/29919212/159262647-67b8351f-8073-4de3-8e60-dfe9e4c53d2a.png) ### What you expected to happen the process instance can update the state normally and can terminate normally. I hope it will be resolved in v2.0.6 ### How to reproduce Refer to `What happened` ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9065
https://github.com/apache/dolphinscheduler/pull/9186
6b2a4e31eadf707272381ced26a81eaa557e60c0
3e5781b6e1c38675ba134048b21941be63723cb6
2022-03-21T12:46:10Z
java
2022-04-01T14:23:35Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
*/ prvate Strng key; /** * start flag, true: start nodes submt completely */ prvate boolean sStart = false; /** * submt falure nodes */ prvate boolean taskFaledSubmt = false; /** * task nstance hash map, taskId as key */ prvate Map<Integer, TaskInstance> taskInstanceMap = new ConcurrentHashMap<>(); /** * runnng taskProcessor, taskCode as key, taskProcessor as value * only on taskProcessor per taskCode */ prvate fnal Map<Long, ITaskProcessor> actveTaskProcessorMaps = new ConcurrentHashMap<>(); /** * vald task map, taskCode as key, taskId as value * n a DAG, only one taskInstance per taskCode s vald */ prvate Map<Long, Integer> valdTaskMap = new ConcurrentHashMap<>(); /** * error task map, taskCode as key, taskInstanceId as value * n a DAG, only one taskInstance per taskCode s vald */ prvate Map<Long, Integer> errorTaskMap = new ConcurrentHashMap<>(); /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,065
[Bug] [Master] When there is only one task and the submit failed, the state of Process Instance is Incorrect
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened BG : The Process Instance have only one task In the method of `submitPostNode`, the task successfully added to `readyToSubmitTaskQueue`, then submit task from queue, if submit failed, such as DB error, the `taskFailedSubmit` is true and `readyToSubmitTaskQueue` size is not empty. when execute the method of `updateProcessInstanceState`, case one: FailureStrategy is END, it return state of `FAILURE`, and update state; case two: FailureStrategy is CONTINUE, it return state of `RUNNING_EXECUTION`, and remain the same state forever; More seriously, both cases will cause `processInstanceExecCacheManager` not remove `WorkflowExecuteThread` ![image](https://user-images.githubusercontent.com/29919212/159254253-7d306b96-3a26-4b40-9fd7-1875a4404dec.png) ![image](https://user-images.githubusercontent.com/29919212/159262647-67b8351f-8073-4de3-8e60-dfe9e4c53d2a.png) ### What you expected to happen the process instance can update the state normally and can terminate normally. I hope it will be resolved in v2.0.6 ### How to reproduce Refer to `What happened` ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9065
https://github.com/apache/dolphinscheduler/pull/9186
6b2a4e31eadf707272381ced26a81eaa557e60c0
3e5781b6e1c38675ba134048b21941be63723cb6
2022-03-21T12:46:10Z
java
2022-04-01T14:23:35Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
* complete task map, taskCode as key, taskInstanceId as value * n a DAG, only one taskInstance per taskCode s vald */ prvate Map<Long, Integer> completeTaskMap = new ConcurrentHashMap<>(); /** * depend faled task map, taskCode as key, taskId as value */ prvate Map<Long, Integer> dependFaledTaskMap = new ConcurrentHashMap<>(); /** * forbdden task map, code as key */ prvate Map<Long, TaskNode> forbddenTaskMap = new ConcurrentHashMap<>(); /** * skp task map, code as key */ prvate Map<Strng, TaskNode> skpTaskNodeMap = new ConcurrentHashMap<>(); /** * complement date lst */ prvate Lst<Date> complementLstDate = Lsts.newLnkedLst(); /** * state event queue */ prvate ConcurrentLnkedQueue<StateEvent> stateEvents = new ConcurrentLnkedQueue<>(); /** * ready to submt task queue */ prvate PeerTaskInstancePrortyQueue readyToSubmtTaskQueue = new PeerTaskInstancePrortyQueue(); /** * wat to retry taskInstance map, taskCode as key, taskInstance as value
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,065
[Bug] [Master] When there is only one task and the submit failed, the state of Process Instance is Incorrect
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened BG : The Process Instance have only one task In the method of `submitPostNode`, the task successfully added to `readyToSubmitTaskQueue`, then submit task from queue, if submit failed, such as DB error, the `taskFailedSubmit` is true and `readyToSubmitTaskQueue` size is not empty. when execute the method of `updateProcessInstanceState`, case one: FailureStrategy is END, it return state of `FAILURE`, and update state; case two: FailureStrategy is CONTINUE, it return state of `RUNNING_EXECUTION`, and remain the same state forever; More seriously, both cases will cause `processInstanceExecCacheManager` not remove `WorkflowExecuteThread` ![image](https://user-images.githubusercontent.com/29919212/159254253-7d306b96-3a26-4b40-9fd7-1875a4404dec.png) ![image](https://user-images.githubusercontent.com/29919212/159262647-67b8351f-8073-4de3-8e60-dfe9e4c53d2a.png) ### What you expected to happen the process instance can update the state normally and can terminate normally. I hope it will be resolved in v2.0.6 ### How to reproduce Refer to `What happened` ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9065
https://github.com/apache/dolphinscheduler/pull/9186
6b2a4e31eadf707272381ced26a81eaa557e60c0
3e5781b6e1c38675ba134048b21941be63723cb6
2022-03-21T12:46:10Z
java
2022-04-01T14:23:35Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
* before retry, the taskInstance d s 0 */ prvate Map<Long, TaskInstance> watToRetryTaskInstanceMap = new ConcurrentHashMap<>(); /** * state wheel execute thread */ prvate StateWheelExecuteThread stateWheelExecuteThread; /** * constructor of WorkflowExecuteThread * * @param processInstance processInstance * @param processServce processServce * @param nettyExecutorManager nettyExecutorManager * @param processAlertManager processAlertManager * @param masterConfg masterConfg * @param stateWheelExecuteThread stateWheelExecuteThread */ publc WorkflowExecuteThread(ProcessInstance processInstance , ProcessServce processServce , NettyExecutorManager nettyExecutorManager , ProcessAlertManager processAlertManager , MasterConfg masterConfg , StateWheelExecuteThread stateWheelExecuteThread) { ths.processServce = processServce; ths.processInstance = processInstance; ths.masterConfg = masterConfg; ths.nettyExecutorManager = nettyExecutorManager; ths.processAlertManager = processAlertManager; ths.stateWheelExecuteThread = stateWheelExecuteThread; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,065
[Bug] [Master] When there is only one task and the submit failed, the state of Process Instance is Incorrect
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened BG : The Process Instance have only one task In the method of `submitPostNode`, the task successfully added to `readyToSubmitTaskQueue`, then submit task from queue, if submit failed, such as DB error, the `taskFailedSubmit` is true and `readyToSubmitTaskQueue` size is not empty. when execute the method of `updateProcessInstanceState`, case one: FailureStrategy is END, it return state of `FAILURE`, and update state; case two: FailureStrategy is CONTINUE, it return state of `RUNNING_EXECUTION`, and remain the same state forever; More seriously, both cases will cause `processInstanceExecCacheManager` not remove `WorkflowExecuteThread` ![image](https://user-images.githubusercontent.com/29919212/159254253-7d306b96-3a26-4b40-9fd7-1875a4404dec.png) ![image](https://user-images.githubusercontent.com/29919212/159262647-67b8351f-8073-4de3-8e60-dfe9e4c53d2a.png) ### What you expected to happen the process instance can update the state normally and can terminate normally. I hope it will be resolved in v2.0.6 ### How to reproduce Refer to `What happened` ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9065
https://github.com/apache/dolphinscheduler/pull/9186
6b2a4e31eadf707272381ced26a81eaa557e60c0
3e5781b6e1c38675ba134048b21941be63723cb6
2022-03-21T12:46:10Z
java
2022-04-01T14:23:35Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
/** * the process start nodes are submtted completely. */ publc boolean sStart() { return ths.sStart; } /** * handle event */ publc vod handleEvents() { f (!sStart) { return; } whle (!ths.stateEvents.sEmpty()) { try { StateEvent stateEvent = ths.stateEvents.peek(); f (stateEventHandler(stateEvent)) { ths.stateEvents.remove(stateEvent); } } catch (Excepton e) { logger.error("state handle error:", e); } } } publc Strng getKey() { f (StrngUtls.sNotEmpty(key) || ths.processDefnton == null) { return key; } key = Strng.format("%d_%d_%d",
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,065
[Bug] [Master] When there is only one task and the submit failed, the state of Process Instance is Incorrect
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened BG : The Process Instance have only one task In the method of `submitPostNode`, the task successfully added to `readyToSubmitTaskQueue`, then submit task from queue, if submit failed, such as DB error, the `taskFailedSubmit` is true and `readyToSubmitTaskQueue` size is not empty. when execute the method of `updateProcessInstanceState`, case one: FailureStrategy is END, it return state of `FAILURE`, and update state; case two: FailureStrategy is CONTINUE, it return state of `RUNNING_EXECUTION`, and remain the same state forever; More seriously, both cases will cause `processInstanceExecCacheManager` not remove `WorkflowExecuteThread` ![image](https://user-images.githubusercontent.com/29919212/159254253-7d306b96-3a26-4b40-9fd7-1875a4404dec.png) ![image](https://user-images.githubusercontent.com/29919212/159262647-67b8351f-8073-4de3-8e60-dfe9e4c53d2a.png) ### What you expected to happen the process instance can update the state normally and can terminate normally. I hope it will be resolved in v2.0.6 ### How to reproduce Refer to `What happened` ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9065
https://github.com/apache/dolphinscheduler/pull/9186
6b2a4e31eadf707272381ced26a81eaa557e60c0
3e5781b6e1c38675ba134048b21941be63723cb6
2022-03-21T12:46:10Z
java
2022-04-01T14:23:35Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
ths.processDefnton.getCode(), ths.processDefnton.getVerson(), ths.processInstance.getId()); return key; } publc boolean addStateEvent(StateEvent stateEvent) { f (processInstance.getId() != stateEvent.getProcessInstanceId()) { logger.nfo("state event would be abounded :{}", stateEvent.toStrng()); return false; } ths.stateEvents.add(stateEvent); return true; } publc nt eventSze() { return ths.stateEvents.sze(); } publc ProcessInstance getProcessInstance() { return ths.processInstance; } prvate boolean stateEventHandler(StateEvent stateEvent) { logger.nfo("process event: {}", stateEvent.toStrng()); f (!checkProcessInstance(stateEvent)) { return false; } boolean result = false; swtch (stateEvent.getType()) { case PROCESS_STATE_CHANGE: result = processStateChangeHandler(stateEvent); break; case TASK_STATE_CHANGE:
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,065
[Bug] [Master] When there is only one task and the submit failed, the state of Process Instance is Incorrect
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened BG : The Process Instance have only one task In the method of `submitPostNode`, the task successfully added to `readyToSubmitTaskQueue`, then submit task from queue, if submit failed, such as DB error, the `taskFailedSubmit` is true and `readyToSubmitTaskQueue` size is not empty. when execute the method of `updateProcessInstanceState`, case one: FailureStrategy is END, it return state of `FAILURE`, and update state; case two: FailureStrategy is CONTINUE, it return state of `RUNNING_EXECUTION`, and remain the same state forever; More seriously, both cases will cause `processInstanceExecCacheManager` not remove `WorkflowExecuteThread` ![image](https://user-images.githubusercontent.com/29919212/159254253-7d306b96-3a26-4b40-9fd7-1875a4404dec.png) ![image](https://user-images.githubusercontent.com/29919212/159262647-67b8351f-8073-4de3-8e60-dfe9e4c53d2a.png) ### What you expected to happen the process instance can update the state normally and can terminate normally. I hope it will be resolved in v2.0.6 ### How to reproduce Refer to `What happened` ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9065
https://github.com/apache/dolphinscheduler/pull/9186
6b2a4e31eadf707272381ced26a81eaa557e60c0
3e5781b6e1c38675ba134048b21941be63723cb6
2022-03-21T12:46:10Z
java
2022-04-01T14:23:35Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
result = taskStateChangeHandler(stateEvent); break; case PROCESS_TIMEOUT: result = processTmeout(); break; case TASK_TIMEOUT: result = taskTmeout(stateEvent); break; case WAIT_TASK_GROUP: result = checkForceStartAndWakeUp(stateEvent); break; case TASK_RETRY: result = taskRetryEventHandler(stateEvent); break; case PROCESS_BLOCKED: result = processBlockHandler(stateEvent); break; default: break; } f (result) { ths.stateEvents.remove(stateEvent); } return result; } prvate boolean checkForceStartAndWakeUp(StateEvent stateEvent) { TaskGroupQueue taskGroupQueue = ths.processServce.loadTaskGroupQueue(stateEvent.getTaskInstanceId()); f (taskGroupQueue.getForceStart() == Flag.YES.getCode()) { TaskInstance taskInstance = ths.processServce.fndTaskInstanceById(stateEvent.getTaskInstanceId()); ITaskProcessor taskProcessor = actveTaskProcessorMaps.get(taskInstance.getTaskCode());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,065
[Bug] [Master] When there is only one task and the submit failed, the state of Process Instance is Incorrect
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened BG : The Process Instance have only one task In the method of `submitPostNode`, the task successfully added to `readyToSubmitTaskQueue`, then submit task from queue, if submit failed, such as DB error, the `taskFailedSubmit` is true and `readyToSubmitTaskQueue` size is not empty. when execute the method of `updateProcessInstanceState`, case one: FailureStrategy is END, it return state of `FAILURE`, and update state; case two: FailureStrategy is CONTINUE, it return state of `RUNNING_EXECUTION`, and remain the same state forever; More seriously, both cases will cause `processInstanceExecCacheManager` not remove `WorkflowExecuteThread` ![image](https://user-images.githubusercontent.com/29919212/159254253-7d306b96-3a26-4b40-9fd7-1875a4404dec.png) ![image](https://user-images.githubusercontent.com/29919212/159262647-67b8351f-8073-4de3-8e60-dfe9e4c53d2a.png) ### What you expected to happen the process instance can update the state normally and can terminate normally. I hope it will be resolved in v2.0.6 ### How to reproduce Refer to `What happened` ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9065
https://github.com/apache/dolphinscheduler/pull/9186
6b2a4e31eadf707272381ced26a81eaa557e60c0
3e5781b6e1c38675ba134048b21941be63723cb6
2022-03-21T12:46:10Z
java
2022-04-01T14:23:35Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
ProcessInstance processInstance = ths.processServce.fndProcessInstanceById(taskInstance.getProcessInstanceId()); taskProcessor.nt(taskInstance, processInstance); taskProcessor.acton(TaskActon.DISPATCH); ths.processServce.updateTaskGroupQueueStatus(taskGroupQueue.getId(), TaskGroupQueueStatus.ACQUIRE_SUCCESS.getCode()); return true; } f (taskGroupQueue.getInQueue() == Flag.YES.getCode()) { boolean acqureTaskGroup = processServce.acqureTaskGroupAgan(taskGroupQueue); f (acqureTaskGroup) { TaskInstance taskInstance = ths.processServce.fndTaskInstanceById(stateEvent.getTaskInstanceId()); ITaskProcessor taskProcessor = actveTaskProcessorMaps.get(taskInstance.getTaskCode()); ProcessInstance processInstance = ths.processServce.fndProcessInstanceById(taskInstance.getProcessInstanceId()); taskProcessor.nt(taskInstance, processInstance); taskProcessor.acton(TaskActon.DISPATCH); return true; } } return false; } prvate boolean taskTmeout(StateEvent stateEvent) { f (!checkTaskInstanceByStateEvent(stateEvent)) { return true; } TaskInstance taskInstance = taskInstanceMap.get(stateEvent.getTaskInstanceId()); f (TmeoutFlag.CLOSE == taskInstance.getTaskDefne().getTmeoutFlag()) { return true; } TaskTmeoutStrategy taskTmeoutStrategy = taskInstance.getTaskDefne().getTmeoutNotfyStrategy(); f (TaskTmeoutStrategy.FAILED == taskTmeoutStrategy) { ITaskProcessor taskProcessor = actveTaskProcessorMaps.get(taskInstance.getTaskCode());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,065
[Bug] [Master] When there is only one task and the submit failed, the state of Process Instance is Incorrect
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened BG : The Process Instance have only one task In the method of `submitPostNode`, the task successfully added to `readyToSubmitTaskQueue`, then submit task from queue, if submit failed, such as DB error, the `taskFailedSubmit` is true and `readyToSubmitTaskQueue` size is not empty. when execute the method of `updateProcessInstanceState`, case one: FailureStrategy is END, it return state of `FAILURE`, and update state; case two: FailureStrategy is CONTINUE, it return state of `RUNNING_EXECUTION`, and remain the same state forever; More seriously, both cases will cause `processInstanceExecCacheManager` not remove `WorkflowExecuteThread` ![image](https://user-images.githubusercontent.com/29919212/159254253-7d306b96-3a26-4b40-9fd7-1875a4404dec.png) ![image](https://user-images.githubusercontent.com/29919212/159262647-67b8351f-8073-4de3-8e60-dfe9e4c53d2a.png) ### What you expected to happen the process instance can update the state normally and can terminate normally. I hope it will be resolved in v2.0.6 ### How to reproduce Refer to `What happened` ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9065
https://github.com/apache/dolphinscheduler/pull/9186
6b2a4e31eadf707272381ced26a81eaa557e60c0
3e5781b6e1c38675ba134048b21941be63723cb6
2022-03-21T12:46:10Z
java
2022-04-01T14:23:35Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
taskProcessor.acton(TaskActon.TIMEOUT); } else { ProjectUser projectUser = processServce.queryProjectWthUserByProcessInstanceId(processInstance.getId()); processAlertManager.sendTaskTmeoutAlert(processInstance, taskInstance, projectUser); } return true; } prvate boolean processTmeout() { ProjectUser projectUser = processServce.queryProjectWthUserByProcessInstanceId(processInstance.getId()); ths.processAlertManager.sendProcessTmeoutAlert(ths.processInstance, projectUser); return true; } prvate boolean taskStateChangeHandler(StateEvent stateEvent) { f (!checkTaskInstanceByStateEvent(stateEvent)) { return true; } TaskInstance task = getTaskInstance(stateEvent.getTaskInstanceId()); f (task.getState() == null) { logger.error("task state s null, state handler error: {}", stateEvent); return true; } f (task.getState().typeIsFnshed()) { f (completeTaskMap.contansKey(task.getTaskCode()) && completeTaskMap.get(task.getTaskCode()) == task.getId()) { return true; } taskFnshed(task); f (task.getTaskGroupId() > 0) { releaseTaskGroup(task); } return true;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,065
[Bug] [Master] When there is only one task and the submit failed, the state of Process Instance is Incorrect
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened BG : The Process Instance have only one task In the method of `submitPostNode`, the task successfully added to `readyToSubmitTaskQueue`, then submit task from queue, if submit failed, such as DB error, the `taskFailedSubmit` is true and `readyToSubmitTaskQueue` size is not empty. when execute the method of `updateProcessInstanceState`, case one: FailureStrategy is END, it return state of `FAILURE`, and update state; case two: FailureStrategy is CONTINUE, it return state of `RUNNING_EXECUTION`, and remain the same state forever; More seriously, both cases will cause `processInstanceExecCacheManager` not remove `WorkflowExecuteThread` ![image](https://user-images.githubusercontent.com/29919212/159254253-7d306b96-3a26-4b40-9fd7-1875a4404dec.png) ![image](https://user-images.githubusercontent.com/29919212/159262647-67b8351f-8073-4de3-8e60-dfe9e4c53d2a.png) ### What you expected to happen the process instance can update the state normally and can terminate normally. I hope it will be resolved in v2.0.6 ### How to reproduce Refer to `What happened` ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9065
https://github.com/apache/dolphinscheduler/pull/9186
6b2a4e31eadf707272381ced26a81eaa557e60c0
3e5781b6e1c38675ba134048b21941be63723cb6
2022-03-21T12:46:10Z
java
2022-04-01T14:23:35Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
} f (actveTaskProcessorMaps.contansKey(task.getTaskCode())) { ITaskProcessor TaskProcessor = actveTaskProcessorMaps.get(task.getTaskCode()); TaskProcessor.acton(TaskActon.RUN); f (TaskProcessor.taskInstance().getState().typeIsFnshed()) { f (TaskProcessor.taskInstance().getState() != task.getState()) { task.setState(TaskProcessor.taskInstance().getState()); } taskFnshed(task); } return true; } logger.error("state handler error: {}", stateEvent); return true; } prvate vod taskFnshed(TaskInstance taskInstance) { logger.nfo("work flow {} task d:{} code:{} state:{} ", processInstance.getId(), taskInstance.getId(), taskInstance.getTaskCode(), taskInstance.getState()); actveTaskProcessorMaps.remove(taskInstance.getTaskCode()); stateWheelExecuteThread.removeTask4TmeoutCheck(processInstance, taskInstance); stateWheelExecuteThread.removeTask4RetryCheck(processInstance, taskInstance); stateWheelExecuteThread.removeTask4StateCheck(processInstance, taskInstance); f (taskInstance.getState().typeIsSuccess()) { completeTaskMap.put(taskInstance.getTaskCode(), taskInstance.getId()); processServce.saveProcessInstance(processInstance); f (!processInstance.sBlocked()) { submtPostNode(Long.toStrng(taskInstance.getTaskCode()));
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,065
[Bug] [Master] When there is only one task and the submit failed, the state of Process Instance is Incorrect
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened BG : The Process Instance have only one task In the method of `submitPostNode`, the task successfully added to `readyToSubmitTaskQueue`, then submit task from queue, if submit failed, such as DB error, the `taskFailedSubmit` is true and `readyToSubmitTaskQueue` size is not empty. when execute the method of `updateProcessInstanceState`, case one: FailureStrategy is END, it return state of `FAILURE`, and update state; case two: FailureStrategy is CONTINUE, it return state of `RUNNING_EXECUTION`, and remain the same state forever; More seriously, both cases will cause `processInstanceExecCacheManager` not remove `WorkflowExecuteThread` ![image](https://user-images.githubusercontent.com/29919212/159254253-7d306b96-3a26-4b40-9fd7-1875a4404dec.png) ![image](https://user-images.githubusercontent.com/29919212/159262647-67b8351f-8073-4de3-8e60-dfe9e4c53d2a.png) ### What you expected to happen the process instance can update the state normally and can terminate normally. I hope it will be resolved in v2.0.6 ### How to reproduce Refer to `What happened` ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9065
https://github.com/apache/dolphinscheduler/pull/9186
6b2a4e31eadf707272381ced26a81eaa557e60c0
3e5781b6e1c38675ba134048b21941be63723cb6
2022-03-21T12:46:10Z
java
2022-04-01T14:23:35Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
} } else f (taskInstance.taskCanRetry() && processInstance.getState() != ExecutonStatus.READY_STOP) { retryTaskInstance(taskInstance); } else f (taskInstance.getState().typeIsFalure()) { completeTaskMap.put(taskInstance.getTaskCode(), taskInstance.getId()); f (taskInstance.sCondtonsTask() || DagHelper.haveCondtonsAfterNode(Long.toStrng(taskInstance.getTaskCode()), dag) || DagHelper.haveBlockngAfterNode(Long.toStrng(taskInstance.getTaskCode()), dag)) { submtPostNode(Long.toStrng(taskInstance.getTaskCode())); } else { errorTaskMap.put(taskInstance.getTaskCode(), taskInstance.getId()); f (processInstance.getFalureStrategy() == FalureStrategy.END) { kllAllTasks(); } } } else f (taskInstance.getState().typeIsFnshed()) { completeTaskMap.put(taskInstance.getTaskCode(), taskInstance.getId()); } ths.updateProcessInstanceState(); } /** * release task group * * @param taskInstance */ prvate vod releaseTaskGroup(TaskInstance taskInstance) { f (taskInstance.getTaskGroupId() > 0) { TaskInstance nextTaskInstance = ths.processServce.releaseTaskGroup(taskInstance); f (nextTaskInstance != null) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,065
[Bug] [Master] When there is only one task and the submit failed, the state of Process Instance is Incorrect
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened BG : The Process Instance have only one task In the method of `submitPostNode`, the task successfully added to `readyToSubmitTaskQueue`, then submit task from queue, if submit failed, such as DB error, the `taskFailedSubmit` is true and `readyToSubmitTaskQueue` size is not empty. when execute the method of `updateProcessInstanceState`, case one: FailureStrategy is END, it return state of `FAILURE`, and update state; case two: FailureStrategy is CONTINUE, it return state of `RUNNING_EXECUTION`, and remain the same state forever; More seriously, both cases will cause `processInstanceExecCacheManager` not remove `WorkflowExecuteThread` ![image](https://user-images.githubusercontent.com/29919212/159254253-7d306b96-3a26-4b40-9fd7-1875a4404dec.png) ![image](https://user-images.githubusercontent.com/29919212/159262647-67b8351f-8073-4de3-8e60-dfe9e4c53d2a.png) ### What you expected to happen the process instance can update the state normally and can terminate normally. I hope it will be resolved in v2.0.6 ### How to reproduce Refer to `What happened` ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9065
https://github.com/apache/dolphinscheduler/pull/9186
6b2a4e31eadf707272381ced26a81eaa557e60c0
3e5781b6e1c38675ba134048b21941be63723cb6
2022-03-21T12:46:10Z
java
2022-04-01T14:23:35Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
f (nextTaskInstance.getProcessInstanceId() == taskInstance.getProcessInstanceId()) { StateEvent nextEvent = new StateEvent(); nextEvent.setProcessInstanceId(ths.processInstance.getId()); nextEvent.setTaskInstanceId(nextTaskInstance.getId()); nextEvent.setType(StateEventType.WAIT_TASK_GROUP); ths.stateEvents.add(nextEvent); } else { ProcessInstance processInstance = ths.processServce.fndProcessInstanceById(nextTaskInstance.getProcessInstanceId()); ths.processServce.sendStartTask2Master(processInstance, nextTaskInstance.getId(), org.apache.dolphnscheduler.remote.command.CommandType.TASK_WAKEUP_EVENT_REQUEST); } } } } /** * crate new task nstance to retry, dfferent objects from the orgnal * * @param taskInstance */ prvate vod retryTaskInstance(TaskInstance taskInstance) { f (!taskInstance.taskCanRetry()) { return; } TaskInstance newTaskInstance = cloneRetryTaskInstance(taskInstance); f (newTaskInstance == null) { logger.error("retry fal, new taskInstancce s null, task code:{}, task d:{}", taskInstance.getTaskCode(), taskInstance.getId()); return; } watToRetryTaskInstanceMap.put(newTaskInstance.getTaskCode(), newTaskInstance); f (!taskInstance.retryTaskIntervalOverTme()) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,065
[Bug] [Master] When there is only one task and the submit failed, the state of Process Instance is Incorrect
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened BG : The Process Instance have only one task In the method of `submitPostNode`, the task successfully added to `readyToSubmitTaskQueue`, then submit task from queue, if submit failed, such as DB error, the `taskFailedSubmit` is true and `readyToSubmitTaskQueue` size is not empty. when execute the method of `updateProcessInstanceState`, case one: FailureStrategy is END, it return state of `FAILURE`, and update state; case two: FailureStrategy is CONTINUE, it return state of `RUNNING_EXECUTION`, and remain the same state forever; More seriously, both cases will cause `processInstanceExecCacheManager` not remove `WorkflowExecuteThread` ![image](https://user-images.githubusercontent.com/29919212/159254253-7d306b96-3a26-4b40-9fd7-1875a4404dec.png) ![image](https://user-images.githubusercontent.com/29919212/159262647-67b8351f-8073-4de3-8e60-dfe9e4c53d2a.png) ### What you expected to happen the process instance can update the state normally and can terminate normally. I hope it will be resolved in v2.0.6 ### How to reproduce Refer to `What happened` ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9065
https://github.com/apache/dolphinscheduler/pull/9186
6b2a4e31eadf707272381ced26a81eaa557e60c0
3e5781b6e1c38675ba134048b21941be63723cb6
2022-03-21T12:46:10Z
java
2022-04-01T14:23:35Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
logger.nfo("falure task wll be submtted: process d: {}, task nstance code: {} state:{} retry tmes:{} / {}, nterval:{}", processInstance.getId(), newTaskInstance.getTaskCode(), newTaskInstance.getState(), newTaskInstance.getRetryTmes(), newTaskInstance.getMaxRetryTmes(), newTaskInstance.getRetryInterval()); stateWheelExecuteThread.addTask4TmeoutCheck(processInstance, newTaskInstance); stateWheelExecuteThread.addTask4RetryCheck(processInstance, newTaskInstance); } else { addTaskToStandByLst(newTaskInstance); submtStandByTask(); watToRetryTaskInstanceMap.remove(newTaskInstance.getTaskCode()); } } /** * handle task retry event * * @param stateEvent * @return */ prvate boolean taskRetryEventHandler(StateEvent stateEvent) { TaskInstance taskInstance = watToRetryTaskInstanceMap.get(stateEvent.getTaskCode()); addTaskToStandByLst(taskInstance); submtStandByTask(); watToRetryTaskInstanceMap.remove(stateEvent.getTaskCode()); return true; } /** * update process nstance
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,065
[Bug] [Master] When there is only one task and the submit failed, the state of Process Instance is Incorrect
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened BG : The Process Instance have only one task In the method of `submitPostNode`, the task successfully added to `readyToSubmitTaskQueue`, then submit task from queue, if submit failed, such as DB error, the `taskFailedSubmit` is true and `readyToSubmitTaskQueue` size is not empty. when execute the method of `updateProcessInstanceState`, case one: FailureStrategy is END, it return state of `FAILURE`, and update state; case two: FailureStrategy is CONTINUE, it return state of `RUNNING_EXECUTION`, and remain the same state forever; More seriously, both cases will cause `processInstanceExecCacheManager` not remove `WorkflowExecuteThread` ![image](https://user-images.githubusercontent.com/29919212/159254253-7d306b96-3a26-4b40-9fd7-1875a4404dec.png) ![image](https://user-images.githubusercontent.com/29919212/159262647-67b8351f-8073-4de3-8e60-dfe9e4c53d2a.png) ### What you expected to happen the process instance can update the state normally and can terminate normally. I hope it will be resolved in v2.0.6 ### How to reproduce Refer to `What happened` ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9065
https://github.com/apache/dolphinscheduler/pull/9186
6b2a4e31eadf707272381ced26a81eaa557e60c0
3e5781b6e1c38675ba134048b21941be63723cb6
2022-03-21T12:46:10Z
java
2022-04-01T14:23:35Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
*/ publc vod refreshProcessInstance(nt processInstanceId) { logger.nfo("process nstance update: {}", processInstanceId); processInstance = processServce.fndProcessInstanceById(processInstanceId); processDefnton = processServce.fndProcessDefnton(processInstance.getProcessDefntonCode(), processInstance.getProcessDefntonVerson()); processInstance.setProcessDefnton(processDefnton); } /** * update task nstance */ publc vod refreshTaskInstance(nt taskInstanceId) { logger.nfo("task nstance update: {} ", taskInstanceId); TaskInstance taskInstance = processServce.fndTaskInstanceById(taskInstanceId); f (taskInstance == null) { logger.error("can not fnd task nstance, d:{}", taskInstanceId); return; } processServce.packageTaskInstance(taskInstance, processInstance); taskInstanceMap.put(taskInstance.getId(), taskInstance); valdTaskMap.remove(taskInstance.getTaskCode()); f (Flag.YES == taskInstance.getFlag()) { valdTaskMap.put(taskInstance.getTaskCode(), taskInstance.getId()); } } /** * check process nstance by state event */ publc boolean checkProcessInstance(StateEvent stateEvent) { f (ths.processInstance.getId() != stateEvent.getProcessInstanceId()) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,065
[Bug] [Master] When there is only one task and the submit failed, the state of Process Instance is Incorrect
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened BG : The Process Instance have only one task In the method of `submitPostNode`, the task successfully added to `readyToSubmitTaskQueue`, then submit task from queue, if submit failed, such as DB error, the `taskFailedSubmit` is true and `readyToSubmitTaskQueue` size is not empty. when execute the method of `updateProcessInstanceState`, case one: FailureStrategy is END, it return state of `FAILURE`, and update state; case two: FailureStrategy is CONTINUE, it return state of `RUNNING_EXECUTION`, and remain the same state forever; More seriously, both cases will cause `processInstanceExecCacheManager` not remove `WorkflowExecuteThread` ![image](https://user-images.githubusercontent.com/29919212/159254253-7d306b96-3a26-4b40-9fd7-1875a4404dec.png) ![image](https://user-images.githubusercontent.com/29919212/159262647-67b8351f-8073-4de3-8e60-dfe9e4c53d2a.png) ### What you expected to happen the process instance can update the state normally and can terminate normally. I hope it will be resolved in v2.0.6 ### How to reproduce Refer to `What happened` ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9065
https://github.com/apache/dolphinscheduler/pull/9186
6b2a4e31eadf707272381ced26a81eaa557e60c0
3e5781b6e1c38675ba134048b21941be63723cb6
2022-03-21T12:46:10Z
java
2022-04-01T14:23:35Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
logger.error("msmatch process nstance d: {}, state event:{}", ths.processInstance.getId(), stateEvent); return false; } return true; } /** * check f task nstance exst by state event */ publc boolean checkTaskInstanceByStateEvent(StateEvent stateEvent) { f (stateEvent.getTaskInstanceId() == 0) { logger.error("task nstance d null, state event:{}", stateEvent); return false; } f (!taskInstanceMap.contansKey(stateEvent.getTaskInstanceId())) { logger.error("msmatch task nstance d, event:{}", stateEvent); return false; } return true; } /** * check f task nstance exst by task code */ publc boolean checkTaskInstanceByCode(long taskCode) { f (taskInstanceMap == null || taskInstanceMap.sze() == 0) { return false; } for (TaskInstance taskInstance : taskInstanceMap.values()) { f (taskInstance.getTaskCode() == taskCode) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,065
[Bug] [Master] When there is only one task and the submit failed, the state of Process Instance is Incorrect
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened BG : The Process Instance have only one task In the method of `submitPostNode`, the task successfully added to `readyToSubmitTaskQueue`, then submit task from queue, if submit failed, such as DB error, the `taskFailedSubmit` is true and `readyToSubmitTaskQueue` size is not empty. when execute the method of `updateProcessInstanceState`, case one: FailureStrategy is END, it return state of `FAILURE`, and update state; case two: FailureStrategy is CONTINUE, it return state of `RUNNING_EXECUTION`, and remain the same state forever; More seriously, both cases will cause `processInstanceExecCacheManager` not remove `WorkflowExecuteThread` ![image](https://user-images.githubusercontent.com/29919212/159254253-7d306b96-3a26-4b40-9fd7-1875a4404dec.png) ![image](https://user-images.githubusercontent.com/29919212/159262647-67b8351f-8073-4de3-8e60-dfe9e4c53d2a.png) ### What you expected to happen the process instance can update the state normally and can terminate normally. I hope it will be resolved in v2.0.6 ### How to reproduce Refer to `What happened` ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9065
https://github.com/apache/dolphinscheduler/pull/9186
6b2a4e31eadf707272381ced26a81eaa557e60c0
3e5781b6e1c38675ba134048b21941be63723cb6
2022-03-21T12:46:10Z
java
2022-04-01T14:23:35Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
return true; } } return false; } /** * check f task nstance exst by d */ publc boolean checkTaskInstanceById(nt taskInstanceId) { f (taskInstanceMap == null || taskInstanceMap.sze() == 0) { return false; } return taskInstanceMap.contansKey(taskInstanceId); } /** * get task nstance from memory */ publc TaskInstance getTaskInstance(nt taskInstanceId) { f (taskInstanceMap.contansKey(taskInstanceId)) { return taskInstanceMap.get(taskInstanceId); } return null; } publc TaskInstance getActveTaskInstanceByTaskCode(long taskCode) { f (actveTaskProcessorMaps.contansKey(taskCode)) { return actveTaskProcessorMaps.get(taskCode).taskInstance(); } return null; } publc TaskInstance getRetryTaskInstanceByTaskCode(long taskCode) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,065
[Bug] [Master] When there is only one task and the submit failed, the state of Process Instance is Incorrect
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened BG : The Process Instance have only one task In the method of `submitPostNode`, the task successfully added to `readyToSubmitTaskQueue`, then submit task from queue, if submit failed, such as DB error, the `taskFailedSubmit` is true and `readyToSubmitTaskQueue` size is not empty. when execute the method of `updateProcessInstanceState`, case one: FailureStrategy is END, it return state of `FAILURE`, and update state; case two: FailureStrategy is CONTINUE, it return state of `RUNNING_EXECUTION`, and remain the same state forever; More seriously, both cases will cause `processInstanceExecCacheManager` not remove `WorkflowExecuteThread` ![image](https://user-images.githubusercontent.com/29919212/159254253-7d306b96-3a26-4b40-9fd7-1875a4404dec.png) ![image](https://user-images.githubusercontent.com/29919212/159262647-67b8351f-8073-4de3-8e60-dfe9e4c53d2a.png) ### What you expected to happen the process instance can update the state normally and can terminate normally. I hope it will be resolved in v2.0.6 ### How to reproduce Refer to `What happened` ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9065
https://github.com/apache/dolphinscheduler/pull/9186
6b2a4e31eadf707272381ced26a81eaa557e60c0
3e5781b6e1c38675ba134048b21941be63723cb6
2022-03-21T12:46:10Z
java
2022-04-01T14:23:35Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
f (watToRetryTaskInstanceMap.contansKey(taskCode)) { return watToRetryTaskInstanceMap.get(taskCode); } return null; } prvate boolean processStateChangeHandler(StateEvent stateEvent) { try { logger.nfo("process:{} state {} change to {}", processInstance.getId(), processInstance.getState(), stateEvent.getExecutonStatus()); f (stateEvent.getExecutonStatus() == ExecutonStatus.STOP) { ths.updateProcessInstanceState(stateEvent); return true; } f (processComplementData()) { return true; } f (stateEvent.getExecutonStatus().typeIsFnshed()) { endProcess(); } f (processInstance.getState() == ExecutonStatus.READY_STOP) { kllAllTasks(); } return true; } catch (Excepton e) { logger.error("process state change error:", e); } return true; } prvate boolean processBlockHandler(StateEvent stateEvent) { try { TaskInstance task = getTaskInstance(stateEvent.getTaskInstanceId());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,065
[Bug] [Master] When there is only one task and the submit failed, the state of Process Instance is Incorrect
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened BG : The Process Instance have only one task In the method of `submitPostNode`, the task successfully added to `readyToSubmitTaskQueue`, then submit task from queue, if submit failed, such as DB error, the `taskFailedSubmit` is true and `readyToSubmitTaskQueue` size is not empty. when execute the method of `updateProcessInstanceState`, case one: FailureStrategy is END, it return state of `FAILURE`, and update state; case two: FailureStrategy is CONTINUE, it return state of `RUNNING_EXECUTION`, and remain the same state forever; More seriously, both cases will cause `processInstanceExecCacheManager` not remove `WorkflowExecuteThread` ![image](https://user-images.githubusercontent.com/29919212/159254253-7d306b96-3a26-4b40-9fd7-1875a4404dec.png) ![image](https://user-images.githubusercontent.com/29919212/159262647-67b8351f-8073-4de3-8e60-dfe9e4c53d2a.png) ### What you expected to happen the process instance can update the state normally and can terminate normally. I hope it will be resolved in v2.0.6 ### How to reproduce Refer to `What happened` ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9065
https://github.com/apache/dolphinscheduler/pull/9186
6b2a4e31eadf707272381ced26a81eaa557e60c0
3e5781b6e1c38675ba134048b21941be63723cb6
2022-03-21T12:46:10Z
java
2022-04-01T14:23:35Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
f (!checkTaskInstanceByStateEvent(stateEvent)) { logger.error("task {} s not a blockng task", task.getTaskCode()); return false; } BlockngParameters parameters = JSONUtls.parseObject(task.getTaskParams(), BlockngParameters.class); f (parameters.sAlertWhenBlockng()) { ProjectUser projectUser = processServce.queryProjectWthUserByProcessInstanceId(processInstance.getId()); processAlertManager.sendProcessBlockngAlert(processInstance, projectUser); logger.nfo("processInstance {} block alert send successful!", processInstance.getId()); } } catch (Excepton e) { logger.error("sendng blockng message error:", e); } return true; } prvate boolean processComplementData() throws Excepton { f (!needComplementProcess()) { return false; } f (processInstance.getState() == ExecutonStatus.READY_STOP) { return false; } Date scheduleDate = processInstance.getScheduleTme(); f (scheduleDate == null) { scheduleDate = complementLstDate.get(0); } else f (processInstance.getState().typeIsFnshed()) { endProcess(); f (complementLstDate.sze() <= 0) { logger.nfo("process complement end. process d:{}", processInstance.getId()); return true;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,065
[Bug] [Master] When there is only one task and the submit failed, the state of Process Instance is Incorrect
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened BG : The Process Instance have only one task In the method of `submitPostNode`, the task successfully added to `readyToSubmitTaskQueue`, then submit task from queue, if submit failed, such as DB error, the `taskFailedSubmit` is true and `readyToSubmitTaskQueue` size is not empty. when execute the method of `updateProcessInstanceState`, case one: FailureStrategy is END, it return state of `FAILURE`, and update state; case two: FailureStrategy is CONTINUE, it return state of `RUNNING_EXECUTION`, and remain the same state forever; More seriously, both cases will cause `processInstanceExecCacheManager` not remove `WorkflowExecuteThread` ![image](https://user-images.githubusercontent.com/29919212/159254253-7d306b96-3a26-4b40-9fd7-1875a4404dec.png) ![image](https://user-images.githubusercontent.com/29919212/159262647-67b8351f-8073-4de3-8e60-dfe9e4c53d2a.png) ### What you expected to happen the process instance can update the state normally and can terminate normally. I hope it will be resolved in v2.0.6 ### How to reproduce Refer to `What happened` ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9065
https://github.com/apache/dolphinscheduler/pull/9186
6b2a4e31eadf707272381ced26a81eaa557e60c0
3e5781b6e1c38675ba134048b21941be63723cb6
2022-03-21T12:46:10Z
java
2022-04-01T14:23:35Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
} nt ndex = complementLstDate.ndexOf(scheduleDate); f (ndex >= complementLstDate.sze() - 1 || !processInstance.getState().typeIsSuccess()) { logger.nfo("process complement end. process d:{}", processInstance.getId()); return true; } logger.nfo("process complement contnue. process d:{}, schedule tme:{} complementLstDate:{}", processInstance.getId(), processInstance.getScheduleTme(), complementLstDate.toStrng()); scheduleDate = complementLstDate.get(ndex + 1); } nt create = ths.createComplementDataCommand(scheduleDate); f (create > 0) { logger.nfo("create complement data command successfully."); } return true; } prvate nt createComplementDataCommand(Date scheduleDate) { Command command = new Command(); command.setScheduleTme(scheduleDate); command.setCommandType(CommandType.COMPLEMENT_DATA); command.setProcessDefntonCode(processInstance.getProcessDefntonCode()); Map<Strng, Strng> cmdParam = JSONUtls.toMap(processInstance.getCommandParam()); f (cmdParam.contansKey(Constants.CMD_PARAM_RECOVERY_START_NODE_STRING)) { cmdParam.remove(Constants.CMD_PARAM_RECOVERY_START_NODE_STRING); } cmdParam.replace(CMDPARAM_COMPLEMENT_DATA_START_DATE, DateUtls.format(scheduleDate, "yyyy-MM-dd HH:mm:ss", null));
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,065
[Bug] [Master] When there is only one task and the submit failed, the state of Process Instance is Incorrect
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened BG : The Process Instance have only one task In the method of `submitPostNode`, the task successfully added to `readyToSubmitTaskQueue`, then submit task from queue, if submit failed, such as DB error, the `taskFailedSubmit` is true and `readyToSubmitTaskQueue` size is not empty. when execute the method of `updateProcessInstanceState`, case one: FailureStrategy is END, it return state of `FAILURE`, and update state; case two: FailureStrategy is CONTINUE, it return state of `RUNNING_EXECUTION`, and remain the same state forever; More seriously, both cases will cause `processInstanceExecCacheManager` not remove `WorkflowExecuteThread` ![image](https://user-images.githubusercontent.com/29919212/159254253-7d306b96-3a26-4b40-9fd7-1875a4404dec.png) ![image](https://user-images.githubusercontent.com/29919212/159262647-67b8351f-8073-4de3-8e60-dfe9e4c53d2a.png) ### What you expected to happen the process instance can update the state normally and can terminate normally. I hope it will be resolved in v2.0.6 ### How to reproduce Refer to `What happened` ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9065
https://github.com/apache/dolphinscheduler/pull/9186
6b2a4e31eadf707272381ced26a81eaa557e60c0
3e5781b6e1c38675ba134048b21941be63723cb6
2022-03-21T12:46:10Z
java
2022-04-01T14:23:35Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
command.setCommandParam(JSONUtls.toJsonStrng(cmdParam)); command.setTaskDependType(processInstance.getTaskDependType()); command.setFalureStrategy(processInstance.getFalureStrategy()); command.setWarnngType(processInstance.getWarnngType()); command.setWarnngGroupId(processInstance.getWarnngGroupId()); command.setStartTme(new Date()); command.setExecutorId(processInstance.getExecutorId()); command.setUpdateTme(new Date()); command.setProcessInstanceProrty(processInstance.getProcessInstanceProrty()); command.setWorkerGroup(processInstance.getWorkerGroup()); command.setEnvronmentCode(processInstance.getEnvronmentCode()); command.setDryRun(processInstance.getDryRun()); command.setProcessInstanceId(0); command.setProcessDefntonVerson(processInstance.getProcessDefntonVerson()); return processServce.createCommand(command); } prvate boolean needComplementProcess() { f (processInstance.sComplementData() && Flag.NO == processInstance.getIsSubProcess()) { return true; } return false; } /** * process start handle */ publc vod startProcess() { f (ths.taskInstanceMap.sze() > 0) { return; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,065
[Bug] [Master] When there is only one task and the submit failed, the state of Process Instance is Incorrect
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened BG : The Process Instance have only one task In the method of `submitPostNode`, the task successfully added to `readyToSubmitTaskQueue`, then submit task from queue, if submit failed, such as DB error, the `taskFailedSubmit` is true and `readyToSubmitTaskQueue` size is not empty. when execute the method of `updateProcessInstanceState`, case one: FailureStrategy is END, it return state of `FAILURE`, and update state; case two: FailureStrategy is CONTINUE, it return state of `RUNNING_EXECUTION`, and remain the same state forever; More seriously, both cases will cause `processInstanceExecCacheManager` not remove `WorkflowExecuteThread` ![image](https://user-images.githubusercontent.com/29919212/159254253-7d306b96-3a26-4b40-9fd7-1875a4404dec.png) ![image](https://user-images.githubusercontent.com/29919212/159262647-67b8351f-8073-4de3-8e60-dfe9e4c53d2a.png) ### What you expected to happen the process instance can update the state normally and can terminate normally. I hope it will be resolved in v2.0.6 ### How to reproduce Refer to `What happened` ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9065
https://github.com/apache/dolphinscheduler/pull/9186
6b2a4e31eadf707272381ced26a81eaa557e60c0
3e5781b6e1c38675ba134048b21941be63723cb6
2022-03-21T12:46:10Z
java
2022-04-01T14:23:35Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
try { sStart = false; buldFlowDag(); ntTaskQueue(); submtPostNode(null); sStart = true; } catch (Excepton e) { logger.error("start process error, process nstance d:{}", processInstance.getId(), e); } } /** * process end handle */ prvate vod endProcess() { ths.stateEvents.clear(); f (processDefnton.getExecutonType().typeIsSeralWat()) { checkSeralProcess(processDefnton); } f (processInstance.getState().typeIsWatngThread()) { processServce.createRecoveryWatngThreadCommand(null, processInstance); } f (processAlertManager.sNeedToSendWarnng(processInstance)) { ProjectUser projectUser = processServce.queryProjectWthUserByProcessInstanceId(processInstance.getId()); processAlertManager.sendAlertProcessInstance(processInstance, getValdTaskLst(), projectUser); } f (checkTaskQueue()) { processServce.releaseAllTaskGroup(processInstance.getId()); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,065
[Bug] [Master] When there is only one task and the submit failed, the state of Process Instance is Incorrect
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened BG : The Process Instance have only one task In the method of `submitPostNode`, the task successfully added to `readyToSubmitTaskQueue`, then submit task from queue, if submit failed, such as DB error, the `taskFailedSubmit` is true and `readyToSubmitTaskQueue` size is not empty. when execute the method of `updateProcessInstanceState`, case one: FailureStrategy is END, it return state of `FAILURE`, and update state; case two: FailureStrategy is CONTINUE, it return state of `RUNNING_EXECUTION`, and remain the same state forever; More seriously, both cases will cause `processInstanceExecCacheManager` not remove `WorkflowExecuteThread` ![image](https://user-images.githubusercontent.com/29919212/159254253-7d306b96-3a26-4b40-9fd7-1875a4404dec.png) ![image](https://user-images.githubusercontent.com/29919212/159262647-67b8351f-8073-4de3-8e60-dfe9e4c53d2a.png) ### What you expected to happen the process instance can update the state normally and can terminate normally. I hope it will be resolved in v2.0.6 ### How to reproduce Refer to `What happened` ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9065
https://github.com/apache/dolphinscheduler/pull/9186
6b2a4e31eadf707272381ced26a81eaa557e60c0
3e5781b6e1c38675ba134048b21941be63723cb6
2022-03-21T12:46:10Z
java
2022-04-01T14:23:35Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
publc vod checkSeralProcess(ProcessDefnton processDefnton) { nt nextInstanceId = processInstance.getNextProcessInstanceId(); f (nextInstanceId == 0) { ProcessInstance nextProcessInstance = ths.processServce.loadNextProcess4Seral(processInstance.getProcessDefnton().getCode(), ExecutonStatus.SERIAL_WAIT.getCode()); f (nextProcessInstance == null) { return; } nextInstanceId = nextProcessInstance.getId(); } ProcessInstance nextProcessInstance = ths.processServce.fndProcessInstanceById(nextInstanceId); f (nextProcessInstance.getState().typeIsFnshed() || nextProcessInstance.getState().typeIsRunnng()) { return; } Map<Strng, Object> cmdParam = new HashMap<>(); cmdParam.put(CMD_PARAM_RECOVER_PROCESS_ID_STRING, nextInstanceId); Command command = new Command(); command.setCommandType(CommandType.RECOVER_SERIAL_WAIT); command.setProcessDefntonCode(processDefnton.getCode()); command.setCommandParam(JSONUtls.toJsonStrng(cmdParam)); processServce.createCommand(command); } /** * generate process dag * * @throws Excepton excepton */ prvate vod buldFlowDag() throws Excepton { f (ths.dag != null) { return; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,065
[Bug] [Master] When there is only one task and the submit failed, the state of Process Instance is Incorrect
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened BG : The Process Instance have only one task In the method of `submitPostNode`, the task successfully added to `readyToSubmitTaskQueue`, then submit task from queue, if submit failed, such as DB error, the `taskFailedSubmit` is true and `readyToSubmitTaskQueue` size is not empty. when execute the method of `updateProcessInstanceState`, case one: FailureStrategy is END, it return state of `FAILURE`, and update state; case two: FailureStrategy is CONTINUE, it return state of `RUNNING_EXECUTION`, and remain the same state forever; More seriously, both cases will cause `processInstanceExecCacheManager` not remove `WorkflowExecuteThread` ![image](https://user-images.githubusercontent.com/29919212/159254253-7d306b96-3a26-4b40-9fd7-1875a4404dec.png) ![image](https://user-images.githubusercontent.com/29919212/159262647-67b8351f-8073-4de3-8e60-dfe9e4c53d2a.png) ### What you expected to happen the process instance can update the state normally and can terminate normally. I hope it will be resolved in v2.0.6 ### How to reproduce Refer to `What happened` ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9065
https://github.com/apache/dolphinscheduler/pull/9186
6b2a4e31eadf707272381ced26a81eaa557e60c0
3e5781b6e1c38675ba134048b21941be63723cb6
2022-03-21T12:46:10Z
java
2022-04-01T14:23:35Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
processDefnton = processServce.fndProcessDefnton(processInstance.getProcessDefntonCode(), processInstance.getProcessDefntonVerson()); processInstance.setProcessDefnton(processDefnton); Lst<TaskInstance> recoverNodeLst = getStartTaskInstanceLst(processInstance.getCommandParam()); Lst<ProcessTaskRelaton> processTaskRelatons = processServce.fndRelatonByCode(processDefnton.getCode(), processDefnton.getVerson()); Lst<TaskDefntonLog> taskDefntonLogs = processServce.getTaskDefneLogLstByRelaton(processTaskRelatons); Lst<TaskNode> taskNodeLst = processServce.transformTask(processTaskRelatons, taskDefntonLogs); forbddenTaskMap.clear(); taskNodeLst.forEach(taskNode -> { f (taskNode.sForbdden()) { forbddenTaskMap.put(taskNode.getCode(), taskNode); } }); Lst<Strng> recoveryNodeCodeLst = getRecoveryNodeCodeLst(recoverNodeLst); Lst<Strng> startNodeNameLst = parseStartNodeName(processInstance.getCommandParam()); ProcessDag processDag = generateFlowDag(taskNodeLst, startNodeNameLst, recoveryNodeCodeLst, processInstance.getTaskDependType()); f (processDag == null) { logger.error("processDag s null"); return; } dag = DagHelper.buldDagGraph(processDag); } /** * nt task queue */ prvate vod ntTaskQueue() { taskFaledSubmt = false;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,065
[Bug] [Master] When there is only one task and the submit failed, the state of Process Instance is Incorrect
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened BG : The Process Instance have only one task In the method of `submitPostNode`, the task successfully added to `readyToSubmitTaskQueue`, then submit task from queue, if submit failed, such as DB error, the `taskFailedSubmit` is true and `readyToSubmitTaskQueue` size is not empty. when execute the method of `updateProcessInstanceState`, case one: FailureStrategy is END, it return state of `FAILURE`, and update state; case two: FailureStrategy is CONTINUE, it return state of `RUNNING_EXECUTION`, and remain the same state forever; More seriously, both cases will cause `processInstanceExecCacheManager` not remove `WorkflowExecuteThread` ![image](https://user-images.githubusercontent.com/29919212/159254253-7d306b96-3a26-4b40-9fd7-1875a4404dec.png) ![image](https://user-images.githubusercontent.com/29919212/159262647-67b8351f-8073-4de3-8e60-dfe9e4c53d2a.png) ### What you expected to happen the process instance can update the state normally and can terminate normally. I hope it will be resolved in v2.0.6 ### How to reproduce Refer to `What happened` ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9065
https://github.com/apache/dolphinscheduler/pull/9186
6b2a4e31eadf707272381ced26a81eaa557e60c0
3e5781b6e1c38675ba134048b21941be63723cb6
2022-03-21T12:46:10Z
java
2022-04-01T14:23:35Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
actveTaskProcessorMaps.clear(); dependFaledTaskMap.clear(); completeTaskMap.clear(); errorTaskMap.clear(); f (!sNewProcessInstance()) { Lst<TaskInstance> valdTaskInstanceLst = processServce.fndValdTaskLstByProcessId(processInstance.getId()); for (TaskInstance task : valdTaskInstanceLst) { f (valdTaskMap.contansKey(task.getTaskCode())) { nt oldTaskInstanceId = valdTaskMap.get(task.getTaskCode()); TaskInstance oldTaskInstance = taskInstanceMap.get(oldTaskInstanceId); f (!oldTaskInstance.getState().typeIsFnshed() && task.getState().typeIsFnshed()) { task.setFlag(Flag.NO); processServce.updateTaskInstance(task); contnue; } logger.warn("have same taskCode taskInstance when nt task queue, taskCode:{}", task.getTaskCode()); } valdTaskMap.put(task.getTaskCode(), task.getId()); taskInstanceMap.put(task.getId(), task); f (task.sTaskComplete()) { completeTaskMap.put(task.getTaskCode(), task.getId()); contnue; } f (task.sCondtonsTask() || DagHelper.haveCondtonsAfterNode(Long.toStrng(task.getTaskCode()), dag)) { contnue; } f (task.taskCanRetry()) { f (task.getState() == ExecutonStatus.NEED_FAULT_TOLERANCE) { TaskInstance tolerantTaskInstance = cloneTolerantTaskInstance(task);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,065
[Bug] [Master] When there is only one task and the submit failed, the state of Process Instance is Incorrect
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened BG : The Process Instance have only one task In the method of `submitPostNode`, the task successfully added to `readyToSubmitTaskQueue`, then submit task from queue, if submit failed, such as DB error, the `taskFailedSubmit` is true and `readyToSubmitTaskQueue` size is not empty. when execute the method of `updateProcessInstanceState`, case one: FailureStrategy is END, it return state of `FAILURE`, and update state; case two: FailureStrategy is CONTINUE, it return state of `RUNNING_EXECUTION`, and remain the same state forever; More seriously, both cases will cause `processInstanceExecCacheManager` not remove `WorkflowExecuteThread` ![image](https://user-images.githubusercontent.com/29919212/159254253-7d306b96-3a26-4b40-9fd7-1875a4404dec.png) ![image](https://user-images.githubusercontent.com/29919212/159262647-67b8351f-8073-4de3-8e60-dfe9e4c53d2a.png) ### What you expected to happen the process instance can update the state normally and can terminate normally. I hope it will be resolved in v2.0.6 ### How to reproduce Refer to `What happened` ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9065
https://github.com/apache/dolphinscheduler/pull/9186
6b2a4e31eadf707272381ced26a81eaa557e60c0
3e5781b6e1c38675ba134048b21941be63723cb6
2022-03-21T12:46:10Z
java
2022-04-01T14:23:35Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
addTaskToStandByLst(tolerantTaskInstance); } else { retryTaskInstance(task); } contnue; } f (task.getState().typeIsFalure()) { errorTaskMap.put(task.getTaskCode(), task.getId()); } } } f (processInstance.sComplementData() && complementLstDate.sze() == 0) { Map<Strng, Strng> cmdParam = JSONUtls.toMap(processInstance.getCommandParam()); f (cmdParam != null && cmdParam.contansKey(CMDPARAM_COMPLEMENT_DATA_START_DATE)) { Date start = DateUtls.strngToDate(cmdParam.get(CMDPARAM_COMPLEMENT_DATA_START_DATE)); Date end = DateUtls.strngToDate(cmdParam.get(CMDPARAM_COMPLEMENT_DATA_END_DATE)); Lst<Schedule> schedules = processServce.queryReleaseSchedulerLstByProcessDefntonCode(processInstance.getProcessDefntonCode()); f (complementLstDate.sze() == 0 && needComplementProcess()) { complementLstDate = CronUtls.getSelfFreDateLst(start, end, schedules); logger.nfo(" process defnton code:{} complement data: {}", processInstance.getProcessDefntonCode(), complementLstDate.toStrng()); f (complementLstDate.sze() > 0 && Flag.NO == processInstance.getIsSubProcess()) { processInstance.setScheduleTme(complementLstDate.get(0)); processInstance.setGlobalParams(ParameterUtls.curngGlobalParams( processDefnton.getGlobalParamMap(), processDefnton.getGlobalParamLst(), CommandType.COMPLEMENT_DATA, processInstance.getScheduleTme())); processServce.updateProcessInstance(processInstance); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,065
[Bug] [Master] When there is only one task and the submit failed, the state of Process Instance is Incorrect
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened BG : The Process Instance have only one task In the method of `submitPostNode`, the task successfully added to `readyToSubmitTaskQueue`, then submit task from queue, if submit failed, such as DB error, the `taskFailedSubmit` is true and `readyToSubmitTaskQueue` size is not empty. when execute the method of `updateProcessInstanceState`, case one: FailureStrategy is END, it return state of `FAILURE`, and update state; case two: FailureStrategy is CONTINUE, it return state of `RUNNING_EXECUTION`, and remain the same state forever; More seriously, both cases will cause `processInstanceExecCacheManager` not remove `WorkflowExecuteThread` ![image](https://user-images.githubusercontent.com/29919212/159254253-7d306b96-3a26-4b40-9fd7-1875a4404dec.png) ![image](https://user-images.githubusercontent.com/29919212/159262647-67b8351f-8073-4de3-8e60-dfe9e4c53d2a.png) ### What you expected to happen the process instance can update the state normally and can terminate normally. I hope it will be resolved in v2.0.6 ### How to reproduce Refer to `What happened` ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9065
https://github.com/apache/dolphinscheduler/pull/9186
6b2a4e31eadf707272381ced26a81eaa557e60c0
3e5781b6e1c38675ba134048b21941be63723cb6
2022-03-21T12:46:10Z
java
2022-04-01T14:23:35Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
} } } /** * submt task to execute * * @param taskInstance task nstance * @return TaskInstance */ prvate TaskInstance submtTaskExec(TaskInstance taskInstance) { try { processServce.packageTaskInstance(taskInstance, processInstance); ITaskProcessor taskProcessor = TaskProcessorFactory.getTaskProcessor(taskInstance.getTaskType()); taskProcessor.nt(taskInstance, processInstance); f (taskInstance.getState() == ExecutonStatus.RUNNING_EXECUTION && taskProcessor.getType().equalsIgnoreCase(Constants.COMMON_TASK_TYPE)) { notfyProcessHostUpdate(taskInstance); } boolean submt = taskProcessor.acton(TaskActon.SUBMIT); f (!submt) { logger.error("process d:{} name:{} submt standby task d:{} name:{} faled!", processInstance.getId(), processInstance.getName(), taskInstance.getId(), taskInstance.getName()); return null; } f (valdTaskMap.contansKey(taskInstance.getTaskCode())) { nt oldTaskInstanceId = valdTaskMap.get(taskInstance.getTaskCode()); f (taskInstance.getId() != oldTaskInstanceId) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,065
[Bug] [Master] When there is only one task and the submit failed, the state of Process Instance is Incorrect
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened BG : The Process Instance have only one task In the method of `submitPostNode`, the task successfully added to `readyToSubmitTaskQueue`, then submit task from queue, if submit failed, such as DB error, the `taskFailedSubmit` is true and `readyToSubmitTaskQueue` size is not empty. when execute the method of `updateProcessInstanceState`, case one: FailureStrategy is END, it return state of `FAILURE`, and update state; case two: FailureStrategy is CONTINUE, it return state of `RUNNING_EXECUTION`, and remain the same state forever; More seriously, both cases will cause `processInstanceExecCacheManager` not remove `WorkflowExecuteThread` ![image](https://user-images.githubusercontent.com/29919212/159254253-7d306b96-3a26-4b40-9fd7-1875a4404dec.png) ![image](https://user-images.githubusercontent.com/29919212/159262647-67b8351f-8073-4de3-8e60-dfe9e4c53d2a.png) ### What you expected to happen the process instance can update the state normally and can terminate normally. I hope it will be resolved in v2.0.6 ### How to reproduce Refer to `What happened` ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9065
https://github.com/apache/dolphinscheduler/pull/9186
6b2a4e31eadf707272381ced26a81eaa557e60c0
3e5781b6e1c38675ba134048b21941be63723cb6
2022-03-21T12:46:10Z
java
2022-04-01T14:23:35Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
TaskInstance oldTaskInstance = taskInstanceMap.get(oldTaskInstanceId); oldTaskInstance.setFlag(Flag.NO); processServce.updateTaskInstance(oldTaskInstance); valdTaskMap.remove(taskInstance.getTaskCode()); actveTaskProcessorMaps.remove(taskInstance.getTaskCode()); } } valdTaskMap.put(taskInstance.getTaskCode(), taskInstance.getId()); taskInstanceMap.put(taskInstance.getId(), taskInstance); actveTaskProcessorMaps.put(taskInstance.getTaskCode(), taskProcessor); taskProcessor.acton(TaskActon.RUN); stateWheelExecuteThread.addTask4TmeoutCheck(processInstance, taskInstance); stateWheelExecuteThread.addTask4StateCheck(processInstance, taskInstance); f (taskProcessor.taskInstance().getState().typeIsFnshed()) { f (processInstance.sBlocked()) { StateEvent processBlockEvent = new StateEvent(); processBlockEvent.setProcessInstanceId(ths.processInstance.getId()); processBlockEvent.setTaskInstanceId(taskInstance.getId()); processBlockEvent.setExecutonStatus(taskProcessor.taskInstance().getState()); processBlockEvent.setType(StateEventType.PROCESS_BLOCKED); ths.stateEvents.add(processBlockEvent); } StateEvent taskStateChangeEvent = new StateEvent(); taskStateChangeEvent.setProcessInstanceId(ths.processInstance.getId()); taskStateChangeEvent.setTaskInstanceId(taskInstance.getId()); taskStateChangeEvent.setExecutonStatus(taskProcessor.taskInstance().getState()); taskStateChangeEvent.setType(StateEventType.TASK_STATE_CHANGE); ths.stateEvents.add(taskStateChangeEvent); } return taskInstance;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,065
[Bug] [Master] When there is only one task and the submit failed, the state of Process Instance is Incorrect
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened BG : The Process Instance have only one task In the method of `submitPostNode`, the task successfully added to `readyToSubmitTaskQueue`, then submit task from queue, if submit failed, such as DB error, the `taskFailedSubmit` is true and `readyToSubmitTaskQueue` size is not empty. when execute the method of `updateProcessInstanceState`, case one: FailureStrategy is END, it return state of `FAILURE`, and update state; case two: FailureStrategy is CONTINUE, it return state of `RUNNING_EXECUTION`, and remain the same state forever; More seriously, both cases will cause `processInstanceExecCacheManager` not remove `WorkflowExecuteThread` ![image](https://user-images.githubusercontent.com/29919212/159254253-7d306b96-3a26-4b40-9fd7-1875a4404dec.png) ![image](https://user-images.githubusercontent.com/29919212/159262647-67b8351f-8073-4de3-8e60-dfe9e4c53d2a.png) ### What you expected to happen the process instance can update the state normally and can terminate normally. I hope it will be resolved in v2.0.6 ### How to reproduce Refer to `What happened` ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9065
https://github.com/apache/dolphinscheduler/pull/9186
6b2a4e31eadf707272381ced26a81eaa557e60c0
3e5781b6e1c38675ba134048b21941be63723cb6
2022-03-21T12:46:10Z
java
2022-04-01T14:23:35Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
} catch (Excepton e) { logger.error("submt standby task error", e); return null; } } prvate vod notfyProcessHostUpdate(TaskInstance taskInstance) { f (StrngUtls.sEmpty(taskInstance.getHost())) { return; } try { HostUpdateCommand hostUpdateCommand = new HostUpdateCommand(); hostUpdateCommand.setProcessHost(NetUtls.getAddr(masterConfg.getLstenPort())); hostUpdateCommand.setTaskInstanceId(taskInstance.getId()); Host host = new Host(taskInstance.getHost()); nettyExecutorManager.doExecute(host, hostUpdateCommand.convert2Command()); } catch (Excepton e) { logger.error("notfy process host update", e); } } /** * fnd task nstance n db. * n case submt more than one same name task n the same tme. * * @param taskCode task code * @param taskVerson task verson * @return TaskInstance */ prvate TaskInstance fndTaskIfExsts(Long taskCode, nt taskVerson) { Lst<TaskInstance> valdTaskInstanceLst = getValdTaskLst(); for (TaskInstance taskInstance : valdTaskInstanceLst) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,065
[Bug] [Master] When there is only one task and the submit failed, the state of Process Instance is Incorrect
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened BG : The Process Instance have only one task In the method of `submitPostNode`, the task successfully added to `readyToSubmitTaskQueue`, then submit task from queue, if submit failed, such as DB error, the `taskFailedSubmit` is true and `readyToSubmitTaskQueue` size is not empty. when execute the method of `updateProcessInstanceState`, case one: FailureStrategy is END, it return state of `FAILURE`, and update state; case two: FailureStrategy is CONTINUE, it return state of `RUNNING_EXECUTION`, and remain the same state forever; More seriously, both cases will cause `processInstanceExecCacheManager` not remove `WorkflowExecuteThread` ![image](https://user-images.githubusercontent.com/29919212/159254253-7d306b96-3a26-4b40-9fd7-1875a4404dec.png) ![image](https://user-images.githubusercontent.com/29919212/159262647-67b8351f-8073-4de3-8e60-dfe9e4c53d2a.png) ### What you expected to happen the process instance can update the state normally and can terminate normally. I hope it will be resolved in v2.0.6 ### How to reproduce Refer to `What happened` ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9065
https://github.com/apache/dolphinscheduler/pull/9186
6b2a4e31eadf707272381ced26a81eaa557e60c0
3e5781b6e1c38675ba134048b21941be63723cb6
2022-03-21T12:46:10Z
java
2022-04-01T14:23:35Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
f (taskInstance.getTaskCode() == taskCode && taskInstance.getTaskDefntonVerson() == taskVerson) { return taskInstance; } } return null; } /** * encapsulaton task * * @param processInstance process nstance * @param taskNode taskNode * @return TaskInstance */ prvate TaskInstance createTaskInstance(ProcessInstance processInstance, TaskNode taskNode) { TaskInstance taskInstance = fndTaskIfExsts(taskNode.getCode(), taskNode.getVerson()); f (taskInstance != null) { return taskInstance; } return newTaskInstance(processInstance, taskNode); } /** * clone a new taskInstance for retry and reset some logc felds * * @return */ publc TaskInstance cloneRetryTaskInstance(TaskInstance taskInstance) { TaskNode taskNode = dag.getNode(Long.toStrng(taskInstance.getTaskCode())); f (taskNode == null) { logger.error("taskNode s null, code:{}", taskInstance.getTaskCode()); return null;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,065
[Bug] [Master] When there is only one task and the submit failed, the state of Process Instance is Incorrect
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened BG : The Process Instance have only one task In the method of `submitPostNode`, the task successfully added to `readyToSubmitTaskQueue`, then submit task from queue, if submit failed, such as DB error, the `taskFailedSubmit` is true and `readyToSubmitTaskQueue` size is not empty. when execute the method of `updateProcessInstanceState`, case one: FailureStrategy is END, it return state of `FAILURE`, and update state; case two: FailureStrategy is CONTINUE, it return state of `RUNNING_EXECUTION`, and remain the same state forever; More seriously, both cases will cause `processInstanceExecCacheManager` not remove `WorkflowExecuteThread` ![image](https://user-images.githubusercontent.com/29919212/159254253-7d306b96-3a26-4b40-9fd7-1875a4404dec.png) ![image](https://user-images.githubusercontent.com/29919212/159262647-67b8351f-8073-4de3-8e60-dfe9e4c53d2a.png) ### What you expected to happen the process instance can update the state normally and can terminate normally. I hope it will be resolved in v2.0.6 ### How to reproduce Refer to `What happened` ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9065
https://github.com/apache/dolphinscheduler/pull/9186
6b2a4e31eadf707272381ced26a81eaa557e60c0
3e5781b6e1c38675ba134048b21941be63723cb6
2022-03-21T12:46:10Z
java
2022-04-01T14:23:35Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
} TaskInstance newTaskInstance = newTaskInstance(processInstance, taskNode); newTaskInstance.setTaskDefne(taskInstance.getTaskDefne()); newTaskInstance.setProcessDefne(taskInstance.getProcessDefne()); newTaskInstance.setProcessInstance(processInstance); newTaskInstance.setRetryTmes(taskInstance.getRetryTmes() + 1); newTaskInstance.setState(taskInstance.getState()); newTaskInstance.setEndTme(taskInstance.getEndTme()); return newTaskInstance; } /** * clone a new taskInstance for tolerant and reset some logc felds * * @return */ publc TaskInstance cloneTolerantTaskInstance(TaskInstance taskInstance) { TaskNode taskNode = dag.getNode(Long.toStrng(taskInstance.getTaskCode())); f (taskNode == null) { logger.error("taskNode s null, code:{}", taskInstance.getTaskCode()); return null; } TaskInstance newTaskInstance = newTaskInstance(processInstance, taskNode); newTaskInstance.setTaskDefne(taskInstance.getTaskDefne()); newTaskInstance.setProcessDefne(taskInstance.getProcessDefne()); newTaskInstance.setProcessInstance(processInstance); newTaskInstance.setRetryTmes(taskInstance.getRetryTmes()); newTaskInstance.setState(taskInstance.getState()); return newTaskInstance; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,065
[Bug] [Master] When there is only one task and the submit failed, the state of Process Instance is Incorrect
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened BG : The Process Instance have only one task In the method of `submitPostNode`, the task successfully added to `readyToSubmitTaskQueue`, then submit task from queue, if submit failed, such as DB error, the `taskFailedSubmit` is true and `readyToSubmitTaskQueue` size is not empty. when execute the method of `updateProcessInstanceState`, case one: FailureStrategy is END, it return state of `FAILURE`, and update state; case two: FailureStrategy is CONTINUE, it return state of `RUNNING_EXECUTION`, and remain the same state forever; More seriously, both cases will cause `processInstanceExecCacheManager` not remove `WorkflowExecuteThread` ![image](https://user-images.githubusercontent.com/29919212/159254253-7d306b96-3a26-4b40-9fd7-1875a4404dec.png) ![image](https://user-images.githubusercontent.com/29919212/159262647-67b8351f-8073-4de3-8e60-dfe9e4c53d2a.png) ### What you expected to happen the process instance can update the state normally and can terminate normally. I hope it will be resolved in v2.0.6 ### How to reproduce Refer to `What happened` ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/9065
https://github.com/apache/dolphinscheduler/pull/9186
6b2a4e31eadf707272381ced26a81eaa557e60c0
3e5781b6e1c38675ba134048b21941be63723cb6
2022-03-21T12:46:10Z
java
2022-04-01T14:23:35Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
/** * new a taskInstance * * @param processInstance * @param taskNode * @return */ publc TaskInstance newTaskInstance(ProcessInstance processInstance, TaskNode taskNode) { TaskInstance taskInstance = new TaskInstance(); taskInstance.setTaskCode(taskNode.getCode()); taskInstance.setTaskDefntonVerson(taskNode.getVerson()); taskInstance.setName(taskNode.getName()); taskInstance.setState(ExecutonStatus.SUBMITTED_SUCCESS); taskInstance.setProcessInstanceId(processInstance.getId()); taskInstance.setTaskType(taskNode.getType().toUpperCase()); taskInstance.setAlertFlag(Flag.NO); taskInstance.setStartTme(null); taskInstance.setFlag(Flag.YES); taskInstance.setDryRun(processInstance.getDryRun()); taskInstance.setRetryTmes(0);