Open trim21 opened 4 months ago
@trim21 This can likely be fixed by adding a mutex to the OrderedMap
implementation. However, it would be really useful if there was a reproduceable test for this. Is this something that you see consistently? If so, are you able to provide a reproducable example?
@trim21 This can likely be fixed by adding a mutex to the
OrderedMap
implementation. However, it would be really useful if there was a reproduceable test for this. Is this something that you see consistently? If so, are you able to provide a reproducable example?
I'm using a taskfile with glob source and generated. But I'm not sure how to re-produce this.
@trim21 No problem. Hopefully #1608 will fix your issue.
I'm getting the same issue at the moment. It's been happening fairly often. It seems to happen less frequently when I limit the concurrency via -C1
(or even -C2
sometimes), or when I run my task for just a single target.
I'm now experiencing it on a single task which runs a complicated nested loop in Bash.
Task version: v3.37.0 (h1:9752Ej9q4RlG2vkbMKMX89EvrZCSyReBQ6N1hGniiCE=)
TASK_X_*
env var, right?)Stack traces:
$ task import SHORTCUT_PATH=Archive/Archive\ on\ Wayback\ Machine
task: [import:export-from-account] shortcuts run 'Export Shortcuts'
task: [import:extract] tmp=$(mktemp -d); cat '/Users/tim_vergenz/Library/Mobile Documents/iCloud~is~workflow~my~workflows/Documents'/'Archive/Archive on Wayback Machine'.shortcut | tee build/'Archive/Archive on Wayback Machine'.shortcut | fq -r -d bytes '.[((.[0x8:0xC] | explode | reverse | tobytes | tonumber) + 0x495c):] | print' | lzfse -decode | aa extract -d "$tmp" && mv "$tmp"/Shortcut.wflow build/'Archive/Archive on Wayback Machine'.wflow && cat build/'Archive/Archive on Wayback Machine'.wflow | plutil -convert json -o - - | jq --sort-keys '(.WFWorkflowTypes, .WFWorkflowOutputContentItemClasses) |= sort' > build/'Archive/Archive on Wayback Machine'-in.json
task: [import:default] jsonnetfmt build/'Archive/Archive on Wayback Machine'-in.json > src/'Archive/Archive on Wayback Machine'.jsonnet
task: [import:default] phase=1; seen=(); while find lib/ast-grep/rules/$phase-* -quit 2>/dev/null; do while ! printf '%s\n' "${seen[@]}" | grep -qF -e "${next_sha:=next}"; do seen+=("${next_sha:-}"); find lib/ast-grep/rules/$phase-* -exec sg scan --update-all --rule='{}' src/'Archive/Archive on Wayback Machine'.jsonnet \; && jsonnetfmt -i src/'Archive/Archive on Wayback Machine'.jsonnet; next_sha=$(sha1sum src/'Archive/Archive on Wayback Machine'.jsonnet | awk '{print $1}'); done; phase=$((phase+1)); done;
fatal error: concurrent map read and map write
goroutine 64 [running]:
mvdan.cc/sh/v3/interp.(*overlayEnviron).Get(0xc000398280, {0x14c308a, 0x3})
mvdan.cc/sh/v3@v3.8.0/interp/vars.go:29 +0x87
mvdan.cc/sh/v3/interp.(*overlayEnviron).Get(0xc000398500, {0x14c308a, 0x3})
mvdan.cc/sh/v3@v3.8.0/interp/vars.go:32 +0x110
mvdan.cc/sh/v3/interp.(*Runner).lookupVar(0xc000004900, {0x14c308a, 0x3})
mvdan.cc/sh/v3@v3.8.0/interp/vars.go:159 +0x3ed
mvdan.cc/sh/v3/interp.expandEnv.Get({0x0?}, {0x14c308a?, 0x0?})
mvdan.cc/sh/v3@v3.8.0/interp/runner.go:227 +0x4b
mvdan.cc/sh/v3/expand.prepareConfig(0x0?)
mvdan.cc/sh/v3@v3.8.0/expand/expand.go:113 +0xae
mvdan.cc/sh/v3/expand.Fields(0x3?, {0xc000010030, 0x3, 0x3?})
mvdan.cc/sh/v3@v3.8.0/expand/expand.go:447 +0x32
mvdan.cc/sh/v3/interp.(*Runner).fields(0xc000004900, {0xc000010030?, 0xc00039e5a0?, 0x13?})
mvdan.cc/sh/v3@v3.8.0/interp/runner.go:196 +0x27
mvdan.cc/sh/v3/interp.(*Runner).cmd(0xc000004900, {0x157a790?, 0xc00039e5a0}, {0x1579c98?, 0xc0001e55f0?})
mvdan.cc/sh/v3@v3.8.0/interp/runner.go:368 +0x24ab
mvdan.cc/sh/v3/interp.(*Runner).stmtSync(0xc000004900, {0x157a790, 0xc00039e5a0}, 0xc00029a1b8)
mvdan.cc/sh/v3@v3.8.0/interp/runner.go:314 +0x285
mvdan.cc/sh/v3/interp.(*Runner).stmt(0xc000004900, {0x157a790?, 0xc00039e5a0}, 0xc00029a1b8)
mvdan.cc/sh/v3@v3.8.0/interp/runner.go:295 +0x159
mvdan.cc/sh/v3/interp.(*Runner).cmd.func1()
mvdan.cc/sh/v3@v3.8.0/interp/runner.go:454 +0x39
created by mvdan.cc/sh/v3/interp.(*Runner).cmd in goroutine 1
mvdan.cc/sh/v3@v3.8.0/interp/runner.go:453 +0x476
goroutine 1 [runnable]:
mvdan.cc/sh/v3/expand.(*Config).paramExp(0xc0001e8140, 0xc000428af0)
mvdan.cc/sh/v3@v3.8.0/expand/param.go:336 +0x1602
mvdan.cc/sh/v3/expand.(*Config).wordField(0xc0001e8140, {0xc00004aaf0?, 0x1, 0x0?}, 0x1)
mvdan.cc/sh/v3@v3.8.0/expand/expand.go:544 +0x3b1
mvdan.cc/sh/v3/expand.(*Config).wordFields(0xc0001e8140, {0xc0002541f8?, 0x1, 0x1018bc8?})
mvdan.cc/sh/v3@v3.8.0/expand/expand.go:670 +0x48b
mvdan.cc/sh/v3/expand.Fields(0x4?, {0xc000398560, 0x4, 0x4?})
mvdan.cc/sh/v3@v3.8.0/expand/expand.go:457 +0x208
mvdan.cc/sh/v3/interp.(*Runner).fields(0xc000004600, {0xc000398560?, 0xc00039e5a0?, 0x0?})
mvdan.cc/sh/v3@v3.8.0/interp/runner.go:196 +0x27
mvdan.cc/sh/v3/interp.(*Runner).cmd(0xc000004600, {0x157a790?, 0xc00039e5a0}, {0x1579c98?, 0xc0001e5640?})
mvdan.cc/sh/v3@v3.8.0/interp/runner.go:368 +0x24ab
mvdan.cc/sh/v3/interp.(*Runner).stmtSync(0xc000004600, {0x157a790, 0xc00039e5a0}, 0xc00029a210)
mvdan.cc/sh/v3@v3.8.0/interp/runner.go:314 +0x285
mvdan.cc/sh/v3/interp.(*Runner).stmt(0xc000004600, {0x157a790?, 0xc00039e5a0}, 0xc00029a210)
mvdan.cc/sh/v3@v3.8.0/interp/runner.go:295 +0x159
mvdan.cc/sh/v3/interp.(*Runner).cmd(0xc000004600, {0x157a790?, 0xc00039e5a0}, {0x1579d88?, 0xc000398120?})
mvdan.cc/sh/v3@v3.8.0/interp/runner.go:458 +0x49f
mvdan.cc/sh/v3/interp.(*Runner).stmtSync(0xc000004600, {0x157a790, 0xc00039e5a0}, 0xc00029a268)
mvdan.cc/sh/v3@v3.8.0/interp/runner.go:314 +0x285
mvdan.cc/sh/v3/interp.(*Runner).stmt(0xc000004600, {0x157a790?, 0xc00039e5a0}, 0xc00029a268)
mvdan.cc/sh/v3@v3.8.0/interp/runner.go:295 +0x159
mvdan.cc/sh/v3/interp.(*Runner).stmts(...)
mvdan.cc/sh/v3@v3.8.0/interp/runner.go:795
mvdan.cc/sh/v3/interp.(*Runner).cmd(0xc000004600, {0x157a790?, 0xc00039e5a0}, {0x1579d28?, 0xc00016c180?})
mvdan.cc/sh/v3@v3.8.0/interp/runner.go:485 +0x205f
mvdan.cc/sh/v3/interp.(*Runner).stmtSync(0xc000004600, {0x157a790, 0xc00039e5a0}, 0xc00029a160)
mvdan.cc/sh/v3@v3.8.0/interp/runner.go:314 +0x285
mvdan.cc/sh/v3/interp.(*Runner).stmt(0xc000004600, {0x157a790?, 0xc00039e5a0}, 0xc00029a160)
mvdan.cc/sh/v3@v3.8.0/interp/runner.go:295 +0x159
mvdan.cc/sh/v3/interp.(*Runner).loopStmtsBroken(0xc000004600, {0x157a790, 0xc00039e5a0}, {0xc0002b09c0, 0x2, 0x0?})
mvdan.cc/sh/v3@v3.8.0/interp/runner.go:895 +0xbb
mvdan.cc/sh/v3/interp.(*Runner).cmd(0xc000004600, {0x157a790?, 0xc00039e5a0}, {0x1579d28?, 0xc00016c100?})
mvdan.cc/sh/v3@v3.8.0/interp/runner.go:490 +0x201f
mvdan.cc/sh/v3/interp.(*Runner).stmtSync(0xc000004600, {0x157a790, 0xc00039e5a0}, 0xc00029a0b0)
mvdan.cc/sh/v3@v3.8.0/interp/runner.go:314 +0x285
mvdan.cc/sh/v3/interp.(*Runner).stmt(0xc000004600, {0x157a790?, 0xc00039e5a0}, 0xc00029a0b0)
mvdan.cc/sh/v3@v3.8.0/interp/runner.go:295 +0x159
mvdan.cc/sh/v3/interp.(*Runner).stmts(...)
mvdan.cc/sh/v3@v3.8.0/interp/runner.go:795
mvdan.cc/sh/v3/interp.(*Runner).Run(0xc000004600, {0x157a790, 0xc00039e5a0}, {0x15785a8?, 0xc00004a9c0})
mvdan.cc/sh/v3@v3.8.0/interp/api.go:749 +0x2d6
github.com/go-task/task/v3/internal/execext.RunCommand({0x157a790, 0xc00039e5a0}, 0xc0001f7650)
github.com/go-task/task/v3@v3.37.0/internal/execext/exec.go:90 +0x8ab
github.com/go-task/task/v3.(*Executor).runCommand(0xc0001e9680, {0x157a790, 0xc00039e5a0}, 0xc00017e000, 0xc00007c6c0?, 0x10?)
github.com/go-task/task/v3@v3.37.0/task.go:357 +0x89a
github.com/go-task/task/v3.(*Executor).RunTask.func1({0x157a790, 0xc00039e5a0})
github.com/go-task/task/v3@v3.37.0/task.go:251 +0x7bd
github.com/go-task/task/v3.(*Executor).startExecution(0xc0001e9680, {0x157a790, 0xc00039e5a0}, 0xe?, 0xc0001f79d8)
github.com/go-task/task/v3@v3.37.0/task.go:387 +0x382
github.com/go-task/task/v3.(*Executor).RunTask(0xc0001e9680, {0x157a790, 0xc00039e5a0}, 0xc00007c6c0)
github.com/go-task/task/v3@v3.37.0/task.go:196 +0x34d
github.com/go-task/task/v3.(*Executor).Run(0xc0001e9680, {0x157a6d0, 0x186c500}, {0xc000070220, 0x1, 0x1})
github.com/go-task/task/v3@v3.37.0/task.go:129 +0x359
main.run()
github.com/go-task/task/v3@v3.37.0/cmd/task/task.go:194 +0xb5d
main.main()
github.com/go-task/task/v3@v3.37.0/cmd/task/task.go:24 +0x1f
goroutine 8 [syscall]:
os/signal.signal_recv()
runtime/sigqueue.go:149 +0x25
os/signal.loop()
os/signal/signal_unix.go:23 +0x13
created by os/signal.Notify.func1.1 in goroutine 1
os/signal/signal.go:151 +0x1f
goroutine 33 [chan receive]:
github.com/go-task/task/v3.(*Executor).InterceptInterruptSignals.func1()
github.com/go-task/task/v3@v3.37.0/signals.go:20 +0x65
created by github.com/go-task/task/v3.(*Executor).InterceptInterruptSignals in goroutine 1
github.com/go-task/task/v3@v3.37.0/signals.go:18 +0xc9
goroutine 65 [sleep]:
time.Sleep(0x37e11d600)
runtime/time.go:195 +0x125
github.com/go-task/task/v3/internal/execext.execHandler.DefaultExecHandler.func1.1.1()
mvdan.cc/sh/v3@v3.8.0/interp/handler.go:126 +0x25
created by github.com/go-task/task/v3/internal/execext.execHandler.DefaultExecHandler.func1.1 in goroutine 14
mvdan.cc/sh/v3@v3.8.0/interp/handler.go:125 +0x7f
goroutine 61 [sleep]:
time.Sleep(0x37e11d600)
runtime/time.go:195 +0x125
github.com/go-task/task/v3/internal/execext.execHandler.DefaultExecHandler.func1.1.1()
mvdan.cc/sh/v3@v3.8.0/interp/handler.go:126 +0x25
created by github.com/go-task/task/v3/internal/execext.execHandler.DefaultExecHandler.func1.1 in goroutine 15
mvdan.cc/sh/v3@v3.8.0/interp/handler.go:125 +0x7f
goroutine 59 [sleep]:
time.Sleep(0x37e11d600)
runtime/time.go:195 +0x125
github.com/go-task/task/v3/internal/execext.execHandler.DefaultExecHandler.func1.1.1()
mvdan.cc/sh/v3@v3.8.0/interp/handler.go:126 +0x25
created by github.com/go-task/task/v3/internal/execext.execHandler.DefaultExecHandler.func1.1 in goroutine 97
mvdan.cc/sh/v3@v3.8.0/interp/handler.go:125 +0x7f
goroutine 85 [chan receive]:
github.com/go-task/task/v3/internal/execext.execHandler.DefaultExecHandler.func1.1()
mvdan.cc/sh/v3@v3.8.0/interp/handler.go:115 +0x2f
created by github.com/go-task/task/v3/internal/execext.execHandler.DefaultExecHandler.func1 in goroutine 1
mvdan.cc/sh/v3@v3.8.0/interp/handler.go:114 +0x34b
goroutine 56 [sleep]:
time.Sleep(0x37e11d600)
runtime/time.go:195 +0x125
github.com/go-task/task/v3/internal/execext.execHandler.DefaultExecHandler.func1.1.1()
mvdan.cc/sh/v3@v3.8.0/interp/handler.go:126 +0x25
created by github.com/go-task/task/v3/internal/execext.execHandler.DefaultExecHandler.func1.1 in goroutine 113
mvdan.cc/sh/v3@v3.8.0/interp/handler.go:125 +0x7f
goroutine 60 [sleep]:
time.Sleep(0x37e11d600)
runtime/time.go:195 +0x125
github.com/go-task/task/v3/internal/execext.execHandler.DefaultExecHandler.func1.1.1()
mvdan.cc/sh/v3@v3.8.0/interp/handler.go:126 +0x25
created by github.com/go-task/task/v3/internal/execext.execHandler.DefaultExecHandler.func1.1 in goroutine 81
mvdan.cc/sh/v3@v3.8.0/interp/handler.go:125 +0x7f
goroutine 57 [sleep]:
time.Sleep(0x37e11d600)
runtime/time.go:195 +0x125
github.com/go-task/task/v3/internal/execext.execHandler.DefaultExecHandler.func1.1.1()
mvdan.cc/sh/v3@v3.8.0/interp/handler.go:126 +0x25
created by github.com/go-task/task/v3/internal/execext.execHandler.DefaultExecHandler.func1.1 in goroutine 38
mvdan.cc/sh/v3@v3.8.0/interp/handler.go:125 +0x7f
goroutine 58 [sleep]:
time.Sleep(0x37e11d600)
runtime/time.go:195 +0x125
github.com/go-task/task/v3/internal/execext.execHandler.DefaultExecHandler.func1.1.1()
mvdan.cc/sh/v3@v3.8.0/interp/handler.go:126 +0x25
created by github.com/go-task/task/v3/internal/execext.execHandler.DefaultExecHandler.func1.1 in goroutine 39
mvdan.cc/sh/v3@v3.8.0/interp/handler.go:125 +0x7f
goroutine 54 [sleep]:
time.Sleep(0x37e11d600)
runtime/time.go:195 +0x125
github.com/go-task/task/v3/internal/execext.execHandler.DefaultExecHandler.func1.1.1()
mvdan.cc/sh/v3@v3.8.0/interp/handler.go:126 +0x25
created by github.com/go-task/task/v3/internal/execext.execHandler.DefaultExecHandler.func1.1 in goroutine 42
mvdan.cc/sh/v3@v3.8.0/interp/handler.go:125 +0x7f
goroutine 55 [sleep]:
time.Sleep(0x37e11d600)
runtime/time.go:195 +0x125
github.com/go-task/task/v3/internal/execext.execHandler.DefaultExecHandler.func1.1.1()
mvdan.cc/sh/v3@v3.8.0/interp/handler.go:126 +0x25
created by github.com/go-task/task/v3/internal/execext.execHandler.DefaultExecHandler.func1.1 in goroutine 53
mvdan.cc/sh/v3@v3.8.0/interp/handler.go:125 +0x7f
goroutine 98 [sleep]:
time.Sleep(0x37e11d600)
runtime/time.go:195 +0x125
github.com/go-task/task/v3/internal/execext.execHandler.DefaultExecHandler.func1.1.1()
mvdan.cc/sh/v3@v3.8.0/interp/handler.go:126 +0x25
created by github.com/go-task/task/v3/internal/execext.execHandler.DefaultExecHandler.func1.1 in goroutine 52
mvdan.cc/sh/v3@v3.8.0/interp/handler.go:125 +0x7f
goroutine 84 [sleep]:
time.Sleep(0x37e11d600)
runtime/time.go:195 +0x125
github.com/go-task/task/v3/internal/execext.execHandler.DefaultExecHandler.func1.1.1()
mvdan.cc/sh/v3@v3.8.0/interp/handler.go:126 +0x25
created by github.com/go-task/task/v3/internal/execext.execHandler.DefaultExecHandler.func1.1 in goroutine 41
mvdan.cc/sh/v3@v3.8.0/interp/handler.go:125 +0x7f
goroutine 22 [sleep]:
time.Sleep(0x37e11d600)
runtime/time.go:195 +0x125
github.com/go-task/task/v3/internal/execext.execHandler.DefaultExecHandler.func1.1.1()
mvdan.cc/sh/v3@v3.8.0/interp/handler.go:126 +0x25
created by github.com/go-task/task/v3/internal/execext.execHandler.DefaultExecHandler.func1.1 in goroutine 83
mvdan.cc/sh/v3@v3.8.0/interp/handler.go:125 +0x7f
goroutine 86 [chan receive]:
github.com/go-task/task/v3/internal/execext.execHandler.DefaultExecHandler.func1.1()
mvdan.cc/sh/v3@v3.8.0/interp/handler.go:115 +0x2f
created by github.com/go-task/task/v3/internal/execext.execHandler.DefaultExecHandler.func1 in goroutine 1
mvdan.cc/sh/v3@v3.8.0/interp/handler.go:114 +0x34b
goroutine 63 [chan receive]:
github.com/go-task/task/v3/internal/execext.execHandler.DefaultExecHandler.func1.1()
mvdan.cc/sh/v3@v3.8.0/interp/handler.go:115 +0x2f
created by github.com/go-task/task/v3/internal/execext.execHandler.DefaultExecHandler.func1 in goroutine 1
mvdan.cc/sh/v3@v3.8.0/interp/handler.go:114 +0x34b
And of course right after I post https://github.com/go-task/task/issues/1605#issuecomment-2119195158 the individual task succeeded on simply rerunning. 🙂
I'm getting this as well when running deps in parallel
FYI I think there may be a few different issues at play here. My particular issue seems to stem from some sort of non-parallel-compatibility in https://github.com/mvdan/sh. My issue also did not get resolved by the branch at #1701.
This commit in my project (which reworked a complicated shell command I was using) seems to have resolved the concurrency issue for me. I haven't quite narrowed down exactly which shell functionality was causing the bug, but my current best guess is the ${var:=default_value}
functionality (assignment plus substitution if unset or null), given that the error dumps often seemed to be referencing shell variable reads/updates. 🤷♂️
Also saw something similar with output: prefixed
fatal error: concurrent map read and map write
[
goroutine 205 [running]:
github.com/go-task/task/v3/internal/output.(*prefixWriter).writeLine(0x1400031cc80, {0x140001441e0, 0x26})
/Users/chirino/go/pkg/mod/github.com/go-task/task/v3@v3.38.0/internal/output/prefixed.go:88 +0x9c
github.com/go-task/task/v3/internal/output.(*prefixWriter).writeOutputLines(0x1400031cc80, 0x0)
/Users/chirino/go/pkg/mod/github.com/go-task/task/v3@v3.38.0/internal/output/prefixed.go:58 +0x70
github.com/go-task/task/v3/internal/output.(*prefixWriter).Write(0x1400031cc80, {0x14000668000?, 0x1400012cda8?, 0x104bf5afc?})
/Users/chirino/go/pkg/mod/github.com/go-task/task/v3@v3.38.0/internal/output/prefixed.go:47 +0x50
I just got this as well. Also using output: prefixed if that is relevant.
Running some tasks in parallel via deps:
asset-searchmhm@mhm:~/Documents/asset-search$ task --dry deploy:development
task: [install] pipenv sync --dev
task: [test] pipenv run pytest -s -v
task: [docker:harbor-login] docker login harbor.one.com
task: Task "docker:build-frontend" is up to date
task: Task "docker:build-backend" is up to date
task: [docker:push] docker push backend:latest
task: [docker:push] docker push frontend:latest
task: [kubernetes:cluster] kubectl config use-context $(whoami)-wip1-k8s-cph3
task: [kubernetes:namespace] kubectl config set-context --current --namespace=playground-mhm
task: Task "kubernetes:apply" is up to date
task: [kubernetes:restart] kubectl rollout restart deployment wip1-asset-search-backend
task: [kubernetes:restart] kubectl rollout restart deployment wip1-asset-search-frontend
I get the error consistently.
Moving everything to cmds makes it run in sequence, and then it works.
However the run-time goes from around 2 sec to around 14 sec. Not the end of the world in this case though.
please try this branch https://github.com/go-task/task/pull/1701 if you encounter this issue.
I'm running job with
--watch