Coder Social home page Coder Social logo

Comments (1)

luarx avatar luarx commented on August 16, 2024

Possible solution:

  • Catch the exception. Add a try-catch to check_sync_status_task to catch when the exception is raised and log the same error message as when it is out-of-sync or something similar to know that it is a special case logger.error("Service is out of sync - Maybe as it is not possible to calculate because of exception {exception}")
  • Exception. ConnectionError or just all the Exception types so that we can guarantee that always the logging message can be generated.

The purpose of this issue was this exception last time:

2023-10-03 04:10:17,555 [ERROR] [3406eeba/check_sync_status_task] Task safe_transaction_service.history.tasks.check_sync_status_task[3406eeba-d3fc-45c6-998e-a6f24f02037e] raised unexpected: ConnectionError(MaxRetryError("HTTPConnectionPool(host='ethereum-node.local', port=8545): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0xffff713ab490>: Failed to establish a new connection: [Errno 111] Connection refused'))"))
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 174, in _new_conn
    conn = connection.create_connection(
  File "/usr/local/lib/python3.10/site-packages/urllib3/util/connection.py", line 95, in create_connection
    raise err
  File "/usr/local/lib/python3.10/site-packages/urllib3/util/connection.py", line 85, in create_connection
    sock.connect(sa)
  File "/usr/local/lib/python3.10/site-packages/gevent/_socketcommon.py", line 590, in connect
    self._internal_connect(address)
  File "/usr/local/lib/python3.10/site-packages/gevent/_socketcommon.py", line 634, in _internal_connect
    raise _SocketError(err, strerror(err))
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 714, in urlopen
    httplib_response = self._make_request(
  File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 415, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 244, in request
    super(HTTPConnection, self).request(method, url, body=body, headers=headers)
  File "/usr/local/lib/python3.10/http/client.py", line 1283, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/lib/python3.10/http/client.py", line 1329, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.10/http/client.py", line 1278, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.10/http/client.py", line 1038, in _send_output
    self.send(msg)
  File "/usr/local/lib/python3.10/http/client.py", line 976, in send
    self.connect()
  File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 205, in connect
    conn = self._new_conn()
  File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 186, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0xffff713ab490>: 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 "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 486, in send
    resp = conn.urlopen(
  File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 798, in urlopen
    retries = retries.increment(
  File "/usr/local/lib/python3.10/site-packages/urllib3/util/retry.py", line 592, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='ethereum-node.local', port=8545): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0xffff713ab490>: 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 "/usr/local/lib/python3.10/site-packages/celery/app/trace.py", line 477, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/celery/app/trace.py", line 760, in __protected_call__
    return self.run(*args, **kwargs)
  File "/app/safe_transaction_service/history/tasks.py", line 80, in check_sync_status_task
    if not (is_service_synced := IndexServiceProvider().is_service_synced()):
  File "/app/safe_transaction_service/history/services/index_service.py", line 156, in is_service_synced
    self.ethereum_client.current_block_number - self.eth_reorg_blocks
  File "/usr/local/lib/python3.10/site-packages/gnosis/eth/ethereum_client.py", line 1280, in current_block_number
    return self.w3.eth.block_number
  File "/usr/local/lib/python3.10/site-packages/web3/eth/eth.py", line 134, in block_number
    return self.get_block_number()
  File "/usr/local/lib/python3.10/site-packages/web3/module.py", line 73, in caller
    result = w3.manager.request_blocking(
  File "/usr/local/lib/python3.10/site-packages/web3/manager.py", line 249, in request_blocking
    response = self._make_request(method, params)
  File "/usr/local/lib/python3.10/site-packages/web3/manager.py", line 188, in _make_request
    return request_func(method, params)
  File "/usr/local/lib/python3.10/site-packages/web3/middleware/cache.py", line 115, in middleware
    return make_request(method, params)
  File "/usr/local/lib/python3.10/site-packages/web3/middleware/gas_price_strategy.py", line 101, in middleware
    return make_request(method, params)
  File "/usr/local/lib/python3.10/site-packages/web3/middleware/formatting.py", line 106, in middleware
    response = make_request(method, params)
  File "/usr/local/lib/python3.10/site-packages/web3/middleware/attrdict.py", line 43, in middleware
    response = make_request(method, params)
  File "/usr/local/lib/python3.10/site-packages/web3/middleware/formatting.py", line 106, in middleware
    response = make_request(method, params)
  File "/usr/local/lib/python3.10/site-packages/web3/middleware/formatting.py", line 106, in middleware
    response = make_request(method, params)
  File "/usr/local/lib/python3.10/site-packages/web3/middleware/buffered_gas_estimate.py", line 43, in middleware
    return make_request(method, params)
  File "/usr/local/lib/python3.10/site-packages/web3/middleware/formatting.py", line 106, in middleware
    response = make_request(method, params)
  File "/usr/local/lib/python3.10/site-packages/web3/middleware/exception_retry_request.py", line 114, in middleware
    return make_request(method, params)
  File "/usr/local/lib/python3.10/site-packages/web3/providers/rpc.py", line 90, in make_request
    raw_response = make_post_request(
  File "/usr/local/lib/python3.10/site-packages/web3/_utils/request.py", line 114, in make_post_request
    response = get_response_from_post_request(endpoint_uri, data=data, *args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/web3/_utils/request.py", line 107, in get_response_from_post_request
    response = session.post(endpoint_uri, *args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 637, in post
    return self.request("POST", url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 519, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='ethereum-node.local', port=8545): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0xffff713ab490>: Failed to establish a new connection: [Errno 111] Connection refused'))

from safe-transaction-service.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.