near / nearcore

Reference client for NEAR Protocol
https://near.org
GNU General Public License v3.0
2.33k stars 629 forks source link

MissingTrieValue error #11174

Closed quick-pawiromitchel closed 2 weeks ago

quick-pawiromitchel commented 6 months ago

Describe the bug Getting this error while calling query request_type: "view_account"

{
  "jsonrpc": "2.0",
  "error": {
    "name": "INTERNAL_ERROR",
    "cause": {
      "info": {
        "error_message": "MissingTrieValue(TrieStorage, 6R5be3snoVFvPBUJ8SnQFqsFEZKXDCxNL84qx5cdFN7u)"
      },
      "name": "INTERNAL_ERROR"
    },
    "code": -32000,
    "message": "Server error",
    "data": "The node reached its limits. Try again later. More details: MissingTrieValue(TrieStorage, 6R5be3snoVFvPBUJ8SnQFqsFEZKXDCxNL84qx5cdFN7u)"
  },
  "id": "dontcare"
}

To Reproduce

{
  "id": "dontcare",
  "jsonrpc": "2.0",
  "method": "query",
  "params": {
    "account_id": "0c314a28fd955d193fd452bf4b29b872dc4450a778b155feb777c52269d436e5",
    "block_id": 114686869,
    "request_type": "view_account"
  }
}

Expected behavior To not return the error

Version (please complete the following information): We're running 1.39.1

Additional context Running the same query against the public RPC returns an error as well

Longarithm commented 6 months ago

For me, against https://rpc.mainnet.near.org/, it returned Cause: {'info': {'block_hash': 'FnckcaXuh9FcRDYCVjsnRhgtU7chtXwJhwKv3UdXRxim', 'block_height': 114686869}, 'name': 'GARBAGE_COLLECTED_BLOCK'}, Data: The data for block #114686869 is garbage collected on this node, use an archival node to fetch historical data so I couldn't reproduce it. The block should be indeed garbage collected for RPC nodes. You can consider querying https://archival-rpc.mainnet.near.org/ but for me it says that account doesn't exist, which is probably true.

quick-pawiromitchel commented 6 months ago

You can consider querying https://archival-rpc.mainnet.near.org/ but for me it says that account doesn't exist, which is probably true.

I did, the public rpc returns with a different error but it doesn't make sense

{
  "jsonrpc": "2.0",
  "error": {
    "code": -32000,
    "message": "Server error",
    "data": "account 0c314a28fd955d193fd452bf4b29b872dc4450a778b155feb777c52269d436e5 does not exist while viewing",
    "name": "HANDLER_ERROR",
    "cause": {
      "info": {
        "block_hash": "FnckcaXuh9FcRDYCVjsnRhgtU7chtXwJhwKv3UdXRxim",
        "block_height": 114686869,
        "requested_account_id": "0c314a28fd955d193fd452bf4b29b872dc4450a778b155feb777c52269d436e5"
      },
      "name": "UNKNOWN_ACCOUNT"
    }
  },
  "id": "dontcare"
}

It says unknown account, but the account does exist https://nearblocks.io/address/0c314a28fd955d193fd452bf4b29b872dc4450a778b155feb777c52269d436e5

Longarithm commented 6 months ago

Ah, I understand your concern. The reason is that NEAR is "pre-state-root" blockchain, so when block is distributed, it includes state root corresponding to state before the block was applied. If you try next height, it will work.

Longarithm commented 6 months ago

More context - the error itself expected, the error message is not really expected. What should happen is this - example in python:

ValueError: Cause: {'info': {'block_hash': '7ZqGJgiUfhhn5iWzCJ32puRHX7SCgreVVvtcSBcdHgQ7', 'block_height': 114686870}, 'name': 'GARBAGE_COLLECTED_BLOCK'}, Data: The data for block #114686870 is garbage collected on this node, use an archival node to fetch historical data

Error says that we don't have state for the block anymore. The MissingTrieValue is an internal error and likely indicates DB corruption.

telezhnaya commented 1 month ago

Could you please check if it's still an issue?

telezhnaya commented 2 weeks ago

Closing due to no response. Please reopen if needed.