SEPURI-SAI-KRISHNA commented on PR #18541:
URL: 
https://github.com/apache/dolphinscheduler/pull/18541#issuecomment-5236515749

   Good catch, thanks — confirmed and fixed in the follow-up commit.
   
   I traced the chain to be sure:
   
   - `AbstractTaskInstanceFactory#cloneTaskInstance` copies `appLink`
   - `TaskExecutionContextBuilder#buildAppIds` sets 
`taskExecutionContext.setAppIds(taskInstance.getAppLink())`
   - `AbstractRemoteTask#handle` returns early when `appIds` is not empty:
   
   ```java
   if (StringUtils.isNotEmpty(taskRequest.getAppIds())) {
       setAppIds(taskRequest.getAppIds());
       trackApplicationStatus();
       return;
   }
   submitApplication();
   ```
   
   So recovering a failed Spark/Flink/EMR-style task would never resubmit — it 
would attach to
   the already-dead application from the previous attempt. Same bug class as 
the other fields
   in this PR, so it belongs here.
   
   `FailedRecoverTaskInstanceFactory#createTaskInstance` now clears `appLink`, 
and
   
`FailedRecoverTaskInstanceFactoryTest#testCreateTaskInstance_clearPreviousRuntimeState`
   asserts it. I verified the assertion fails without the reset
   (`expected: null but was: application_1717430400000_0001`) and passes with 
it.
   
   ## One related question
   
   While checking this I noticed the same gap in 
`RetryTaskInstanceFactory#createTaskInstance` —
   it resets `pid`, `startTime`, `endTime` and increments `retryTimes`, but 
does not clear
   `appLink` either. A retry is also a fresh attempt, so it looks like it would 
attach to the
   dead application in the same way.
   
   `FailoverTaskInstanceFactory` keeping `appLink` is clearly deliberate — the 
remote
   application is still alive there and the new attempt should take it over 
rather than
   resubmit — so the intent seems to be "failover keeps `appLink`, every other 
new attempt
   clears it".
   
   Would you like me to include the `RetryTaskInstanceFactory` fix in this PR, 
or should I
   open a separate issue/PR for it to keep this one scoped?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to