Skip to content

Commit 70811b2

Browse files
committed
Make SBFT application's enqueue operations non-blocking
Backend has a main consumer process (run()) handling the content of its queue (called 'queue', a channel). This goroutine has to be only a consumer but as it executes messages from the queue, sometimes, it has to also insert items acting as a producer. In this case, blocking enqueue operations may block the whole replica (application). One example for this phenomenon is an enqueued message of type Receive. This calls SBFT's Receive which may call function recordBacklogMsg which may then call System's Reconnect. This is implemented by Backend and tries to enqueue a Connection message (enqueueConnection) blocking the replica. Change-Id: I1dd2a900570a1305ea17d20bfcd8cba81b437d24 Signed-off-by: Gabor Hosszu <[email protected]>
1 parent 9bd4e85 commit 70811b2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

orderer/sbft/backend/backend.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,15 @@ func (c *Backend) connectWorker(peer *PeerInfo) {
187187
}
188188

189189
func (b *Backend) enqueueConnection(peerid uint64) {
190-
b.queue <- &connectionEvent{peerid: peerid}
190+
go func() {
191+
b.queue <- &connectionEvent{peerid: peerid}
192+
}()
191193
}
192194

193195
func (b *Backend) enqueueRequest(request []byte) {
194-
b.queue <- &requestEvent{req: request}
196+
go func() {
197+
b.queue <- &requestEvent{req: request}
198+
}()
195199
}
196200

197201
func (b *Backend) enqueueForReceive(msg *s.Msg, src uint64) {

0 commit comments

Comments
 (0)