duality-labs / hapi-indexer

A Node.js based indexer for the Duality Cosmos chain
1 stars 0 forks source link

Indexer syncing can fail with network socket error #26

Closed dib542 closed 11 months ago

dib542 commented 11 months ago

in the logs, after the indexer states

info: transaction import starting

the next log is an error several minutes later that has presumably occurred during the syncing of the indexer to the chain's current state (because the current chain is large and should take about ~10-30 minutes)

[31merror: fetch failed {"cause":{"code":"UND_ERR_SOCKET","name":"SocketError","socket":{"bytesRead":212,"bytesWritten":478,"localAddress":"10.0.28.125","localPort":60778,"remoteAddress":"10.0.25.166","remoteFamily":"IPv4","remotePort":26657}}}

I am fairly certain this is due to large pages of transactions being unable to be passed through the network, either because the response is so large to generate that the request times out or that there is a network limitation for either sending or receiving the size of the generated payload.

Why: The difference between catchUp and keepUp in the indexer is that catchUp will almost always receive 100 transactions in each response as its looking to catch up as fast as possible. keepUp asks for a max of 100 transactions, but often it will receive much less: just the number of transactions completed in the last block. So it is quite possible that the previous indexer was able to handle the chain's transactions one block at a time through the keepUp method, but as we're now attempting to start the indexer from height 0 it is failing while attempting to import particularly big tx pages.