Open HankPavel opened 3 months ago
Maybe the bug is here:
// DequeueWithTimeout attempts to dequeue a message from the Route
// and returns an error if the given timeout expires first.
func (r *Route) DequeueWithTimeout(timeout time.Duration) (appmessage.Message, error) {
select {
case <-time.After(timeout): // timeout=5s
return nil, errors.Wrapf(ErrTimeout, "route '%s' got timeout after %s", r.name, timeout)
case message, isOpen := <-r.channel:
if !isOpen {
return nil, errors.WithStack(ErrRouteClosed)
}
return message, nil
}
}
If GetBlock by blockHash escaped 5.1s, current grpc request return with timeout err, and the server response(BlockInfo) would stay in the r.channel util next Dequeue().
so, we can see a situation:
this is the same as what we see in the log: call GetBlock(hash2)
method, but got Block(the hash eq hash1) response.
Issue
The block returned by the grpcMethod is not specified by the HASH parameter
Env
kaspad version: v0.12.15 system version: Ubuntu 20.04.3 LTS
How to solve it?
now, restart node program or my program, this problem can fixed temporary.
How to solve this problem once and for all?