Search code examples
dockerdocker-compose

Blockscout backend docker crashing on ubuntu20.x


I’m trying to deploy BLOCKSCOUT using the docker-compose following the steps mentioned in the documentation. But after deployment, my backend docker starts crashing and due to it the frontend fails to load any data to the dashboard.

Below I have shared my infra details:

Cloud: Google
Machine type: e2-standard-8
vCPU; 8
Mem: 32GB
CPU platform: Intel Broadwell
Architecture: x86/64

OS NAME="Ubuntu"
OS VERSION="20.04.6 LTS (Focal Fossa)"
Docker version 25.0.1, build 29cf629
Docker Compose version v2.22.0

I have also tried using different versions of blockscout (v6.2.2-beta, v6.2.1-beta, v6.2.0-beta) and all are failing with similar error. Following is the error that I’m getting from the backend docker:

warning: redefining module ConfigHelper (current version defined in memory)
backend          |   config/config_helper.exs:1
backend          | 
backend          | warning: redefining module ConfigHelper (current version defined in memory)
backend          |   config/config_helper.exs:1
backend          | 
backend          | Starting dependencies..
backend          | Starting repos..
backend          | Create Explorer.Repo database if it doesn't exist
backend          | Create Explorer.Repo.Account database if it doesn't exist
backend          | Create Explorer.Repo.BridgedTokens database if it doesn't exist
backend          | Running migrations for explorer
backend          | Running migrations for explorer
backend          | {"time":"2024-03-04T04:26:09.957Z","severity":"info","message":"Migrations already up","metadata":{}}
backend          | {"time":"2024-03-04T04:26:09.961Z","severity":"info","message":"Migrations already up","metadata":{}}
backend          | Running migrations for explorer
backend          | Success!
backend          | {"time":"2024-03-04T04:26:09.963Z","severity":"info","message":"Migrations already up","metadata":{}}
backend          | warning: redefining module ConfigHelper (current version defined in memory)
backend          |   config/config_helper.exs:1
backend          | 
backend          | warning: redefining module ConfigHelper (current version defined in memory)
backend          |   config/config_helper.exs:1
backend          | 
backend          | {"time":"2024-03-04T04:26:10.856Z","severity":"info","message":"[Que] Booting Que","metadata":{}}
backend          | {"time":"2024-03-04T04:26:10.856Z","severity":"info","message":"[Que] Booting Server Supervisor for Workers","metadata":{}}
backend          | {"time":"2024-03-04T04:26:10.878Z","severity":"info","message":"tx/per day chart: collect records for txs per day stats","metadata":{}}
backend          | {"time":"2024-03-04T04:26:10.878Z","severity":"info","message":"tx/per day chart: earliest date 2024-02-24 00:00:00Z","metadata":{}}
backend          | {"time":"2024-03-04T04:26:10.878Z","severity":"info","message":"tx/per day chart: latest date 2024-02-24 23:59:59Z","metadata":{}}
backend          | {"time":"2024-03-04T04:26:10.918Z","severity":"info","message":"tx/per day chart: timestamp cannot be converted to min/max blocks, trying to find min/max blocks through a fallback option}","metadata":{}}
backend          | {"time":"2024-03-04T04:26:10.929Z","severity":"warn","message":"tx/per day chart: failed to get min/max blocks through a fallback option}","metadata":{}}
backend          | {"time":"2024-03-04T04:26:10.929Z","severity":"info","message":"tx/per day chart: collect records for txs per day stats","metadata":{}}
backend          | {"time":"2024-03-04T04:26:10.929Z","severity":"info","message":"tx/per day chart: earliest date 2024-02-27 00:00:00Z","metadata":{}}
backend          | {"time":"2024-03-04T04:26:10.929Z","severity":"info","message":"tx/per day chart: latest date 2024-02-27 23:59:59Z","metadata":{}}
backend          | {"time":"2024-03-04T04:26:10.930Z","severity":"info","message":"Running BlockScoutWeb.Endpoint with cowboy 2.10.0 at 0.0.0.0:4000 (http)","metadata":{}}
backend          | {"time":"2024-03-04T04:26:10.931Z","severity":"info","message":"tx/per day chart: timestamp cannot be converted to min/max blocks, trying to find min/max blocks through a fallback option}","metadata":{}}
backend          | {"time":"2024-03-04T04:26:10.933Z","severity":"warn","message":"tx/per day chart: failed to get min/max blocks through a fallback option}","metadata":{}}
backend          | {"time":"2024-03-04T04:26:10.933Z","severity":"info","message":"tx/per day chart: collect records for txs per day stats","metadata":{}}
backend          | {"time":"2024-03-04T04:26:10.933Z","severity":"info","message":"tx/per day chart: earliest date 2024-02-28 00:00:00Z","metadata":{}}
backend          | {"time":"2024-03-04T04:26:10.933Z","severity":"info","message":"tx/per day chart: latest date 2024-02-28 23:59:59Z","metadata":{}}
backend          | {"time":"2024-03-04T04:26:10.933Z","severity":"info","message":"Access BlockScoutWeb.Endpoint at ://:4000","metadata":{}}
backend          | {"time":"2024-03-04T04:26:10.935Z","severity":"info","message":"tx/per day chart: timestamp cannot be converted to min/max blocks, trying to find min/max blocks through a fallback option}","metadata":{}}
backend          | {"time":"2024-03-04T04:26:10.940Z","severity":"warn","message":"tx/per day chart: failed to get min/max blocks through a fallback option}","metadata":{}}
backend          | {"time":"2024-03-04T04:26:10.940Z","severity":"info","message":"tx/per day chart: collect records for txs per day stats","metadata":{}}
backend          | {"time":"2024-03-04T04:26:10.940Z","severity":"info","message":"tx/per day chart: earliest date 2024-02-29 00:00:00Z","metadata":{}}
backend          | {"time":"2024-03-04T04:26:10.940Z","severity":"info","message":"tx/per day chart: latest date 2024-02-29 23:59:59Z","metadata":{}}
backend          | {"time":"2024-03-04T04:26:10.944Z","severity":"info","message":"Index already caught up.","metadata":{"fetcher":"block_catchup","first_block_number":null,"last_block_number":null,"missing_block_count":0,"shrunk":false}}
backend          | {"time":"2024-03-04T04:26:10.944Z","severity":"info","message":"Checking if index needs to catch up in 5000ms.","metadata":{"fetcher":"block_catchup"}}
backend          | {"time":"2024-03-04T04:26:10.947Z","severity":"info","message":"tx/per day chart: timestamp cannot be converted to min/max blocks, trying to find min/max blocks through a fallback option}","metadata":{}}
backend          | {"time":"2024-03-04T04:26:10.956Z","severity":"warn","message":"tx/per day chart: failed to get min/max blocks through a fallback option}","metadata":{}}
backend          | {"time":"2024-03-04T04:26:10.956Z","severity":"info","message":"tx/per day chart: collect records for txs per day stats","metadata":{}}
backend          | {"time":"2024-03-04T04:26:10.956Z","severity":"info","message":"tx/per day chart: earliest date 2024-03-02 00:00:00Z","metadata":{}}
backend          | {"time":"2024-03-04T04:26:10.956Z","severity":"info","message":"tx/per day chart: latest date 2024-03-02 23:59:59Z","metadata":{}}
backend          | {"time":"2024-03-04T04:26:10.961Z","severity":"info","message":"Index already caught up.","metadata":{"fetcher":"block_catchup","first_block_number":null,"last_block_number":null,"missing_block_count":0,"shrunk":false}}
backend          | {"time":"2024-03-04T04:26:10.961Z","severity":"info","message":"Checking if index needs to catch up in 5000ms.","metadata":{"fetcher":"block_catchup"}}
backend          | {"time":"2024-03-04T04:26:10.963Z","severity":"info","message":"tx/per day chart: timestamp cannot be converted to min/max blocks, trying to find min/max blocks through a fallback option}","metadata":{}}
backend          | {"time":"2024-03-04T04:26:10.968Z","severity":"warn","message":"tx/per day chart: failed to get min/max blocks through a fallback option}","metadata":{}}
backend          | {"time":"2024-03-04T04:26:10.968Z","severity":"info","message":"tx/per day chart: collect records for txs per day stats","metadata":{}}
backend          | {"time":"2024-03-04T04:26:10.968Z","severity":"info","message":"tx/per day chart: records collected [%{date: ~D[2024-03-03], gas_used: 0, number_of_transactions: 0, total_fee: 0}, %{date: ~D[2024-03-02], gas_used: 0, number_of_transactions: 0, total_fee: 0}, %{date: ~D[2024-03-01], gas_used: 0, number_of_transactions: 0, total_fee: 0}, %{date: ~D[2024-02-29], gas_used: 0, number_of_transactions: 0, total_fee: 0}, %{date: ~D[2024-02-28], gas_used: 0, number_of_transactions: 0, total_fee: 0}, %{date: ~D[2024-02-27], gas_used: 0, number_of_transactions: 0, total_fee: 0}, %{date: ~D[2024-02-26], gas_used: 0, number_of_transactions: 0, total_fee: 0}, %{date: ~D[2024-02-25], gas_used: 0, number_of_transactions: 0, total_fee: 0}, %{date: ~D[2024-02-24], gas_used: 0, number_of_transactions: 0, total_fee: 0}]","metadata":{}}
backend          | {"time":"2024-03-04T04:26:10.968Z","severity":"info","message":"tx/per day chart: save records","metadata":{}}
backend          | {"time":"2024-03-04T04:26:10.970Z","severity":"info","message":"tx/per day chart: number of inserted 10","metadata":{}}
backend          | {"time":"2024-03-04T04:26:10.977Z","severity":"info","message":"Index already caught up.","metadata":{"fetcher":"block_catchup","first_block_number":null,"last_block_number":null,"missing_block_count":0,"shrunk":false}}
backend          | {"time":"2024-03-04T04:26:10.977Z","severity":"info","message":"Checking if index needs to catch up in 5000ms.","metadata":{"fetcher":"block_catchup"}}
backend          | {"time":"2024-03-04T04:26:10.992Z","severity":"info","message":"Index already caught up.","metadata":{"fetcher":"block_catchup","first_block_number":null,"last_block_number":null,"missing_block_count":0,"shrunk":false}}
backend          | {"time":"2024-03-04T04:26:10.992Z","severity":"info","message":"Checking if index needs to catch up in 5000ms.","metadata":{"fetcher":"block_catchup"}}
backend          | {"time":"2024-03-04T04:26:11.002Z","severity":"info","message":"Application indexer exited: shutdown","metadata":{}}
backend          | {"time":"2024-03-04T04:26:11.008Z","severity":"info","message":"Postgrex.Protocol (#PID<0.4290.0>) missed message: {:EXIT, #PID<0.4638.0>, :shutdown}","metadata":{}}
backend          | {"time":"2024-03-04T04:26:11.008Z","severity":"info","message":"Postgrex.Protocol (#PID<0.4251.0>) missed message: {:EXIT, #PID<0.4638.0>, :shutdown}","metadata":{}}
backend          | {"time":"2024-03-04T04:26:11.008Z","severity":"info","message":"Postgrex.Protocol (#PID<0.4288.0>) missed message: {:EXIT, #PID<0.4638.0>, :shutdown}","metadata":{}}
backend          | {"time":"2024-03-04T04:26:11.008Z","severity":"info","message":"Postgrex.Protocol (#PID<0.4297.0>) missed message: {:EXIT, #PID<0.4638.0>, :shutdown}","metadata":{}}
backend          | {"Kernel pid terminated",application_controller,"{application_terminated,indexer,shutdown}"}
backend          | Kernel pid terminated (application_controller) ({application_terminated,indexer,shutdown})
backend          | 
backend          | Crash dump is being written to: erl_crash.dump...done

Could you please help me to resolve this issue?

Thanks in advance,

Akhil


Solution

  • This issue got fixed by following the steps:

    In the blockscout/docker-compose/docker-compose.yml

    services:
      backend:
        environment:
          ETHEREUM_JSONRPC_HTTP_URL: http://myrpc-url
          ETHEREUM_JSONRPC_TRACE_URL: http://myrpc-url
          # ETHEREUM_JSONRPC_WS_URL: ws://myrpc-url <<== Comment/remove this line
          CHAIN_ID: '2120'
    

    In blockscout/docker-compose/envs/common-blockscout.env add or update the following line:

    # Since my L2 is Polygon CDK
    INDEXER_INTERNAL_TRANSACTIONS_TRACER_TYPE=polygon 
    

    Discussion related to it can be found here: https://discord.com/channels/973915550965174292/1214450097471885342

    Thanks,

    Akhil