Skip to content

Commit

Permalink
Fix #394
Browse files Browse the repository at this point in the history
This fixes the data race by moving the return before fulfill(); this way
Return() is not modifying the message while other callers are accessing
it.
  • Loading branch information
zenhack committed Jan 9, 2023
1 parent 3c3ee7e commit 7844043
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 @@ -216,12 +216,12 @@ func (srv *Server) handleCall(ctx context.Context, c *Call) {
err := c.method.Impl(ctx, c)

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

Expand Down

0 comments on commit 7844043

Please sign in to comment.