-
-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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
log flooded with recorder errors: QueuePool limit of size 5 overflow 10 reached, connection timed out #2663
Comments
I'm seeing these errors too, starting just 18 minutes after the last restart of my HASS instance. Over time, my home-assistant.log is absolutely flooded with these errors. I did not have this problem with version 0.24 of HASS, but I do with version 0.25 (I skipped version 0.24.1). I connect to a MariaDB instance running on my Synology NAS. For this, my configuration.yaml file has the following code:
And my hass.env file has the following bit:
|
So both of you are using the mysqlclient dependency to connect to your database, right? Cc @kellerza |
Something is probably not closing a session, but its not clear from the trace. The What other components/platforms do you have switched on? |
I am using the Speedtest component in HASS, and now that you mention it that may actually be the culprit: that component was changed in version 0.25 to retrieve the latest test results from the database instead of showing "unknown" (after HASS or the host it's running on has been restarted). |
Yes, just tested it and it is quite persistent (3 updates per I guess the question is how to close the execute query's session, since it does not seem to auto-close on scope exit Please try to disable |
It does appear to be speedtest. After disabling there aren't any errors. My bad!! 😨 |
My suggestions for a fix:
def execute(q):
"""Query the database and convert the objects to HA native form.
This method also retries a few times in the case of stale connections.
"""
import sqlalchemy.exc
try:
for _ in range(0, RETRIES):
try:
return [
row for row in
(row.to_native() for row in q)
if row is not None]
except sqlalchemy.exc.SQLAlchemyError as e:
log_error(e, retry_wait=QUERY_RETRY_WAIT, rollback=True)
finally:
print('closing session')
Session().close()
return [] |
@nkgilley in the end I think we should probably improve both. Let me know if the above works for you and I'll push/PR the @nkgilley Although closing the session will remove the problem, do you mind moving the DB query in
|
@kellerza I tried your patch and it seems to have fixed the issue. I like your idea to run the db query on home assistant start. I will make that change and propose a PR. Thanks! |
@kellerza I can't figure out how to get the db query working at home-assistatnt start up. I always get an error that I think is happening because the speedtest component has not completely loaded all of its entities. Traceback (most recent call last):
File "/home/nolan/dev/home-assistant/homeassistant/core.py", line 844, in job_handler
func(*args)
File "/home/nolan/dev/home-assistant/homeassistant/core.py", line 308, in onetime_listener
listener(event)
File "/home/nolan/dev/home-assistant/homeassistant/components/sensor/speedtest.py", line 63, in check_last_state
recorder.query('States').filter(
File "/home/nolan/dev/home-assistant/homeassistant/components/recorder/__init__.py", line 115, in query
return Session().query(get_model(model_name), *args)
TypeError: 'NoneType' object is not callable |
Point me to your branch and I'll have a look in ~30min, PM me on gitter |
Make sure you are running the latest version of Home Assistant before reporting an issue.
You should only file an issue if you found a bug. Feature and enhancement requests should go in the Feature Requests section of our community forum:
Home Assistant release (
hass --version
):0.25.0.dev0
Python release (
python3 --version
):3.5
Component/platform:
recorder
Description of problem:
Just switched to postgres and I'm seeing a ton of these errors in the log. Also the history and detail cards in the frontend fail to load.
Problem-relevant
configuration.yaml
entries:Traceback (if applicable):
The text was updated successfully, but these errors were encountered: