Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.

Non-async Elasticsearch kwargs sniffer_timeout should be dropped #42

Closed
eLvErDe opened this issue Apr 11, 2018 · 1 comment
Closed

Non-async Elasticsearch kwargs sniffer_timeout should be dropped #42

eLvErDe opened this issue Apr 11, 2018 · 1 comment

Comments

@eLvErDe
Copy link

eLvErDe commented Apr 11, 2018

Hello,

After switching from classic driver to async one I kept the same init kwargs:

self.conn = AsyncElasticsearch(
    hosts=self.hosts,
    # http://elasticsearch-py.readthedocs.io/en/master/api.html?highlight=search#elasticsearch
    sniff_on_start=True,
    sniff_on_connection_fail=True,
    sniffer_timeout=60
)

This setting gives the traceback below. Removing sniffer_timeout make it work again. As the sniffing is probably handled completely different in async driver, I suggest dropping it from calling super.

 File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup
    future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
  File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
    result = coro.send(None)
  File "/usr/lib/python3/dist-packages/elasticsearch_async2/transport.py", line 136, in main_loop
    connection = self.get_connection()
  File "/usr/lib/python3/dist-packages/elasticsearch_async2/transport.py", line 53, in get_connection
    self.initiate_sniff()
  File "/usr/lib/python3/dist-packages/elasticsearch_async2/transport.py", line 35, in initiate_sniff
    self.sniffing_task.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
  File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
    result = coro.send(None)
  File "/usr/lib/python3/dist-packages/elasticsearch_async2/transport.py", line 116, in sniff_hosts
    node_info = yield from self._get_sniff_data(initial)
  File "/usr/lib/python3/dist-packages/elasticsearch_async2/transport.py", line 86, in _get_sniff_data
    _, headers, node_info = t.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
  File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
    result = coro.send(None)
  File "/usr/lib/python3/dist-packages/elasticsearch_async2/connection.py", line 55, in perform_request
    response = yield from self.session.request(method, url, data=body)
  File "/usr/lib/python3/dist-packages/aiohttp/helpers.py", line 91, in __iter__
    ret = yield from self._coro
  File "/usr/lib/python3/dist-packages/aiohttp/client.py", line 168, in _request
    raise RuntimeError('Session is closed')
RuntimeError: Session is closed
@sethmlarson
Copy link
Contributor

This issue has been fixed upstream in elasticsearch[async] 7.8.0. See #81 for more information.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants