Open grayside opened 6 years ago
Note that simply re-running the desired command is usually ok and avoids this issue since it is a race condition.
I am able to semi-reliably reproduce this error with these steps:
rig project sync
dies but the rig instance/dev machine is still runningpanic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1072502]
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(0xc4200a83c0, 0x0, 0x0)
/go/src/github.com/phase2/rig/vendor/github.com/slok/gospinner/spinner.go:197 +0xe6
github.com/phase2/rig/vendor/github.com/slok/gospinner.(*Spinner).FinishWithMessage(0xc4200a83c0, 0xc420089b60, 0xc, 0xc420086c60, 0x23, 0x3, 0xc4201336e0)
/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(0xc4200a83c0, 0xc420089b60, 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(0xc4200a83c0, 0xc420086c60, 0x23)
/go/src/github.com/phase2/rig/vendor/github.com/slok/gospinner/spinner.go:220 +0x8a
github.com/phase2/rig/util.(*RigLogger).Warning(0xc420083980, 0x13f71c1, 0x23, 0x0, 0x0, 0x0)
/go/src/github.com/phase2/rig/util/logger.go:126 +0x17c
github.com/phase2/rig/util.(*RigLogger).PrivilegeEscallationPrompt(0xc420083980)
/go/src/github.com/phase2/rig/util/logger.go:176 +0xb6
github.com/phase2/rig/util.Executor.CombinedOutput(0xc4200f0c60, 0x0, 0x0, 0x0, 0x0, 0x0)
/go/src/github.com/phase2/rig/util/shell_exec.go:103 +0xe2
github.com/phase2/rig/commands.(*Machine).SetSysctl(0xc420096b58, 0x13f2dbc, 0x1b, 0x13ea825, 0x6, 0x1362b60, 0xc42016ee70)
/go/src/github.com/phase2/rig/commands/machine.go:277 +0x254
github.com/phase2/rig/commands.(*ProjectSync).StartUnisonSync(0xc420096b40, 0xc4200f0b00, 0xc4201a3740, 0x11, 0xc420157a40, 0xc4200eea80, 0x27, 0x0, 0xc420133700)
/go/src/github.com/phase2/rig/commands/project_sync.go:125 +0x9b
github.com/phase2/rig/commands.(*ProjectSync).RunStart(0xc420096b40, 0xc4200f0b00, 0xc42016ed20, 0xc4200c0bb0)
/go/src/github.com/phase2/rig/commands/project_sync.go:116 +0x264
github.com/phase2/rig/commands.(*ProjectSync).RunStart-fm(0xc4200f0b00, 0x0, 0x0)
/go/src/github.com/phase2/rig/commands/project_sync.go:72 +0x34
github.com/phase2/rig/vendor/github.com/urfave/cli.HandleAction(0x136ec00, 0xc42007fe80, 0xc4200f0b00, 0xc420157900, 0x0)
/go/src/github.com/phase2/rig/vendor/github.com/urfave/cli/app.go:490 +0xc8
github.com/phase2/rig/vendor/github.com/urfave/cli.Command.Run(0x13ebdd9, 0xa, 0x0, 0x0, 0xc42007fe90, 0x1, 0x1, 0x13fbfc8, 0x2f, 0x0, ...)
/go/src/github.com/phase2/rig/vendor/github.com/urfave/cli/command.go:210 +0xa36
github.com/phase2/rig/vendor/github.com/urfave/cli.(*App).RunAsSubcommand(0xc42008d380, 0xc4200f0840, 0x0, 0x0)
/go/src/github.com/phase2/rig/vendor/github.com/urfave/cli/app.go:379 +0xa10
github.com/phase2/rig/vendor/github.com/urfave/cli.Command.startApp(0x13eaf10, 0x7, 0x0, 0x0, 0xc42007fe40, 0x1, 0x1, 0x13f46de, 0x1e, 0x0, ...)
/go/src/github.com/phase2/rig/vendor/github.com/urfave/cli/command.go:298 +0x8d9
github.com/phase2/rig/vendor/github.com/urfave/cli.Command.Run(0x13eaf10, 0x7, 0x0, 0x0, 0xc42007fe40, 0x1, 0x1, 0x13f46de, 0x1e, 0x0, ...)
/go/src/github.com/phase2/rig/vendor/github.com/urfave/cli/command.go:98 +0x1246
github.com/phase2/rig/vendor/github.com/urfave/cli.(*App).Run(0xc42008cea0, 0xc420082090, 0x3, 0x3, 0x0, 0x0)
/go/src/github.com/phase2/rig/vendor/github.com/urfave/cli/app.go:255 +0x6a0
main.main()
/go/src/github.com/phase2/rig/cmd/main.go:70 +0x13df
Error [COMMAND-ERROR]
i generally then run rig stop
, rig start
, eval "$(rig config)"
and everything works just fine
I think I found it: https://github.com/slok/gospinner/pull/3
Believe this fixed with #173 which should be out with the 2.2.0 release which is now available as an RC
Looks like the firx with gospinner hasn't been completely successful in resolving this issue. I just received the following on a rig project sync:start
command with version 2.2.20-rc2
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1071712]
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(0xc4200923c0, 0x0, 0x0)
/go/src/github.com/phase2/rig/vendor/github.com/slok/gospinner/spinner.go:197 +0xe6
github.com/phase2/rig/vendor/github.com/slok/gospinner.(*Spinner).FinishWithMessage(0xc4200923c0, 0xc4200197e0, 0xc, 0xc4200166f0, 0x23, 0x3, 0xc4201194c0)
/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(0xc4200923c0, 0xc4200197e0, 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(0xc4200923c0, 0xc4200166f0, 0x23)
/go/src/github.com/phase2/rig/vendor/github.com/slok/gospinner/spinner.go:220 +0x8a
github.com/phase2/rig/util.(*RigLogger).Warning(0xc42000f9e0, 0x13fb44f, 0x23, 0x0, 0x0, 0x0)
/go/src/github.com/phase2/rig/util/logger.go:126 +0x17c
github.com/phase2/rig/util.(*RigLogger).PrivilegeEscalationPrompt(0xc42000f9e0)
/go/src/github.com/phase2/rig/util/logger.go:176 +0xb6
github.com/phase2/rig/util.Executor.CombinedOutput(0xc4200d69a0, 0x0, 0x0, 0x0, 0x0, 0x0)
/go/src/github.com/phase2/rig/util/shell_exec.go:134 +0xe2
github.com/phase2/rig/commands.(*Machine).SetSysctl(0xc420086dd8, 0x13f6f44, 0x1b, 0x13ee7cf, 0x6, 0x4, 0x3)
/go/src/github.com/phase2/rig/commands/machine.go:277 +0x254
github.com/phase2/rig/commands.(*ProjectSync).StartUnisonSync(0xc420086dc0, 0xc4200d6840, 0xc42017a820, 0x11, 0xc42013ec60, 0xc42001c870, 0x39, 0x0, 0x0)
/go/src/github.com/phase2/rig/commands/project_sync.go:316 +0x9b
github.com/phase2/rig/commands.(*ProjectSync).RunStart(0xc420086dc0, 0xc4200d6840, 0xc42016a8c0, 0xc4200aaba8)
/go/src/github.com/phase2/rig/commands/project_sync.go:167 +0x1ee
github.com/phase2/rig/commands.(*ProjectSync).RunStart-fm(0xc4200d6840, 0x0, 0x0)
/go/src/github.com/phase2/rig/commands/project_sync.go:71 +0x34
github.com/phase2/rig/vendor/github.com/urfave/cli.HandleAction(0x1372720, 0xc42004fb70, 0xc4200d6840, 0xc42013eb00, 0x0)
/go/src/github.com/phase2/rig/vendor/github.com/urfave/cli/app.go:490 +0xc8
github.com/phase2/rig/vendor/github.com/urfave/cli.Command.Run(0x13efdbd, 0xa, 0x0, 0x0, 0xc42004fb80, 0x1, 0x1, 0x1400395, 0x2f, 0x0, ...)
/go/src/github.com/phase2/rig/vendor/github.com/urfave/cli/command.go:210 +0xa36
github.com/phase2/rig/vendor/github.com/urfave/cli.(*App).RunAsSubcommand(0xc42007f1e0, 0xc4200d6580, 0x0, 0x0)
/go/src/github.com/phase2/rig/vendor/github.com/urfave/cli/app.go:379 +0xa10
github.com/phase2/rig/vendor/github.com/urfave/cli.Command.startApp(0x13eeeb3, 0x7, 0x0, 0x0, 0xc42004fb30, 0x1, 0x1, 0x13f892b, 0x1e, 0x0, ...)
/go/src/github.com/phase2/rig/vendor/github.com/urfave/cli/command.go:298 +0x8d9
github.com/phase2/rig/vendor/github.com/urfave/cli.Command.Run(0x13eeeb3, 0x7, 0x0, 0x0, 0xc42004fb30, 0x1, 0x1, 0x13f892b, 0x1e, 0x0, ...)
/go/src/github.com/phase2/rig/vendor/github.com/urfave/cli/command.go:98 +0x1246
github.com/phase2/rig/vendor/github.com/urfave/cli.(*App).Run(0xc42007eea0, 0xc42000e0c0, 0x3, 0x3, 0x0, 0x0)
/go/src/github.com/phase2/rig/vendor/github.com/urfave/cli/app.go:255 +0x6a0
main.main()
/go/src/github.com/phase2/rig/cmd/main.go:71 +0x1545
Just to add...I have also gotten this seg fault in the rc2 version.
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.
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.