Very messy report when ES database is not available
- Dominant language
- Python
- Stars
- 45
- Forks
- 23
- PR merge metrics
- No merged PRs in 30d
Description
The following text appeared in a dialog box when the ES database was not running.
It may be suitable for a developer log, but it is not suitable for a client app.
There is also a secondary error, which is surely a bug?
An error code 500 occured while trying to fetch http://localhost/api/stats.lua?list=dev&domain=ponymail.apache.org:
API error occurred:
Traceback (most recent call last):
File "/virtualenvs/pmfoal-kUZLcuCl/lib/python3.9/site-packages/aiohttp/connector.py", line 936, in _wrap_create_connection
return await self._loop.create_connection(*args, **kwargs) # type: ignore # noqa
File "/usr/local/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 1056, in create_connection
raise exceptions[0]
File "/usr/local/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 1041, in create_connection
sock = await self._connect_sock(
File "/usr/local/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 955, in _connect_sock
await self.sock_connect(sock, address)
File "/usr/local/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/selector_events.py", line 502, in sock_connect
return await fut
File "/usr/local/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/selector_events.py", line 507, in _sock_connect
sock.connect(address)
OSError: [Errno 65] No route to host
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/virtualenvs/pmfoal-kUZLcuCl/lib/python3.9/site-packages/elasticsearch/_async/http_aiohttp.py", line 291, in perform_request
async with self.session.request(
File "/virtualenvs/pmfoal-kUZLcuCl/lib/python3.9/site-packages/aiohttp/client.py", line 1012, in __aenter__
self._resp = await self._coro
File "/virtualenvs/pmfoal-kUZLcuCl/lib/python3.9/site-packages/aiohttp/client.py", line 480, in _request
conn = await self._connector.connect(
File "/virtualenvs/pmfoal-kUZLcuCl/lib/python3.9/site-packages/aiohttp/connector.py", line 523, in connect
proto = await self._create_connection(req, traces, timeout)
File "/virtualenvs/pmfoal-kUZLcuCl/lib/python3.9/site-packages/aiohttp/connector.py", line 858, in _create_connection
_, proto = await self._create_direct_connection(
File "/virtualenvs/pmfoal-kUZLcuCl/lib/python3.9/site-packages/aiohttp/connector.py", line 1004, in _create_direct_connection
raise last_exc
File "/virtualenvs/pmfoal-kUZLcuCl/lib/python3.9/site-packages/aiohttp/connector.py", line 980, in _create_direct_connection
transp, proto = await self._wrap_create_connection(
File "/virtualenvs/pmfoal-kUZLcuCl/lib/python3.9/site-packages/aiohttp/connector.py", line 943, in _wrap_create_connection
raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host localhost:9200 ssl:default [No route to host]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/git/pmfoal/server/main.py", line 133, in handle_request
output = await xhandler.exec(self, session, indata)
File "/git/pmfoal/server/endpoints/stats.py", line 42, in process
results = await plugins.messages.query(
File "/git/pmfoal/server/plugins/messages.py", line 326, in query
async for hit in session.database.scan(
File "/git/pmfoal/server/plugins/database.py", line 109, in scan
resp = await self.search(
File "/git/pmfoal/server/plugins/database.py", line 71, in search
res = await self.client.search(index=index, **kwargs)
File "/virtualenvs/pmfoal-kUZLcuCl/lib/python3.9/site-packages/elasticsearch/_async/client/__init__.py", line 1682, in search
return await self.transport.perform_request(
File "/virtualenvs/pmfoal-kUZLcuCl/lib/python3.9/site-packages/elasticsearch/_async/transport.py", line 327, in perform_request
raise e
File "/virtualenvs/pmfoal-kUZLcuCl/lib/python3.9/site-packages/elasticsearch/_async/transport.py", line 296, in perform_request
status, headers, data = await connection.perform_request(
File "/virtualenvs/pmfoal-kUZLcuCl/lib/python3.9/site-packages/elasticsearch/_async/http_aiohttp.py", line 324, in perform_request
raise ConnectionError("N/A", str(e), e)
elasticsearch.exceptions.ConnectionError: ConnectionError(Cannot connect to host localhost:9200 ssl:default [No route to host]) caused by: ClientConnectorError(Cannot connect to host localhost:9200 ssl:default [No route to host])
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at server/main.py:133 and trace the request through server/endpoints/stats.py and server/plugins/database.py, where the Elasticsearch connection failure is surfaced. Reproduce the unavailable-database case and make the client-facing dialog concise without the traceback, while addressing the secondary error described in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- elasticsearch, python
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100