blockwatch-cc / tzindex

Tezos Blockchain Indexer
MIT License
71 stars 12 forks source link

connection error: rpc: GET /chains/main/blocks/1 status 404 #4

Closed atomlab closed 5 years ago

atomlab commented 5 years ago

Hello! I have a issue when start tzindex. Build from current master (241def18). It seems that tzindex use wrong api request to tezos node.

tzindex run as

/opt/tzindex/bin/tzindex --config /opt/tzindex/config/config.json --dbpath /opt/tzindex/data run

logs

Oct 21 22:29:20 xtz-02 tzindex[19378]: 2019/10/21 22:29:20.016080 INFO BLOC Crawling Tezos Mainnet.
Oct 21 22:29:20 xtz-02 tzindex[19378]: 2019/10/21 22:29:20.019543 INFO BLOC Starting blockchain crawler.
Oct 21 22:29:20 xtz-02 tzindex[19378]: 2019/10/21 22:29:20.019582 WARN SRVR HTTP Server reachable on all interfaces (0.0.0.0)
Oct 21 22:29:20 xtz-02 tzindex[19378]: 2019/10/21 22:29:20.020376 DEBG SRVR Registering debug routes
Oct 21 22:29:20 xtz-02 tzindex[19378]: 2019/10/21 22:29:20.020728 INFO BLOC Starting blockchain sync from height 1.
Oct 21 22:29:20 xtz-02 tzindex[19378]: 2019/10/21 22:29:20.020744 INFO BLOC Starting blockchain ingest.
Oct 21 22:29:20 xtz-02 tzindex[19378]: 2019/10/21 22:29:20.020761 INFO SRVR Starting HTTP server at 0.0.0.0:8000
Oct 21 22:29:20 xtz-02 tzindex[19378]: 2019/10/21 22:29:20.020823 INFO BLOC Starting blockchain monitor.
Oct 21 22:29:20 xtz-02 tzindex[19378]: 2019/10/21 22:29:20.070340 WARN BLOC RPC connection error: rpc: GET /chains/main/blocks/1 status 404 ()
Oct 21 22:29:25 xtz-02 tzindex[19378]: 2019/10/21 22:29:25.073422 WARN BLOC RPC connection error: rpc: GET /chains/main/blocks/1 status 404 ()
Oct 21 22:29:30 xtz-02 tzindex[19378]: 2019/10/21 22:29:30.076258 WARN BLOC RPC connection error: rpc: GET /chains/main/blocks/1 status 404 ()
Oct 21 22:29:35 xtz-02 tzindex[19378]: 2019/10/21 22:29:35.122600 WARN BLOC RPC connection error: rpc: GET /chains/main/blocks/1 status 404 ()
Oct 21 22:38:51 xtz-02 tzindex[19378]: 2019/10/21 22:38:51.751244 WARN BLOC RPC connection error: rpc: GET /chains/main/blocks/1 status 404 ()
Oct 21 22:38:56 xtz-02 tzindex[19378]: 2019/10/21 22:38:56.753995 WARN BLOC RPC connection error: rpc: GET /chains/main/blocks/1 status 404 ()
Oct 21 22:39:01 xtz-02 tzindex[19378]: 2019/10/21 22:39:01.758360 WARN BLOC RPC connection error: rpc: GET /chains/main/blocks/1 status 404 ()
Oct 21 22:39:06 xtz-02 tzindex[19378]: 2019/10/21 22:39:06.761801 WARN BLOC RPC connection error: rpc: GET /chains/main/blocks/1 status 404 ()
Oct 21 22:39:11 xtz-02 tzindex[19378]: 2019/10/21 22:39:11.766047 WARN BLOC RPC connection error: rpc: GET /chains/main/blocks/1 status 404 ()
Oct 21 22:39:16 xtz-02 tzindex[19378]: 2019/10/21 22:39:16.768994 WARN BLOC RPC connection error: rpc: GET /chains/main/blocks/1 status 404 ()
Oct 21 22:39:21 xtz-02 tzindex[19378]: 2019/10/21 22:39:21.772234 WARN BLOC RPC connection error: rpc: GET /chains/main/blocks/1 status 404 ()
Oct 21 22:39:26 xtz-02 tzindex[19378]: 2019/10/21 22:39:26.775274 WARN BLOC RPC connection error: rpc: GET /chains/main/blocks/1 status 404 ()
Oct 21 22:39:31 xtz-02 tzindex[19378]: 2019/10/21 22:39:31.779969 WARN BLOC RPC connection error: rpc: GET /chains/main/blocks/1 status 404 ()
Oct 21 22:39:36 xtz-02 tzindex[19378]: 2019/10/21 22:39:36.783166 WARN BLOC RPC connection error: rpc: GET /chains/main/blocks/1 status 404 ()
...

check rest api of tzindex

# curl http://127.0.0.1:8000/
{
  "errors": [
    {
      "code": 1000,
      "status": 404,
      "message": "resource not found",
      "scope": "NotFound",
      "detail": "Unrecognized request URL (GET: /).",
      "request_id": "BW-e0fc7209586b65792cbe316a32305c04dec9a638"
    }
  ]
}

# curl http://127.0.0.1:8000/explorer/status
{
  "status": "connecting",
  "blocks": -1,
  "indexed": 0,
  "progress": 0
}

tezos-node version

# /opt/tezos/bin/tezos-node --version
a67ca32c (2019-09-20 17:27:30 +0200)

Manual requests to tezos node

/chains/main/blocks/1

# curl -v  http://127.0.0.1:8732/chains/main/blocks/1
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 8732 (#0)
> GET /chains/main/blocks/1 HTTP/1.1
> Host: 127.0.0.1:8732
> User-Agent: curl/7.52.1
> Accept: */*
>
< HTTP/1.1 404 Not Found
< transfer-encoding: chunked
<
* Curl_http_done: called premature == 0
* Connection #0 to host 127.0.0.1 left intact

/chains/main/blocks

# curl -v  http://127.0.0.1:8732/chains/main/blocks
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 8732 (#0)
> GET /chains/main/blocks HTTP/1.1
> Host: 127.0.0.1:8732
> User-Agent: curl/7.52.1
> Accept: */*
>
< HTTP/1.1 200 OK
< content-length: 1010
< content-type: application/json
<
[["BLKdtUqn4aCm6ywf1seTk4AJ4hxYiMgth2sak8jcDiZYZKojmky"],["BKnc8X2HxGMKhxZvSCmpSJ6xC2wXKMYxUhsbGKzGxreabUTvYgW"],["BL6qW4CE19CW7WE4wkS2YTDe7baXmiNi1vFMZzDxQ2zx7Ak2zTR"],["BLdEEmZnmd7Y1g5FAApDMZPhPGmeFZDrmTNLVRraFGta8NUGBcm"],["BM3rTAyNMrHn7g6kcdZYu18PBRcNYbMVNtEXFkyQXDzg5dihbCc"],["BLCfBjyRcU96EARen2q6PNmypwDg2jhc3rRAEJDg3d634e3QUaW"],["BL18Jf5r3NenwCiQmjy15RVAtwPstPGisd39RehVgPde8N62bti"],["BMXgVKUHrxC846R8ELp7VSGXLdeGRcg3M8cJnPj2DeKNEebRpe4"],["BLzGmNCrp69JxRsMiFJCGLH2JknBhAdj8TT8hK7VzEhoYi8PpEX"],["BMD4HBxmmVyWodQA51wsFDcZE7j5bqhiNeeujTNfcoTJXtGJGk6"],["BMHJmEsWBMbPE7CTe8gVX5uT6UhtHWHeDcCTrSKhRc8mkSKJQsh"],["BLsLKa196r3jS7FUjc4pHnPjitkT5h3HAMVKZxmbQYJJr7gVbqy"],["BLipoMqDx2uwoDep2LfzzbfccMWN6Wgq2VZwT3bKQcJ7ALGbjWZ"],["BMDNqWLx6W5xWnsqZd4bS8i5UUr4SxVX54NRQ46QFWp2er3cM1L"],["BKpZebfeJN7sCDKS6ZhE8z4T7fi6Q87Rh7VoeirgELr4tysXgBp"],["BLJrJJ2NmiBCByq8mTghNsWgwKYMxGti15EAHhop278vY2QHW4Y"],["BLz34p1VZUrYAAN4bLYQ5wpbNhuEo5ZD4y622eA6y5UTdq9Sb72"],["BMBjFmSPdbR6HyCnCpcnLawWDQA1EqockN4cYN3qJiLZuWPisCZ"]]
* Curl_http_done: called premature == 0
* Connection #0 to host 127.0.0.1 left intact

/chains/main/blocks/head

# curl -v  http://127.0.0.1:8732/chains/main/blocks/head
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 8732 (#0)
> GET /chains/main/blocks/head HTTP/1.1
> Host: 127.0.0.1:8732
> User-Agent: curl/7.52.1
> Accept: */*
>
< HTTP/1.1 200 OK
< content-length: 25443
< content-type: application/json
<
{"protocol":"PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS","chain_id":"NetXdQprcVkpaWU","hash":"BMGssnHsaAeVw9NmkvSaPAN88M6NpRSd4EegBWutpe13Hb1CvZc","header":{"level":660271,"proto":5,"predecessor":"BLKdtUqn4aCm6ywf1seTk4AJ4hxYiMgth2sak8jcDiZYZKojmky","timestamp":"2019-10-21T22:36:27Z","validation_pass":4,"operations_hash":"LLoaMnatgBFQPMKE71WGwZbEQ6hpLmGhVKWa8Cs56x1ttNKFsLj1A","fitness":["01","000000000000132f"]
...

config

{
    "server": {
        "addr": "0.0.0.0",
        "port": 8000,
        "scheme": "http",
        "host": "127.0.0.1",
        "workers": 50,
        "read_timeout": "2s",
        "header_timeout": "5s",
        "write_timeout": "900s",
        "keepalive": "90s",
        "shutdown_timeout": "15s",
        "max_list_count": 50000,
        "default_explore_count": 20,
        "max_explore_count": 100,
        "cors_enable": false,
        "cors_origin": "*",
        "cors_allow_headers": "Authorization, Accept, Content-Type, X-Api-Key, X-Requested-With",
        "cors_expose_headers": "Date, X-Runtime, X-Request-Id, X-Api-Version",
        "cors_methods": "GET, OPTIONS",
        "cors_maxage": "86400",
        "cors_credentials": "true",
        "cache_enable": false,
        "cache_control": "public"
    },
    "crawler": {
        "queue": 100,
        "snapshot_path": "./db/xtz/snapshots",
        "snapshot_blocks": [],
        "snapshot_interval": 0
    },
    "database": {
        "path": "./db/xtz",
        "engine": "bolt",
        "gc_interval": 50000000,
        "gc_ratio": 1.0,
        "log_slow_queries": "2s",
        "account": {
            "cache_size": 4
        },
        "account_index":{
            "cache_size": 8
        },
        "contract": {
            "cache_size": 2
        },
        "contract_index":{
            "cache_size": 2
        },
        "op": {
            "cache_size": 4
        },
        "op_index":{
            "cache_size": 128
        },
        "block": {
            "cache_size": 8
        },
        "block_index":{
            "cache_size": 64
        },
        "flow": {
            "cache_size": 4
        },
        "supply": {
            "cache_size": 2
        },
        "chain": {
            "cache_size": 2
        },
        "right": {
            "cache_size": 2
        },
        "income": {
            "cache_size": 2
        }
    },
    "rpc": {
        "host": "127.0.0.1",
        "port": 8732,
        "threads": 2,
        "disable_tls": true,
        "dial_timeout": "10s",
        "keepalive": "30m",
        "idle_timeout": "30m",
        "response_timeout": "60s",
        "continue_timeout": "60s",
        "idle_conns": 2
    },
    "logging": {
        "backend": "stdout",
        "flags": "date,time,micro,utc",
        "level": "info",
        "blockchain": "info",
        "database": "info",
        "rpc": "info",
        "server": "debug",
        "report": "info",
        "micheline": "info"
    }
}
echa commented 5 years ago

Thanks for the detailed information! That way it was easy to detect what went wrong. The configuration is OK, but what's missing is that you need a Tezos node in archive mode to run the indexer. Your node seems to have pruned history so that old block receipts are no longer available.

That's why curl -v http://127.0.0.1:8732/chains/main/blocks/1 returns a 404.

See https://tezos.gitlab.io/master/user/history_modes.html for details.

atomlab commented 5 years ago

Thank you!