You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Send publishes a new batch of events by JSON-encoding given batch.// Send blocks until the complete batch has been ACKed by lumberjack server or// some error happened.func (c*SyncClient) Send(data []interface{}) (int, error) {
iferr:=c.cl.Send(data); err!=nil {
return0, err
}
seq, err:=c.cl.AwaitACK(uint32(len(data)))
returnint(seq), err
}
My team's project uses this function to send events to the server for centralized storage (the model uses Envoy v1.24 for request distribution).
When a request routed by Envoy is sent to a closed server, the thread hangs in the loop waiting for enough ACKs to be received. tcpdump analysis reveals that Envoy continuously sends 6-byte data packets to the client. But the ReceiveACK function always returns ackSeq equal to 0 without incrementing, leading to infinite looping and never reaching the Count value.
// AwaitACK waits for count elements being ACKed. Returns last known ACK on error.func (c*Client) AwaitACK(countuint32) (uint32, error) {
varackSequint32varerrerror// read until all ACKsforackSeq<count {
ackSeq, err=c.ReceiveACK()
iferr!=nil {
returnackSeq, err
}
}
ifackSeq>count {
returncount, fmt.Errorf(
"invalid sequence number received (seq=%v, expected=%v)", ackSeq, count)
}
returnackSeq, nil
}
In my opinion, a timeout mechanism must be implemented in this case to ensure that the loop does not run indefinitely if it fails to receive enough ACKs.
The text was updated successfully, but these errors were encountered:
My team's project uses this function to send events to the server for centralized storage (the model uses Envoy v1.24 for request distribution).
When a request routed by Envoy is sent to a closed server, the thread hangs in the loop waiting for enough ACKs to be received.
tcpdump
analysis reveals that Envoy continuously sends 6-byte data packets to the client. But the ReceiveACK function always returns ackSeq equal to 0 without incrementing, leading to infinite looping and never reaching the Count value.In my opinion, a timeout mechanism must be implemented in this case to ensure that the loop does not run indefinitely if it fails to receive enough ACKs.
The text was updated successfully, but these errors were encountered: