Commit ffdd442
Fix Flowable workflow termination message lookup and async-job race on deletion (open-metadata#27117)
* Fix Flowable workflow termination message lookup and async-job race on deletion
WorkflowHandler.findTerminationMessageName was splitting task definition keys
on underscore and looking for messages named '<key>_terminateProcess'. But
Workflow.getFlowableElementId joins with a dot, so actual task keys are
'<subProcess>.approvalTask' and termination messages are
'<subProcess>.terminateProcess'. The bug has been latent since the original
Custom Workflows commit - every conflict-resolution path silently failed to
terminate the old subprocess, leaving it dangling until force-delete.
Fix: split on the last dot, derive the subprocess ID, and check for the
'<subProcessId>.terminateProcess' subscription directly. Remove the dead
'terminateChangeReviewProcess' pattern and the debug scaffolding loops.
Also add getManagementService/getRepositoryService getters to WorkflowHandler
for use in integration tests.
In WorkflowDefinitionResourceIT, replace waitForWorkflowIdle to check pending
async jobs on the trigger process definition IDs instead of waiting for
process instances to drain. Async-after jobs on the fetch task are ephemeral
(<100ms) - waiting for them has near-zero cost, whereas the old approach
waited for the entire batch loop (potentially minutes with many entities).
Also remove the waitForWorkflowIdle call from cleanupCreatedWorkflows @AfterEach
since it ran a query per workflow in every test unnecessarily.
* Fix spurious EntityNotFoundException errors from orphaned Flowable processes
WorkflowInstanceListener and WorkflowInstanceStageListener were firing on
Flowable process instances with numeric keys (e.g. 239376, 239373) that have
no corresponding OM workflow definition, causing EntityNotFoundException noise
in AUT runs.
- WorkflowInstanceListener: skip addWorkflowInstance/updateWorkflowInstance
when getMainWorkflowDefinitionNameFromTrigger returns the raw process key
unchanged (no 'Trigger' suffix to strip = not an OM trigger workflow)
- WorkflowInstanceStageListener: skip addNewStage/updateStage when the
process key is purely numeric (isUnknownFlowableProcess guard)
- WorkflowDefinitionResourceIT: fix waitForWorkflowIdle to use
TriggerFactory.getTriggerWorkflowId(fqn) instead of name+"Trigger%"
so it correctly queries by FQN-based process definition key
* Fix compilation issues
* Address Copilot review feedback on PR open-metadata#27117
- WorkflowInstanceStageListener: replace fragile numeric-key guard with
businessKey-based guard — skip stage tracking when no business key is
present (non-OM-managed process instance) instead of using processKey
format heuristic that could misfire on numeric-named workflows
- WorkflowDefinitionResourceIT: fix Javadoc comment ("Trigger-*" ->
"Trigger%") and add startsWith filter after processDefinitionKeyLike
query to prevent SQL LIKE wildcard '_' from matching unrelated PDs
- WorkflowHandler: eliminate double Flowable round-trip in termination
logic by merging findTerminationMessageName into terminateTask helper
that does a single singleResult() query per task
* fix: change DEBUG to WARN for null businessKey skip in WorkflowInstanceStageListener
Co-authored-by: Ram Narayan Balaji <81347100+yan-3005@users.noreply.github.com>
---------
Co-authored-by: Gitar <noreply@gitar.ai>1 parent 4a946a8 commit ffdd442
4 files changed
Lines changed: 106 additions & 115 deletions
File tree
- openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests
- openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows
Lines changed: 52 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
34 | 38 | | |
35 | 39 | | |
36 | 40 | | |
| |||
122 | 126 | | |
123 | 127 | | |
124 | 128 | | |
| 129 | + | |
| 130 | + | |
125 | 131 | | |
126 | 132 | | |
127 | 133 | | |
| |||
1898 | 1904 | | |
1899 | 1905 | | |
1900 | 1906 | | |
| 1907 | + | |
| 1908 | + | |
1901 | 1909 | | |
1902 | 1910 | | |
1903 | 1911 | | |
| |||
1950 | 1958 | | |
1951 | 1959 | | |
1952 | 1960 | | |
| 1961 | + | |
| 1962 | + | |
| 1963 | + | |
| 1964 | + | |
| 1965 | + | |
| 1966 | + | |
| 1967 | + | |
| 1968 | + | |
| 1969 | + | |
| 1970 | + | |
| 1971 | + | |
| 1972 | + | |
| 1973 | + | |
| 1974 | + | |
| 1975 | + | |
| 1976 | + | |
| 1977 | + | |
| 1978 | + | |
| 1979 | + | |
| 1980 | + | |
| 1981 | + | |
| 1982 | + | |
| 1983 | + | |
| 1984 | + | |
| 1985 | + | |
| 1986 | + | |
| 1987 | + | |
| 1988 | + | |
| 1989 | + | |
| 1990 | + | |
| 1991 | + | |
| 1992 | + | |
| 1993 | + | |
| 1994 | + | |
| 1995 | + | |
| 1996 | + | |
| 1997 | + | |
| 1998 | + | |
| 1999 | + | |
| 2000 | + | |
| 2001 | + | |
| 2002 | + | |
1953 | 2003 | | |
1954 | 2004 | | |
1955 | 2005 | | |
| |||
2500 | 2550 | | |
2501 | 2551 | | |
2502 | 2552 | | |
| 2553 | + | |
2503 | 2554 | | |
2504 | 2555 | | |
2505 | 2556 | | |
| |||
2943 | 2994 | | |
2944 | 2995 | | |
2945 | 2996 | | |
| 2997 | + | |
2946 | 2998 | | |
2947 | 2999 | | |
2948 | 3000 | | |
| |||
Lines changed: 31 additions & 98 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
23 | 21 | | |
24 | 22 | | |
25 | 23 | | |
| |||
1027 | 1025 | | |
1028 | 1026 | | |
1029 | 1027 | | |
1030 | | - | |
1031 | | - | |
1032 | | - | |
1033 | | - | |
1034 | | - | |
1035 | | - | |
1036 | | - | |
1037 | | - | |
1038 | | - | |
1039 | | - | |
1040 | | - | |
1041 | | - | |
1042 | | - | |
1043 | | - | |
1044 | | - | |
1045 | | - | |
1046 | | - | |
1047 | | - | |
1048 | | - | |
1049 | | - | |
1050 | | - | |
1051 | | - | |
| 1028 | + | |
1052 | 1029 | | |
1053 | 1030 | | |
1054 | 1031 | | |
1055 | 1032 | | |
1056 | 1033 | | |
1057 | 1034 | | |
1058 | | - | |
1059 | | - | |
1060 | | - | |
1061 | | - | |
1062 | | - | |
| 1035 | + | |
1063 | 1036 | | |
1064 | 1037 | | |
1065 | | - | |
1066 | | - | |
1067 | | - | |
1068 | | - | |
1069 | | - | |
1070 | | - | |
1071 | | - | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
1072 | 1047 | | |
1073 | 1048 | | |
1074 | 1049 | | |
1075 | | - | |
1076 | | - | |
1077 | | - | |
1078 | | - | |
1079 | | - | |
1080 | | - | |
1081 | | - | |
1082 | | - | |
1083 | | - | |
1084 | | - | |
1085 | | - | |
1086 | | - | |
1087 | | - | |
1088 | | - | |
1089 | | - | |
1090 | | - | |
1091 | | - | |
1092 | | - | |
1093 | | - | |
1094 | | - | |
1095 | | - | |
1096 | | - | |
1097 | | - | |
1098 | | - | |
1099 | | - | |
1100 | | - | |
1101 | | - | |
1102 | | - | |
1103 | | - | |
1104 | | - | |
1105 | | - | |
1106 | | - | |
1107 | | - | |
1108 | | - | |
1109 | | - | |
1110 | | - | |
1111 | | - | |
1112 | | - | |
1113 | | - | |
1114 | | - | |
1115 | | - | |
1116 | | - | |
1117 | | - | |
1118 | | - | |
1119 | | - | |
1120 | | - | |
1121 | | - | |
1122 | | - | |
1123 | | - | |
1124 | | - | |
1125 | | - | |
1126 | | - | |
1127 | | - | |
1128 | | - | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
1129 | 1061 | | |
1130 | | - | |
1131 | | - | |
1132 | | - | |
1133 | | - | |
1134 | | - | |
1135 | | - | |
1136 | 1062 | | |
1137 | | - | |
1138 | | - | |
| 1063 | + | |
1139 | 1064 | | |
1140 | 1065 | | |
1141 | 1066 | | |
| |||
1551 | 1476 | | |
1552 | 1477 | | |
1553 | 1478 | | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
1554 | 1487 | | |
Lines changed: 18 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
98 | 107 | | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | 108 | | |
104 | 109 | | |
105 | 110 | | |
| |||
116 | 121 | | |
117 | 122 | | |
118 | 123 | | |
119 | | - | |
120 | | - | |
121 | | - | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
122 | 133 | | |
123 | 134 | | |
124 | 135 | | |
| |||
Lines changed: 5 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
138 | | - | |
139 | | - | |
140 | 138 | | |
141 | 139 | | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
150 | 145 | | |
151 | 146 | | |
152 | 147 | | |
| |||
0 commit comments