Skip to content
This repository has been archived by the owner on Jul 16, 2020. It is now read-only.

Commit

Permalink
scheduler: goroutine ssntp Stop() in test case
Browse files Browse the repository at this point in the history
The tests propagate event results through channels.  Writers to channels
block until a reader reads.  The reader of a node disconnect event result
doesn't start to read untils the reader code (after the server stop call)
actually runs, which it wont do if the server stop is not a go routine.  If
the stop code is blocked on sending to the channel and the reader only runs
when the stop code is complete (ie: because it is not stopping in a
goroutine) there's going to be a deadlock.

Signed-off-by: Tim Pepper <[email protected]>
  • Loading branch information
Tim Pepper committed Aug 17, 2016
1 parent c3bccfc commit 64d01dd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ciao-scheduler/scheduler_ssntp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ func stopServer() error {
netAgentCh := netAgent.AddEventChan(ssntp.NodeDisconnected)
agentCh := agent.AddEventChan(ssntp.NodeDisconnected)

server.ssntp.Stop()
go server.ssntp.Stop()

_, err := controller.GetEventChanResult(controllerCh, ssntp.NodeDisconnected)
if err != nil {
Expand Down

0 comments on commit 64d01dd

Please sign in to comment.