BitBotFactory/MikaLendingBot

[Error] Bot crashes after network issue

JCBauza opened this issue · 2 comments

2018-06-24 23:36:05 Error HTTPSConnectionPool(host='api.bitfinex.com', port=443): Max retries exceeded with url: /v1/offer/new (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f3ee7aa0e50>: Failed to establish a new connection: [Errno 113] No route to host',)) Requesting https://api.bitfinex.com/v1/offer/new
--
2018-06-24 23:36:05 Error HTTPSConnectionPool(host='api.bitfinex.com', port=443): Max retries exceeded with url: /v1/offer/new (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f3ee7aa0e50>: Failed to establish a new connection: [Errno 113] No route to host',)) payload:{'nonce': '152990129624939', 'direction': 'lend', 'request': '/v1/offer/new', 'rate': '23.0084466', 'period': 9, 'currency': u'EOS', 'amount': '13.97391293'}

2018-06-24 23:36:05 Error HTTPSConnectionPool(host='api.bitfinex.com', port=443): Max retries exceeded with url: /v1/offer/new (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f3ee7aa0e50>: Failed to establish a new connection: [Errno 113] No route to host',)) payload:{'nonce': '152990129624939', 'direction': 'lend', 'request': '/v1/offer/new', 'rate': '23.0084466', 'period': 9, 'currency': u'EOS', 'amount': '13.97391293'}
2018-06-24 23:36:05 Error HTTPSConnectionPool(host='api.bitfinex.com', port=443): Max retries exceeded with url: /v1/offer/new (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f3ee7aa0e50>: Failed to establish a new connection: [Errno 113] No route to host',)) Requesting https://api.bitfinex.com/v1/offer/new
Traceback (most recent call last):
  File "lendingbot.py", line 114, in <module>
    Lending.lend_all()
  File "/poloniexlendingbot/modules/Lending.py", line 252, in lend_all
    usable_currencies += lend_cur(cur, total_lent, lending_balances, ticker)
  File "/poloniexlendingbot/modules/Lending.py", line 475, in lend_cur
    raise msg
ConnectionError: HTTPSConnectionPool(host='api.bitfinex.com', port=443): Max retries exceeded with url: /v1/offer/new (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f3ee7aa0e50>: Failed to establish a new connection: [Errno 113] No route to host',))

v326
 Unhandled error, please open a Github issue so we can fix it!
Error during new loans notification: HTTPSConnectionPool(host='api.bitfinex.com', port=443): Max retries exceeded with url: /v1/credits (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f3ee7be1f50>: Failed to establish a new connection: [Errno 113] No route to host',)) Requesting https://api.bitfinex.com/v1/credits
Traceback (most recent call last):
  File "lendingbot.py", line 164, in <module>
    log.notify("{0}\n-------\n{1}".format(ex, traceback.format_exc()), notify_conf)
  File "/poloniexlendingbot/modules/Logger.py", line 168, in notify
    send_notification(msg, notify_conf)
  File "/poloniexlendingbot/modules/Notify.py", line 125, in send_notification
    post_to_slack(msg, nc['slack_channels'], nc['slack_token'], nc['slack_username'])
  File "/poloniexlendingbot/modules/Notify.py", line 46, in post_to_slack
    response = urllib2.urlopen(url, enc_post_data)
  File "/usr/lib/python2.7/urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 429, in open
    response = self._open(req, data)
  File "/usr/lib/python2.7/urllib2.py", line 447, in _open
    '_open', req)
  File "/usr/lib/python2.7/urllib2.py", line 407, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 1241, in https_open
    context=self._context)
  File "/usr/lib/python2.7/urllib2.py", line 1198, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>

Caused by a temporary outage in your internet/DNS, all we would be able to do is sit there and wait for your internet to come back on, which might not be a bad idea.

Maybe I was not clear. When this happens, the application crashes. This is not a handled error so even if the network/internet comes back up, it won't matter. You need to manually terminate the execution and restart the program. So though we could talk about caching DNS results or what not, this error needs to be handled maybe with a minute delay and try again and avoid outright crashing.