-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Labels
Description
Problem
A race condition in the spinner logging around the rig sync initialization is causing a panic. I've seen this once during rig development where I'd been triggering sync dozens of times, and there has been one other reported case.
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1075db2]
goroutine 1 [running]:
time.(*Ticker).Stop(0x0)
/usr/local/go/src/time/tick.go:46 +0x22
github.com/phase2/rig/vendor/github.com/slok/gospinner.(*Spinner).Stop(0xc4200883c0, 0x0, 0x0)
/go/src/github.com/phase2/rig/vendor/github.com/slok/gospinner/spinner.go:197 +0x103
github.com/phase2/rig/vendor/github.com/slok/gospinner.(*Spinner).FinishWithMessage(0xc4200883c0, 0xc420013ea0, 0xc, 0xc420018c00, 0x23, 0x3, 0xc420107840)
/go/src/github.com/phase2/rig/vendor/github.com/slok/gospinner/spinner.go:240 +0x40
github.com/phase2/rig/vendor/github.com/slok/gospinner.(*Spinner).FinishWithSymbol(0xc4200883c0, 0xc420013ea0, 0xc, 0x0, 0x0)
/go/src/github.com/phase2/rig/vendor/github.com/slok/gospinner/spinner.go:235 +0x51
github.com/phase2/rig/vendor/github.com/slok/gospinner.(*Spinner).Warn(0xc4200883c0, 0xc420018c00, 0x23)
/go/src/github.com/phase2/rig/vendor/github.com/slok/gospinner/spinner.go:220 +0x94
github.com/phase2/rig/util.(*RigLogger).Warning(0xc4200758c0, 0x13fe190, 0x23, 0x0, 0x0, 0x0)
/go/src/github.com/phase2/rig/util/logger.go:101 +0x186
github.com/phase2/rig/util.(*RigLogger).PrivilegeEscallationPrompt(0xc4200758c0)
/go/src/github.com/phase2/rig/util/logger.go:149 +0xc0
github.com/phase2/rig/util.Executor.CombinedOutput(0xc4200c4840, 0x0, 0x0, 0x0, 0x0, 0x0)
/go/src/github.com/phase2/rig/util/shell_exec.go:103 +0xf9
github.com/phase2/rig/commands.(*Machine).SetSysctl(0xc42000ebf8, 0x13fa03b, 0x1b, 0x13f1f07, 0x6, 0x0, 0x0)
/go/src/github.com/phase2/rig/commands/machine.go:277 +0x27b
github.com/phase2/rig/commands.(*ProjectSync).StartUnisonSync(0xc42000ebe0, 0xc4200c46e0, 0xc42016e0c0, 0x11, 0xc420166120, 0xc4200186f0, 0x20, 0x0, 0xc420107860)
/go/src/github.com/phase2/rig/commands/project_sync.go:123 +0x73
github.com/phase2/rig/commands.(*ProjectSync).RunStart(0xc42000ebe0, 0xc4200c46e0, 0xc420140ef0, 0xc42009ebb0)
/go/src/github.com/phase2/rig/commands/project_sync.go:116 +0x277
github.com/phase2/rig/commands.(*ProjectSync).RunStart-fm(0xc4200c46e0, 0x0, 0x0)
/go/src/github.com/phase2/rig/commands/project_sync.go:72 +0x34
github.com/phase2/rig/vendor/github.com/urfave/cli.HandleAction(0x1379ce0, 0xc420140000, 0xc4200c46e0, 0xc420166000, 0x0)
/go/src/github.com/phase2/rig/vendor/github.com/urfave/cli/app.go:490 +0xd2
github.com/phase2/rig/vendor/github.com/urfave/cli.Command.Run(0x13f3419, 0xa, 0x0, 0x0, 0xc420140010, 0x1, 0x1, 0x1402a0d, 0x2f, 0x0, ...)
/go/src/github.com/phase2/rig/vendor/github.com/urfave/cli/command.go:210 +0xa95
github.com/phase2/rig/vendor/github.com/urfave/cli.(*App).RunAsSubcommand(0xc4200116c0, 0xc4200c4420, 0x0, 0x0)
/go/src/github.com/phase2/rig/vendor/github.com/urfave/cli/app.go:379 +0xa7b
github.com/phase2/rig/vendor/github.com/urfave/cli.Command.startApp(0x13f259d, 0x7, 0x0, 0x0, 0xc420047fc0, 0x1, 0x1, 0x13fb8b2, 0x1e, 0x0, ...)
/go/src/github.com/phase2/rig/vendor/github.com/urfave/cli/command.go:298 +0x944
github.com/phase2/rig/vendor/github.com/urfave/cli.Command.Run(0x13f259d, 0x7, 0x0, 0x0, 0xc420047fc0, 0x1, 0x1, 0x13fb8b2, 0x1e, 0x0, ...)
/go/src/github.com/phase2/rig/vendor/github.com/urfave/cli/command.go:98 +0x1319
github.com/phase2/rig/vendor/github.com/urfave/cli.(*App).Run(0xc4200111e0, 0xc42000e140, 0x5, 0x5, 0x0, 0x0)
/go/src/github.com/phase2/rig/vendor/github.com/urfave/cli/app.go:255 +0x6f8
main.main()
/go/src/github.com/phase2/rig/cmd/main.go:64 +0x12b1
Solution
Figure out why this is happening and fix that? Failing this, find the right spot to drop a recover statement to re-start the sync since most runs don't hit this problem.