Skip to content

How to stop retry when ES service is down #1170

@shivam05011996

Description

@shivam05011996

I have a situation where a document tries to index thrice when the ES is down. Is there a way to not retry. -

Traceback (most recent call last):
  File "/root/shivam/k_env/lib/python3.5/site-packages/urllib3/connection.py", line 171, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw)
  File "/root/shivam/k_env/lib/python3.5/site-packages/urllib3/util/connection.py", line 79, in create_connection
    raise err
  File "/root/shivam/k_env/lib/python3.5/site-packages/urllib3/util/connection.py", line 69, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/shivam/k_env/lib/python3.5/site-packages/elasticsearch/connection/http_urllib3.py", line 172, in perform_request
    response = self.pool.urlopen(method, url, body, retries=Retry(False), headers=request_headers, **kw)
  File "/root/shivam/k_env/lib/python3.5/site-packages/urllib3/connectionpool.py", line 638, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/root/shivam/k_env/lib/python3.5/site-packages/urllib3/util/retry.py", line 343, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/root/shivam/k_env/lib/python3.5/site-packages/urllib3/packages/six.py", line 686, in reraise
    raise value
  File "/root/shivam/k_env/lib/python3.5/site-packages/urllib3/connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "/root/shivam/k_env/lib/python3.5/site-packages/urllib3/connectionpool.py", line 354, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib/python3.5/http/client.py", line 1106, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python3.5/http/client.py", line 1151, in _send_request
    self.endheaders(body)
  File "/usr/lib/python3.5/http/client.py", line 1102, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python3.5/http/client.py", line 934, in _send_output
    self.send(msg)
  File "/usr/lib/python3.5/http/client.py", line 877, in send
    self.connect()
  File "/root/shivam/k_env/lib/python3.5/site-packages/urllib3/connection.py", line 196, in connect
    conn = self._new_conn()
  File "/root/shivam/k_env/lib/python3.5/site-packages/urllib3/connection.py", line 180, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f4628058cf8>: Failed to establish a new connection: [Errno 111] Connection refused

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions