narrowizard opened a new issue, #8525:
URL: https://github.com/apache/incubator-devlake/issues/8525

   ### Search before asking
   
   - [x] I had searched in the 
[issues](https://github.com/apache/incubator-devlake/issues?q=is%3Aissue) and 
found no similar issues.
   
   
   ### What happened
   
   The pipeline status change notification mechanism in DevLake is not behaving 
as expected. We observed that for a specific pipeline (e.g., pipeline ID 2976 
as shown in the logs), the `TASK_CREATED` notification was sent twice, while 
the subsequent `TASK_RUNNING` notification was entirely missed. The pipeline 
then directly transitioned to `TASK_COMPLETED` notification. This deviates from 
the expected notification flow where `TASK_CREATED`, `TASK_RUNNING`, and 
`TASK_COMPLETED` notifications are sent sequentially as the pipeline progresses 
through these states.
   
   <img width="748" height="314" alt="Image" 
src="https://github.com/user-attachments/assets/59a5e188-3255-42cc-818f-668aea8ed692";
 />
   
   ### What do you expect to happen
   
   We expect the pipeline status change notifications to be sent accurately and 
uniquely for each distinct status change. Specifically, for a typical pipeline 
execution, we anticipate receiving notifications in the following order: 
`TASK_CREATED`, `TASK_RUNNING`, and `TASK_COMPLETED` (or other relevant 
terminal states like `TASK_FAILED`). There should be no duplicate notifications 
for the same status, and no intermediate status notifications should be skipped.
   
   ### How to reproduce
   
   1.  Run a DevLake pipeline.
   2.  Monitor the pipeline status change notifications (e.g., by observing the 
callback logs or notification recipients).
   3.  Observe that for some pipelines, `TASK_CREATED` notifications are sent 
twice, and `TASK_RUNNING` notifications are skipped, directly proceeding to 
`TASK_COMPLETED`.
   
   ### Anything else
   
   **Investigation/Root Cause:**
   Preliminary investigation suggests that this issue might be caused by the 
notification being sent before the pipeline status change transaction is fully 
committed to the database. This could lead to reading an uncommitted state or 
triggering the notification logic prematurely, resulting in duplicate or missed 
status updates in the notification stream.  
   Relative code  
   
https://github.com/apache/incubator-devlake/blob/2d8cca1a43b40a4a023f538fd79143d638e7b53b/backend/server/services/pipeline.go#L297-L301
   
   ### Version
   
   main
   
   ### 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)
   


-- 
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