From 0c835b7d7710ef6ecb08c2d54802951f137f0cb2 Mon Sep 17 00:00:00 2001 From: Tom Clegg Date: Fri, 15 Dec 2017 19:13:24 -0500 Subject: [PATCH] 12821: Fix race in concurrent calls to submit(). Arvados-DCO-1.1-Signed-off-by: Tom Clegg --- services/crunch-dispatch-slurm/crunch-dispatch-slurm.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go b/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go index 3d094c7f6e..3c89103f38 100644 --- a/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go +++ b/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go @@ -222,7 +222,12 @@ func submit(dispatcher *dispatch.Dispatcher, container arvados.Container, crunch // Send a tiny script on stdin to execute the crunch-run // command (slurm requires this to be a #! script) - cmd.Stdin = strings.NewReader(execScript(append(crunchRunCommand, container.UUID))) + + // append() here avoids modifying crunchRunCommand's + // underlying array, which is shared with other goroutines. + args := append([]string(nil), crunchRunCommand...) + args = append(args, container.UUID) + cmd.Stdin = strings.NewReader(execScript(args)) var stdout, stderr bytes.Buffer cmd.Stdout = &stdout -- 2.39.5