Panic on startup if Public IP retrieval from API failed
gozer opened this issue · comments
Noticed this hapenning from an agent that can't talk to the internet directly but doesn't have it's outbound proxy configured proprely
$> mig-agent -d
[info] Using external conf from "/etc/mig/mig-agent.cfg"
2017/04/13 14:39:59 - - - [debug] leaving initChannels()
2017/04/13 14:39:59 - - - [debug] Logging routine initialized.
2017/04/13 14:39:59 - - - [debug] Ident is AmazonAMI 2017.03 n/a
2017/04/13 14:39:59 - - - [debug] Init is upstart
2017/04/13 14:39:59 - - - [debug] leaving findOSInfo()
2017/04/13 14:39:59 - - - [debug] Found local address 10.x.x.x/27
2017/04/13 14:39:59 - - - [info] Public IP retrieval from API failed. Error was: Get https://api.mig.mozilla.org/api/v1/ip: unexpected EOF
2017/04/13 14:39:59 - - - [error] Failed to retrieve public ip from api: Get https://api.mig.mozilla.org/api/v1/ip: unexpected EOF
2017/04/13 14:39:59 - - - [debug] leaving initAgent()
2017/04/13 14:39:59 - - - [error] Init failed: 'initAgent() -> NewAgentContext() -> Get https://api.mig.mozilla.org/api/v1/ip: unexpected EOF'
panic: initAgent() -> NewAgentContext() -> Get https://api.mig.mozilla.org/api/v1/ip: unexpected EOF
goroutine 1 [running]:
panic(0x953a80, 0xc820120880)
/usr/local/go/src/runtime/panic.go:481 +0x3e6
main.runAgent(0x1, 0xa2abf0, 0x5, 0xa31070, 0xd, 0xa83950, 0x16, 0xa41140, 0x9, 0x1, ...)
/home/migbuilder/build_mig/go/src/mig.ninja/mig/mig-agent/agent.go:339 +0x366
main.main()
/home/migbuilder/build_mig/go/src/mig.ninja/mig/mig-agent/agent.go:140 +0x81c
@gozer thanks, I'll look into this. I don't know if we should consider the inability to retrieve a public IP fatal. Although, it will likely fail immediately after this anyway due to an inability to connect to the relay for the same reason, but this could probably be handled a bit better.