Skip to content

Commit

Permalink
Fix #420
Browse files Browse the repository at this point in the history
(without re-introducing #394)

420 was a regression introduced by our fix for 394; if we Return()
before we fulfill(), this can result in out of order message delivery,
since incoming calls can be made directly on clients in the result
before all queued calls are drained.

Previously, if we fulfilled() before Return(), we would get a data race
as fillPayloadCapTable modified the message while pipelined calls read
it. Having split Return(error) into PrepareReturn(error) and Return(),
it is now safe to move just the latter after the call to fulfill().
  • Loading branch information
zenhack committed Jan 13, 2023
1 parent d93f6b2 commit 3b58955
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,12 @@ func (srv *Server) handleCall(ctx context.Context, c *Call) {

c.recv.ReleaseArgs()
c.recv.Returner.PrepareReturn(err)
c.recv.Returner.Return()
if err == nil {
c.aq.fulfill(c.results)
} else {
c.aq.reject(err)
}
c.recv.Returner.Return()
c.recv.Returner.ReleaseResults()
}

Expand Down

0 comments on commit 3b58955

Please sign in to comment.