veyron/services/mgmt/device: fix race: device manager Stop vs. ShutdownOnSignals
In theory, the device manager could be receiving Stop rpcs before we had a
chance to call ShutdownOnSignals (which registers a listeners with the app cycle
manager). In the absence of a registered listener, the app cycle manager will
exit the process immediately when it receives a Stop.
This change ensures that we have a listening channel registered with the app
cycle manager before the device manager service is up (by calling
ShutdownOnSignals before starter.Start).
This race could be the cause for flakiness in testDeviceManager:
testDeviceManager starts up a child device manager and then promptly calls Stop
on it as soon as it gets the child endpoint, so it's conceivable that the child
never got around to calling ShutdownOnSignals before it exits.
Sample Jenkins failure for TestDeviceManagerUpdateAndRevert:
https://dev.v.io/jenkins/job/vanadium-go-test/537/L=mac-slave/testReport/junit/v_io/core_veyron_services_mgmt_device_impl/TestDeviceManagerUpdateAndRevert_12__GoTest___mac_/
Change-Id: I9e75ae00eae48793a4cc40e0573323f236e1575d
3 files changed