Skip to content

Commit

Permalink
go/runtime/host: Always emit StoppedEvent on stop
Browse files Browse the repository at this point in the history
Previously the StoppedEvent was only emitted in case the runtime was
previously running. In case multihost was performing a version switch
when a runtime was not yet started, this resulted in a deadlock.
  • Loading branch information
kostko committed Apr 7, 2022
1 parent 07bc8cd commit 6aab8d5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changelog/4647.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
go/runtime/host: Always emit StoppedEvent on stop

Previously the StoppedEvent was only emitted in case the runtime was
previously running. In case multihost was performing a version switch when a
runtime was not yet started, this resulted in a deadlock.
6 changes: 3 additions & 3 deletions go/runtime/host/sandbox/sandbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -437,11 +437,11 @@ func (r *sandboxedRuntime) manager() {
r.Lock()
r.conn = nil
r.Unlock()

// Notify subscribers that the runtime has stopped.
r.notifier.Broadcast(&host.Event{Stopped: &host.StoppedEvent{}})
}

// Notify subscribers that the runtime has stopped.
r.notifier.Broadcast(&host.Event{Stopped: &host.StoppedEvent{}})

close(r.quitCh)
}()

Expand Down

0 comments on commit 6aab8d5

Please sign in to comment.