You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by kl...@apache.org on 2023/07/20 10:29:11 UTC
[incubator-devlake] branch release-v0.18 updated: fix: pipeline dequeue deadlock (#5713)
This is an automated email from the ASF dual-hosted git repository.
klesh pushed a commit to branch release-v0.18
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/release-v0.18 by this push:
new fd626e664 fix: pipeline dequeue deadlock (#5713)
fd626e664 is described below
commit fd626e66496d736991a810c3ee5b16c9c7f34967
Author: Klesh Wong <zh...@merico.dev>
AuthorDate: Thu Jul 20 18:29:07 2023 +0800
fix: pipeline dequeue deadlock (#5713)
---
backend/server/services/pipeline.go | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/backend/server/services/pipeline.go b/backend/server/services/pipeline.go
index f4f07f155..1a1f3006a 100644
--- a/backend/server/services/pipeline.go
+++ b/backend/server/services/pipeline.go
@@ -168,7 +168,6 @@ func GetPipelineLogsArchivePath(pipeline *models.Pipeline) (string, errors.Error
}
func dequeuePipeline(runningParallelLabels []string) (pipeline *models.Pipeline, err errors.Error) {
- pipeline = &models.Pipeline{}
txHelper := dbhelper.NewTxHelper(basicRes, &err)
defer txHelper.End()
tx := txHelper.Begin()
@@ -178,6 +177,7 @@ func dequeuePipeline(runningParallelLabels []string) (pipeline *models.Pipeline,
{Table: "_devlake_pipeline_labels", Exclusive: false},
}))
// prepare query to find an appropriate pipeline to execute
+ pipeline = &models.Pipeline{}
err = tx.First(pipeline,
dal.Where("status IN ?", []string{models.TASK_CREATED, models.TASK_RERUN}),
dal.Join(
@@ -207,6 +207,7 @@ func dequeuePipeline(runningParallelLabels []string) (pipeline *models.Pipeline,
return
}
if tx.IsErrorNotFound(err) {
+ pipeline = nil
err = nil
} else {
// log unexpected err
@@ -230,7 +231,7 @@ func RunPipelineInQueue(pipelineMaxParallel int64) {
var dbPipeline *models.Pipeline
for {
dbPipeline, err = dequeuePipeline(runningParallelLabels)
- if err == nil {
+ if err == nil && dbPipeline != nil {
break
}
time.Sleep(time.Second)