Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
UI shows N/A for start time and console URL
We do parallel job submission for forked actions, and each job submission needs to update workflow instance.
To avoid data race, ForkedActionStartXCommand write workflow instance to a temporary map.
ForkedActionExecutorContext.java
private Map<String, String> contextVariableMap = new HashMap<String, String>(); public ForkedActionExecutorContext(WorkflowJobBean workflow, WorkflowActionBean action, boolean isRetry, boolean isUserRetry) { super(workflow, action, isRetry, isUserRetry); } public void setVar(String name, String value) { if (value != null) { contextVariableMap.remove(name); } else { contextVariableMap.put(name, value); } }
And when forked submission completes, the temporary map is written to the workflow instance.
SignalXCommand.java
List<Future<ActionExecutorContext>> futures = Services.get().get(CallableQueueService.class) .invokeAll(tasks); for (Future<ActionExecutorContext> result : futures) { if (result == null) { submitJobByQueuing = true; continue; } ActionExecutorContext context = result.get(); Map<String, String> contextVariableMap = ((ForkedActionExecutorContext) context).getContextMap(); LOG.debug("contextVariableMap size of action " + context.getAction().getId() + " is " + contextVariableMap.size()); for (String key : contextVariableMap.keySet()) { context.setVarToWorkflow(key, contextVariableMap.get(key)); }
The logic for writing to the temporary map is incorrect. It should be
public void setVar(String name, String value) { if (value == null) { contextVariableMap.remove(name); } else { contextVariableMap.put(name, value); } }