Skip to content

Handle recently discovered communication issues

Mateusz Żebrak requested to merge mzebrak/communication-issues into develop

Addressing 2 issues:

  1. The first one is a failing assertion AssertionError: Invalid error response format: expected list, got <class 'dict'> because we not expected there could be a single error response when sending multiple queries in batch mode

That's because in most situations if an error occurs, it will be set on the corresponding id of the request, so we can receive some good responses and some errors in a list.

But when there is some proxy used like jussi, it seems like to the batch query (list) it can respond with a single internal error response (dict). We need to handle that in _BatchNode.__evaluate method.

request
[
  {
    "id": 0,
    "jsonrpc": "2.0",
    "method": "database_api.get_dynamic_global_properties",
    "params": {}
  },
  {
    "id": 1,
    "jsonrpc": "2.0",
    "method": "database_api.find_accounts",
    "params": {
      "accounts": [
        "gtg",
        "guest4test2",
        "small.minion",
        "blocktrades.com",
        "guest4test1"
      ]
    }
  },
  {
    "id": 2,
    "jsonrpc": "2.0",
    "method": "rc_api.find_rc_accounts",
    "params": {
      "accounts": [
        "gtg",
        "guest4test2",
        "small.minion",
        "blocktrades.com",
        "guest4test1"
      ]
    }
  },
  {
    "id": 3,
    "jsonrpc": "2.0",
    "method": "account_history_api.get_account_history",
    "params": {
      "account": "gtg",
      "limit": 1,
      "operation_filter_low": 1125899906842623,
      "include_reversible": true
    }
  },
  {
    "id": 4,
    "jsonrpc": "2.0",
    "method": "account_history_api.get_account_history",
    "params": {
      "account": "guest4test2",
      "limit": 1,
      "operation_filter_low": 1125899906842623,
      "include_reversible": true
    }
  },
  {
    "id": 5,
    "jsonrpc": "2.0",
    "method": "account_history_api.get_account_history",
    "params": {
      "account": "small.minion",
      "limit": 1,
      "operation_filter_low": 1125899906842623,
      "include_reversible": true
    }
  },
  {
    "id": 6,
    "jsonrpc": "2.0",
    "method": "account_history_api.get_account_history",
    "params": {
      "account": "blocktrades.com",
      "limit": 1,
      "operation_filter_low": 1125899906842623,
      "include_reversible": true
    }
  },
  {
    "id": 7,
    "jsonrpc": "2.0",
    "method": "account_history_api.get_account_history",
    "params": {
      "account": "guest4test1",
      "limit": 1,
      "operation_filter_low": 1125899906842623,
      "include_reversible": true
    }
  }
]
response
{
  "jsonrpc": "2.0",
  "id": null,
  "error": {
    "code": -32603,
    "message": "Internal Error",
    "data": {
      "error_id": "e5694f5f-83b9-462c-b850-39e8817131a5",
      "jussi_request_id": "000995704163508753"
    }
  }
}

log when it happened: agrabowska_-Thu_Jul_18_2024_12_34_55_GMT+0200__czas_środkowoeuropejski_letni.txt

  1. We can receive "result": null randomly
when request looks like this
[
  {
    "id": 0,
    "jsonrpc": "2.0",
    "method": "database_api.get_dynamic_global_properties",
    "params": {}
  },
  {
    "id": 1,
    "jsonrpc": "2.0",
    "method": "database_api.find_accounts",
    "params": {
      "accounts": [
        "blocktrades.com"
      ]
    }
  },
  {
    "id": 2,
    "jsonrpc": "2.0",
    "method": "rc_api.find_rc_accounts",
    "params": {
      "accounts": [
        "blocktrades.com"
      ]
    }
  },
  {
    "id": 3,
    "jsonrpc": "2.0",
    "method": "account_history_api.get_account_history",
    "params": {
      "account": "blocktrades.com",
      "limit": 1,
      "operation_filter_low": 1125899906842623,
      "include_reversible": true
    }
  }
]
we can receive response like that
[
  <correct result for ids 0,1,2>
  {
    "id': 3,
    "jsonrpc": "2.0",
    "result": null
  }
]

Additionally:

  • Fix hiding communication error message in some case (notification would only show replaced message even when there was error details that could not be replaced)
  • Hide exception details (full request, response) in favor of f"Communication error with {url}:\n{error_details}"
Edited by Mateusz Żebrak

Merge request reports

Loading