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

Improve behaviour when the Eth node is unreachable #1902

Closed
ulope opened this Issue Jul 20, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@ulope
Collaborator

ulope commented Jul 20, 2018

Problem Definition

If the Eth node is unreachable we currently throw a pretty gnarly exception (see below).
Instead we need to provide a helpful message to the user and exit gracefully.

Traceback (most recent call last):
  File "site-packages/urllib3/connection.py", line 171, in _new_conn
  File "site-packages/urllib3/util/connection.py", line 79, in create_connection
  File "site-packages/urllib3/util/connection.py", line 69, in create_connection
  File "site-packages/gevent/_socket3.py", line 336, in connect
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "site-packages/urllib3/connectionpool.py", line 600, in urlopen
  File "site-packages/urllib3/connectionpool.py", line 354, in _make_request
  File "http/client.py", line 1239, in request
  File "http/client.py", line 1285, in _send_request
  File "http/client.py", line 1234, in endheaders
  File "http/client.py", line 1026, in _send_output
  File "http/client.py", line 964, in send
  File "site-packages/urllib3/connection.py", line 196, in connect
  File "site-packages/urllib3/connection.py", line 180, in _new_conn
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f70bd0c8f60>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "site-packages/requests/adapters.py", line 445, in send
  File "site-packages/urllib3/connectionpool.py", line 638, in urlopen
  File "site-packages/urllib3/util/retry.py", line 398, in increment
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=8545): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f70bd0c8f60>: Failed to establish a new connection: [Errno 111] Connection refused',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "raiden-script.py", line 2, in <module>
  File "site-packages/raiden/__main__.py", line 11, in main
  File "site-packages/click/core.py", line 722, in __call__
  File "site-packages/click/core.py", line 697, in main
  File "site-packages/click/core.py", line 1043, in invoke
  File "site-packages/click/core.py", line 895, in invoke
  File "site-packages/click/core.py", line 535, in invoke
  File "site-packages/click/decorators.py", line 17, in new_func
  File "site-packages/raiden/ui/cli.py", line 991, in run
  File "site-packages/raiden/ui/cli.py", line 891, in _run_app
  File "site-packages/click/core.py", line 535, in invoke
  File "site-packages/raiden/ui/cli.py", line 596, in app
  File "site-packages/raiden/network/rpc/client.py", line 229, in __init__
  File "site-packages/web3/version.py", line 14, in node
  File "site-packages/web3/manager.py", line 107, in request_blocking
  File "site-packages/web3/manager.py", line 90, in _make_request
  File "site-packages/web3/middleware/gas_price_strategy.py", line 18, in middleware
  File "cytoolz/functoolz.pyx", line 232, in cytoolz.functoolz.curry.__call__
  File "site-packages/web3/middleware/formatting.py", line 50, in apply_formatters
  File "site-packages/web3/middleware/attrdict.py", line 18, in middleware
  File "cytoolz/functoolz.pyx", line 232, in cytoolz.functoolz.curry.__call__
  File "site-packages/web3/middleware/formatting.py", line 50, in apply_formatters
  File "site-packages/web3/middleware/normalize_errors.py", line 9, in middleware
  File "cytoolz/functoolz.pyx", line 232, in cytoolz.functoolz.curry.__call__
  File "site-packages/web3/middleware/formatting.py", line 50, in apply_formatters
  File "cytoolz/functoolz.pyx", line 232, in cytoolz.functoolz.curry.__call__
  File "site-packages/web3/middleware/formatting.py", line 50, in apply_formatters
  File "cytoolz/functoolz.pyx", line 232, in cytoolz.functoolz.curry.__call__
  File "site-packages/web3/middleware/formatting.py", line 50, in apply_formatters
  File "site-packages/web3/middleware/exception_retry_request.py", line 87, in middleware
  File "site-packages/web3/providers/rpc.py", line 68, in make_request
  File "site-packages/web3/utils/request.py", line 26, in make_post_request
  File "site-packages/requests/sessions.py", line 559, in post
  File "site-packages/requests/sessions.py", line 512, in request
  File "site-packages/requests/sessions.py", line 622, in send
  File "site-packages/requests/adapters.py", line 513, in send
requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=8545): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f70bd0c8f60>: Failed to establish a new connection: [Errno 111] Connection refused',))
[21787] Failed to execute script raiden-script

@ulope ulope added the usability label Jul 20, 2018

@LefterisJP LefterisJP self-assigned this Jul 22, 2018

@LefterisJP

This comment has been minimized.

Collaborator

LefterisJP commented Jul 22, 2018

I'll quickly do this as I just got the same exception due to using a non-standard port and it 's indeed really ugly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment