-
Notifications
You must be signed in to change notification settings - Fork 288
Closed
Description
I'm using s5cmd run
to issue a large number of cp
commands in parallel. I intermittently see runs fail with this stack trace:
panic: cp flag redefined: help
goroutine 23 [running]:
flag.(*FlagSet).Var(0xc0004000c0, 0xd860e0, 0xc000422338, 0xc000422318, 0x4, 0xb5eaee, 0x9)
/opt/hostedtoolcache/go/1.14.12/x64/src/flag/flag.go:851 +0x4b8
flag.(*FlagSet).BoolVar(...)
/opt/hostedtoolcache/go/1.14.12/x64/src/flag/flag.go:624
flag.(*FlagSet).Bool(0xc0004000c0, 0xc000422318, 0x4, 0x0, 0xb5eaee, 0x9, 0x2)
/opt/hostedtoolcache/go/1.14.12/x64/src/flag/flag.go:637 +0x8a
github.com/urfave/cli/v2.(*BoolFlag).Apply(0x11d07a0, 0xc0004000c0, 0x0, 0x0)
/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.2.0/flag_bool.go:81 +0x201
github.com/urfave/cli/v2.flagSet(0xb59958, 0x2, 0xc0001c29a0, 0xd, 0x16, 0x203000, 0x203000, 0xc00012ada8)
/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.2.0/flag.go:125 +0x93
github.com/urfave/cli/v2.(*Command).newFlagSet(...)
/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.2.0/command.go:173
github.com/urfave/cli/v2.(*Command).parseFlags(0x11d1b40, 0xd90f20, 0xc000416000, 0xd8e800, 0x11d07a0, 0xb47500, 0x0)
/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.2.0/command.go:181 +0x62
github.com/urfave/cli/v2.(*Command).Run(0x11d1b40, 0xc0001b14c0, 0x0, 0x0)
/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.2.0/command.go:106 +0x100
github.com/peak/s5cmd/command.glob..func19.2(0x0, 0x0)
/home/runner/work/s5cmd/s5cmd/command/run.go:123 +0x1d1
github.com/peak/s5cmd/parallel.(*Manager).Run.func1(0xc0001b9f00, 0xc000382b60, 0xc000369ec0)
/home/runner/work/s5cmd/s5cmd/parallel/parallel.go:57 +0x75
created by github.com/peak/s5cmd/parallel.(*Manager).Run
/home/runner/work/s5cmd/s5cmd/parallel/parallel.go:53 +0xa9
I speculate that the bug is a concurrency issue where multiple goroutines are executing a cp
in parallel and somehow end up trying to populate the flags concurrently; but I haven't isolated the exact issue.