Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Querying some tokens via cryptocompare returns empty object which leads to a crash #527

Closed
LefterisJP opened this issue Oct 23, 2019 · 1 comment · Fixed by #529
Closed

Comments

@LefterisJP
Copy link
Member

Problem Definition

Since 17.10.19 it seems that for some token price queries in cryptocompare an empty object {} is returned which does not seem to agree with the API documentation and leads to a crash.

The crash was seen by a Rotki user and looks like this in the logs:

17/10/2019 13:28:56 +08 -- DEBUG:rotkehlchen.inquirer:Get usd price from cryptocompare asset=WETH

17/10/2019 13:28:57 +08 -- ERROR:rotkehlchen.server:Greenlet for task 2 dies with exception: 'Response'.
Exception Name: <class 'KeyError'>
Exception Info: 'Response'
Traceback:

   File "src/gevent/greenlet.py", line 716, in gevent._greenlet.Greenlet.run
  File "rotkehlchen/server.py", line 132, in _query_async
  File "rotkehlchen/server.py", line 370, in query_balances
  File "rotkehlchen/rotkehlchen.py", line 368, in query_balances
  File "rotkehlchen/utils/misc.py", line 109, in wrapper
  File "rotkehlchen/blockchain.py", line 86, in query_balances
  File "rotkehlchen/blockchain.py", line 405, in query_ethereum_balances
  File "rotkehlchen/blockchain.py", line 354, in query_ethereum_tokens
  File "rotkehlchen/inquirer.py", line 133, in find_usd_price
  File "rotkehlchen/inquirer.py", line 49, in query_cryptocompare_for_fiat_price

17/10/2019 13:29:38 +08 -- DEBUG:rotkehlchen.rotkehlchen:Main loop start

17/10/2019 13:29:38 +08 -- DEBUG:rotkehlchen.rotkehlchen:Main loop end

An example of the offending cryptocompare API request is this:

https://min-api.cryptocompare.com/data/price?fsym=WETH&tsyms=USD

which returns {}

Normally for non-existing tokens or tokens for which data does not exist a proper error is returned like here:

https://min-api.cryptocompare.com/data/price?fsym=XXXX&tsyms=USD

{"Response":"Error","Message":"There is no data for the symbol XXXX .","HasWarning":false,"Type":2,"RateLimit":{},"Data":{},"ParamWithError":"fsym"}

The unexpected empty object leads to a crash of Rotki, so it's important to fix.

Task

After talking with @vcealicu I confirmed this is a bug on the cryptocompare side so it should eventually go away on its own.

But the fact of the matter remains that any such unexpected answer should not crash the Rotki application. So we just need to handle the empty object return.

@LefterisJP
Copy link
Member Author

@Pol-Lanski fyi ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant