Skip to content

Commit

Permalink
debug: header task stuck issue trouble shooting
Browse files Browse the repository at this point in the history
  • Loading branch information
krish-nr committed Apr 10, 2024
1 parent d6fbbc7 commit 0ee328f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
18 changes: 17 additions & 1 deletion eth/downloader/skeleton.go
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,12 @@ func (s *skeleton) sync(head *types.Header) (*types.Header, error) {
log.Debug("Beacon sync merged subchains")
return nil, errSyncMerged
}
// We still have work to do, loop and repeat
// We still have work to do, loop and repeat

default:
log.Debug("Select loop timeout, no events received")
// sleep a short time
time.Sleep(time.Millisecond * 100)
}
}
}
Expand Down Expand Up @@ -911,7 +916,18 @@ func (s *skeleton) revertRequest(req *headerRequest) {

// Remove the request from the tracked set and mark the task as not-pending,
// ready for rescheduling
log.Warn("ZXL: revert request", "tasknum", (s.scratchHead-req.head)/requestHeaders, "peerId", req.peer)
s.scratchOwners[(s.scratchHead-req.head)/requestHeaders] = ""
// retry
//s.idles[req.peer] = s.getPeerConnectionByPeerId(req.peer) // not here but need here
}

func (s *skeleton) getPeerConnectionByPeerId(peer string) *peerConnection {
peerConn, ok := s.peers.peers[peer]
if !ok {
return nil
}
return peerConn
}

func (s *skeleton) processResponse(res *headerResponse) (linked bool, merged bool) {
Expand Down
10 changes: 6 additions & 4 deletions eth/protocols/eth/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@
package eth

import (
"errors"
"fmt"
"math/big"
"time"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/eth/etherror"
"github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/p2p/enode"
Expand Down Expand Up @@ -160,11 +162,11 @@ func Handle(backend Backend, peer *Peer) error {
case errors.Is(err, etherror.ErrNoHeadersDelivered):
// ignore no headers delivered
peer.Log().Warn("Message handling failed with no headers")
case errors.Is(err, etherror.ErrHeaderBatchAnchorLow):
// ignore lower header anchor within tolerance
peer.Log().Warn("Message handling failed with lower batch anchor")
*/
case errors.Is(err, etherror.ErrHeaderBatchAnchorLow):
// ignore lower header anchor within tolerance
peer.Log().Warn("Message handling failed with lower batch anchor")

case err != nil:
peer.Log().Debug("Message handling failed in `eth`", "err", err)
return err
Expand Down

0 comments on commit 0ee328f

Please sign in to comment.