From f9f32016ebc7f8d7d0d7f495e16fa4c1ae118049 Mon Sep 17 00:00:00 2001 From: Nathaniel Caldwell Date: Mon, 7 Mar 2022 13:38:20 -0500 Subject: [PATCH 1/5] Increase sync apply block timeout --- internal/p2p/peer_connection.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/p2p/peer_connection.go b/internal/p2p/peer_connection.go index f5d9b76..d7dc3a7 100644 --- a/internal/p2p/peer_connection.go +++ b/internal/p2p/peer_connection.go @@ -14,6 +14,11 @@ import ( "github.com/libp2p/go-libp2p-core/peer" ) +var ( + // SyncApplyBlockTimeout is the timeout for the ApplyBlock RPC during sync + SyncApplyBlockTimeout = 5 * time.Second +) + type signalRequestBlocks struct{} // PeerConnection handles the sync portion of a connection to a peer @@ -133,7 +138,7 @@ func (p *PeerConnection) handleRequestBlocks(ctx context.Context) error { // Apply blocks to local node for _, block := range blocks { - rpcContext, cancelApplyBlock := context.WithTimeout(ctx, 2*time.Second) + rpcContext, cancelApplyBlock := context.WithTimeout(ctx, SyncApplyBlockTimeout) defer cancelApplyBlock() _, err = p.localRPC.ApplyBlock(rpcContext, &block) if err != nil { From 21b0314a56056dfbd6d68f349ec79a94e2c9e0f8 Mon Sep 17 00:00:00 2001 From: Nathaniel Caldwell Date: Mon, 7 Mar 2022 14:08:21 -0500 Subject: [PATCH 2/5] Use local RPC timeout value --- internal/options/peer_connection_options.go | 4 ++-- internal/p2p/peer_connection.go | 7 +------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/internal/options/peer_connection_options.go b/internal/options/peer_connection_options.go index 1c81d0e..585a133 100644 --- a/internal/options/peer_connection_options.go +++ b/internal/options/peer_connection_options.go @@ -13,8 +13,8 @@ type Checkpoint struct { } const ( - localRPCTimeoutDefault = time.Millisecond * 100 - remoteRPCTimeoutDefault = time.Second + localRPCTimeoutDefault = time.Second * 3 + remoteRPCTimeoutDefault = time.Second * 6 blockRequestBatchSizeDefault = 1000 blockRequestTimeoutDefault = time.Second * 5 handshakeRetryTimeDefault = time.Second * 3 diff --git a/internal/p2p/peer_connection.go b/internal/p2p/peer_connection.go index d7dc3a7..d449f9b 100644 --- a/internal/p2p/peer_connection.go +++ b/internal/p2p/peer_connection.go @@ -14,11 +14,6 @@ import ( "github.com/libp2p/go-libp2p-core/peer" ) -var ( - // SyncApplyBlockTimeout is the timeout for the ApplyBlock RPC during sync - SyncApplyBlockTimeout = 5 * time.Second -) - type signalRequestBlocks struct{} // PeerConnection handles the sync portion of a connection to a peer @@ -138,7 +133,7 @@ func (p *PeerConnection) handleRequestBlocks(ctx context.Context) error { // Apply blocks to local node for _, block := range blocks { - rpcContext, cancelApplyBlock := context.WithTimeout(ctx, SyncApplyBlockTimeout) + rpcContext, cancelApplyBlock := context.WithTimeout(ctx, opts.LocalRPCTimeout) defer cancelApplyBlock() _, err = p.localRPC.ApplyBlock(rpcContext, &block) if err != nil { From 4065aab3cbfd7594fc3b5a26a5cefa03649c58bb Mon Sep 17 00:00:00 2001 From: Nathaniel Caldwell Date: Mon, 7 Mar 2022 14:11:11 -0500 Subject: [PATCH 3/5] Change timeout values --- internal/options/peer_connection_options.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/options/peer_connection_options.go b/internal/options/peer_connection_options.go index 585a133..a9d42b6 100644 --- a/internal/options/peer_connection_options.go +++ b/internal/options/peer_connection_options.go @@ -13,11 +13,11 @@ type Checkpoint struct { } const ( - localRPCTimeoutDefault = time.Second * 3 + localRPCTimeoutDefault = time.Second * 6 remoteRPCTimeoutDefault = time.Second * 6 blockRequestBatchSizeDefault = 1000 - blockRequestTimeoutDefault = time.Second * 5 - handshakeRetryTimeDefault = time.Second * 3 + blockRequestTimeoutDefault = time.Second * 6 + handshakeRetryTimeDefault = time.Second * 6 syncedBlockDeltaDefault = 5 syncedPingTimeDefault = time.Second * 10 ) From 5ff4e11be15ce30d252f5618d474babdc4c1c6cf Mon Sep 17 00:00:00 2001 From: Nathaniel Caldwell Date: Mon, 7 Mar 2022 14:15:25 -0500 Subject: [PATCH 4/5] p.opts... --- internal/p2p/peer_connection.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/p2p/peer_connection.go b/internal/p2p/peer_connection.go index d449f9b..9255227 100644 --- a/internal/p2p/peer_connection.go +++ b/internal/p2p/peer_connection.go @@ -133,7 +133,7 @@ func (p *PeerConnection) handleRequestBlocks(ctx context.Context) error { // Apply blocks to local node for _, block := range blocks { - rpcContext, cancelApplyBlock := context.WithTimeout(ctx, opts.LocalRPCTimeout) + rpcContext, cancelApplyBlock := context.WithTimeout(ctx, p.opts.LocalRPCTimeout) defer cancelApplyBlock() _, err = p.localRPC.ApplyBlock(rpcContext, &block) if err != nil { From a1d3f435d0c56a735e9873c412e4a0625e962713 Mon Sep 17 00:00:00 2001 From: Michael Vandeberg Date: Mon, 7 Mar 2022 12:14:43 -0800 Subject: [PATCH 5/5] Bump mq --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index d61106f..7354fe2 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.15 require ( github.com/ipfs/go-log v1.0.5 github.com/koinos/koinos-log-golang v0.0.0-20210621202301-3310a8e5866b - github.com/koinos/koinos-mq-golang v0.0.0-20211026183607-441fb7106dd3 + github.com/koinos/koinos-mq-golang v0.0.0-20220307194511-07a03f6f75f0 github.com/koinos/koinos-proto-golang v0.2.1-0.20220304200226-d96c9cf694de github.com/koinos/koinos-util-golang v0.0.0-20220224193402-85a6df362833 github.com/libp2p/go-libp2p v0.17.0 diff --git a/go.sum b/go.sum index 79f11b6..3d98dc0 100644 --- a/go.sum +++ b/go.sum @@ -531,6 +531,8 @@ github.com/koinos/koinos-log-golang v0.0.0-20210621202301-3310a8e5866b h1:pZ9L1E github.com/koinos/koinos-log-golang v0.0.0-20210621202301-3310a8e5866b/go.mod h1:/dzAVdA+woySENUYwls8RT+5i87Rm4qoMZ4ctEQI8k0= github.com/koinos/koinos-mq-golang v0.0.0-20211026183607-441fb7106dd3 h1:vr3BM+X2ZLmUysECS+1G+YqJeheCQdr01JikxOmLrhc= github.com/koinos/koinos-mq-golang v0.0.0-20211026183607-441fb7106dd3/go.mod h1:EFk+fuUL5ezbaWsGJ2U0KlzbgkflwRv96az8dEVe16I= +github.com/koinos/koinos-mq-golang v0.0.0-20220307194511-07a03f6f75f0 h1:ykFmSn2nhdrr96UvqNlYdvWqXu8xX5Ol18nmLM49icg= +github.com/koinos/koinos-mq-golang v0.0.0-20220307194511-07a03f6f75f0/go.mod h1:EFk+fuUL5ezbaWsGJ2U0KlzbgkflwRv96az8dEVe16I= github.com/koinos/koinos-proto-golang v0.2.1-0.20220224180227-6fbc5fe4a89a h1:3Htl8NnPsoSaHhzJhROeQiAyFIcGwsobypAkvysKGvg= github.com/koinos/koinos-proto-golang v0.2.1-0.20220224180227-6fbc5fe4a89a/go.mod h1:ZonOOdmZcuEbRdOqqdfYRA2I4szYHy5aKzUveMWXBog= github.com/koinos/koinos-proto-golang v0.2.1-0.20220304200226-d96c9cf694de h1:HqOUA4jj5ce4v1kW8jnVc/1LYrELBihqNBDVyqaU+xI=