raiden-network / raiden

Raiden Network
https://developer.raiden.network
Other
1.84k stars 378 forks source link

Traceback when PFS returns non-JSON data #4174

Closed taleldayekh closed 5 years ago

taleldayekh commented 5 years ago

Should perhaps have error handling?


/var/folders/p2/8nvdkp212ys2ct82chgfqzbh0000gn/T/_MEIENBsEE/raiden/network/rpc/client.py:479: UserWarning: Infura does not provide an API to recover the latest used nonce. This may cause the Raiden node to error on restarts.
The error will manifest while there is a pending transaction from a previous execution in the Ethereum's client pool. When Raiden restarts the same transaction with the same nonce will be retried and *rejected*, because the nonce is already used.
Checking if the ethereum node is synchronized
Traceback (most recent call last):
  File "build/raiden/raiden-script.py", line 2, in <module>
  File "raiden/__main__.py", line 13, in main
  File "click/core.py", line 764, in __call__
  File "click/core.py", line 717, in main
  File "click/core.py", line 1114, in invoke
  File "click/core.py", line 956, in invoke
  File "click/core.py", line 555, in invoke
  File "click/decorators.py", line 17, in new_func
  File "raiden/ui/cli.py", line 512, in run
  File "raiden/ui/runners.py", line 263, in run
  File "raiden/ui/runners.py", line 95, in _start_services
  File "raiden/ui/app.py", line 224, in run_app
  File "raiden/ui/startup.py", line 226, in setup_proxies_or_exit
  File "raiden/network/pathfinding.py", line 156, in configure_pfs_or_exit
  File "raiden/network/pathfinding.py", line 75, in get_pfs_info
  File "requests/models.py", line 897, in json
  File "simplejson/__init__.py", line 518, in loads
  File "simplejson/decoder.py", line 370, in decode
  File "simplejson/decoder.py", line 400, in raw_decode
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
[10068] Failed to execute script raiden-script```
palango commented 5 years ago

The problem seems to be that simplejson is used instead of the stdlib

@konradkonrad found out that simplejson gets pulled in from matrix-synapse, which is needed for the smoketests.

ulope commented 5 years ago

Sigh... requests is trying to be clever and uses simplejson if available (and if you want a case of head shaking read this issue). A PR has been merged to remove the simplejson usage but only into the 3.0 dev branch not into any 2.x release :(

So I guess we have three options:

  1. Don't use request's .json() method but instead use json.loads(response.text)
  2. Switch everything to use simplejson
  3. Monkeypatch requests to not do this anymore

This should be in order of least to most annoying / ugly.

Dominik1999 commented 5 years ago

should we go with 1 and I make a commit with find and replace?

palango commented 5 years ago

And we might want to tell the canonicaljson guys to remove the simplejson dependency.


matrix-synapse==0.33.9
  canonicaljson==1.1.4
    simplejson==3.16.0
  jsonschema==2.6.0
  signedjson==1.0.0
    canonicaljson==1.1.4
      simplejson==3.16.0
Dominik1999 commented 5 years ago

is this another solution to the 3 solutions provided by @ulope or something you would do in addition?

palango commented 5 years ago

is this another solution to the 3 solutions provided by @ulope or something you would do in addition?

In addition, but there's not much activity on that repo, so I guess chances are small to get that fix in fast.

taleldayekh commented 5 years ago

Getting similar error once again.

Traceback (most recent call last):
  File "build/raiden/raiden-script.py", line 2, in <module>
  File "raiden/__main__.py", line 13, in main
  File "click/core.py", line 764, in __call__
  File "click/core.py", line 717, in main
  File "click/core.py", line 1114, in invoke
  File "click/core.py", line 956, in invoke
  File "click/core.py", line 555, in invoke
  File "click/decorators.py", line 17, in new_func
  File "raiden/ui/cli.py", line 512, in run
  File "raiden/ui/runners.py", line 263, in run
  File "raiden/ui/runners.py", line 95, in _start_services
  File "raiden/ui/app.py", line 224, in run_app
  File "raiden/ui/startup.py", line 226, in setup_proxies_or_exit
  File "raiden/network/pathfinding.py", line 156, in configure_pfs_or_exit
  File "raiden/network/pathfinding.py", line 75, in get_pfs_info
  File "requests/models.py", line 897, in json
  File "simplejson/__init__.py", line 518, in loads
  File "simplejson/decoder.py", line 370, in decode
  File "simplejson/decoder.py", line 400, in raw_decode
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
[36774] Failed to execute script raiden-script
palango commented 5 years ago

Yeah, we know the reason for this, but haven't decided on a solution yet.

hackaugusto commented 4 years ago

This happened because the reverse proxy started before the PFS and returned bad gateway.