Skip to content
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

Exception on NodePool._dead_nodes #114

Closed
floxay opened this issue Sep 7, 2023 · 0 comments · Fixed by #115
Closed

Exception on NodePool._dead_nodes #114

floxay opened this issue Sep 7, 2023 · 0 comments · Fixed by #115

Comments

@floxay
Copy link
Contributor

floxay commented Sep 7, 2023

Traceback:

  File "C:\Users\x\AppData\Local\Programs\Python\Python311\Lib\asyncio\tasks.py", line 605, in _wait_for_one
    return f.result()  # May raise f.exception().
           ^^^^^^^^^^
  File "C:\Users\x\AppData\Local\Programs\Python\Python311\Lib\site-packages\elasticsearch\_async\client\__init__.py", line 3865, in search
    return await self.perform_request(  # type: ignore[return-value]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\x\AppData\Local\Programs\Python\Python311\Lib\site-packages\elasticsearch\_async\client\_base.py", line 285, in perform_request
    meta, resp_body = await self.transport.perform_request(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\x\AppData\Local\Programs\Python\Python311\Lib\site-packages\elastic_transport\_async_transport.py", line 311, in perform_request
    self.node_pool.mark_dead(node)
  File "C:\Users\x\AppData\Local\Programs\Python\Python311\Lib\site-packages\elastic_transport\_node_pool.py", line 245, in mark_dead
    self._dead_nodes.put((now + timeout, node))
  File "C:\Users\x\AppData\Local\Programs\Python\Python311\Lib\queue.py", line 150, in put
    self._put(item)
  File "C:\Users\x\AppData\Local\Programs\Python\Python311\Lib\queue.py", line 236, in _put
    heappush(self.queue, item)
TypeError: '<' not supported between instances of 'AiohttpHttpNode' and 'AiohttpHttpNode'

Code:

self._dead_nodes.put((now + timeout, node))
+ likely all other places where the queue is accessed/modified.

To my understanding this happens because the timestamp (first item in the tuple) is not unique and because of this an unimplemented < comparison is attempted on the next item of the tuple, which is the node object.

From Common Sequence Operations:

Sequences of the same type also support comparisons. In particular, tuples and lists are compared lexicographically by comparing corresponding elements. This means that to compare equal, every element must compare equal and the two sequences must be of the same type and have the same length. (For full details see Comparisons in the language reference.)

@floxay floxay changed the title Exception in NodePool._dead_nodes Exception on NodePool._dead_nodes Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant