core: Problems updating record on mariadb after 0.107.x update

The problem

I am having problems with recorder after 0.107.x update; before that, it was working as expected but now it doesn’t save the data to my mariadb (community plugin over docker). I did some test, reboot, purge the entire mariadb and nothing.

Home Assistant is creating tables on mariadb:

MariaDB [homeassistant]> show tables; ±------------------------+ | Tables_in_homeassistant | ±------------------------+ | events | | recorder_runs | | schema_changes | | states | ±------------------------+ 4 rows in set (0.001 sec)

But isn’t inserting the information on the tables:

MariaDB [homeassistant]> select * from states; Empty set (0.001 sec)

My recorder config is as follows:

recorder: db_url: mysql://user:password@core-mariadb/homeassistant?charset=utf8 purge_interval: 1 purge_keep_days: 3

If I return to sqlite commenting the following line:

db_url: mysql://user:password@core-mariadb/homeassistant?charset=utf8

It returns to work as expected.

Environment

  • Home Assistant release with the issue: 0.107.x
  • Last working Home Assistant release (if known): 0.106.x
  • Operating environment (Hass.io/Docker/Windows/etc.): Docker (for both, homeassistant and mariadb)
  • Integration causing this issue: Recorder over mariadb
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/recorder/

Problem-relevant configuration.yaml

recorder: db_url: mysql://user:password@core-mariadb/homeassistant?charset=utf8 purge_interval: 1 purge_keep_days: 3


Traceback/Error logs

There is not any information on logs about the issue due Home Assistant can connect successfully to mariadb and can create tables.


Additional information

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 22 (5 by maintainers)

Most upvoted comments

I was having the same issue on 0.107.x, using both the MariaDB addon as well as an external MariaDB server.

The recorder would write state changes to db for a few minutes after restart before stopping – a restart of HA would temporarily solve the issue but once again it would hang after a few minutes.

at some point I received

InvalidRequestError: Can’t reconnect until invalid transaction is rolled back

my research indicated people had been having this error message when failing to declare a charset on their URI, but I had been using ?charset=utf8

other than that I wasn’t getting any logs at all from the recorder, even with log level info

Finally downgraded to 0.106.x and everything appears to be working again