Skip to content

Commit

Permalink
fix race condition with client and serial endpoints
Browse files Browse the repository at this point in the history
When a node was being closed, the read routine wasn't shut down
properly, causing Read() to be called again and again, until an error.
Since multibuffer.Next() is called just before Read(), the same buffer
was being accessed by multiple routines.
  • Loading branch information
aler9 committed Sep 17, 2022
1 parent 95d67bc commit 9a49375
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions endpoint_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ func (t *endpointClient) runInner() error {
select {
case t.read <- buf[:n]:
case <-t.ctx.Done():
return errTerminated
}
}
}()
Expand Down
1 change: 1 addition & 0 deletions endpoint_serial.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ func (t *endpointSerial) runInner() error {
select {
case t.read <- buf[:n]:
case <-t.ctx.Done():
return errTerminated
}
}
}()
Expand Down

0 comments on commit 9a49375

Please sign in to comment.