-
Notifications
You must be signed in to change notification settings - Fork 12
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
Database gets corrupted after restart if integration is configured #58
Comments
It seems to be caused by some kind of race condition in this code: https://github.com/ldotlopez/ha-historical-sensor/blob/main/homeassistant_historical_sensor/recorderutil.py#L81
Not sure why or how to fix it 😕 |
@Anacletus, @feserdel, @ALL … I just released a new version that should fix the database corruption. |
I updated the integration, and got no database corruption for a few days. The historical consumption showed data, but historical power demand sensor, though, was always empty, maybe because of some errors that appear in the log:
However, I disabled the device from the web app (config/integrations/integration/ideenergy), and after enabling it again, database corruption shows up instantly. If needed, I can replicate it easyly.
|
Hi, I have made some changes in the https://github.com/ldotlopez/ha-historical-sensor component. You can tweak the integration manifest.json to use the v2.0.0rc6 version to try it now, otherwise I will update this components in a few days to pull that. |
Personally have no db corruption after 88cc9ce |
I'm not sure if I updated correctly the historical sensor (I changed the manifest.json in After disabling the integration and enabling it again, I inmediatly see this in home-assistant.log:
|
i was having this issue with the demo component in the main sensor repo. in my case it seemed to crop up when i tried adding data earlier than what was already there. i did an initial test using the test api that makes random data and then i switched over to using a single sensor from my api but the test data for that was about 3 days old. it was when i switched to that test data that it got the corruption error. i then renamed the sensor and that added just fine. i have not done tests to see if it is directly related so this might just be a coincidence. here is the link to the repo at the time i was getting the errors https://github.com/TomW1605/ha-synergy_old/tree/e6f22a246182737719b9b63f64bf63363f35b3ba (i think that is when i was getting the errors first, although im still getting them with my newer one that is forked from here) |
Before filling a bug please provide as much as information as possible.
Not all information is required but the more the better.
Stick to English if bug is about code, Spanish is OK if bug is about configuration.
Describe the bug
Database gets corrupted after restart if integration is configured
To Reproduce
Steps to reproduce the behavior:
1- Simply install integration, configure (mail/pass), select one of the contracts (asked between 2 in my case) an restart
2-
After a restart, you will see error in integrations menu
3- Also, in file you'll see "/homeassistant/home-assistant_v2.db.corrupted" (or something like this)
Environment
Core - 2023.11.2
Supervisor - 2023.11.3
Operating System - 11.1
Frontend - 20231030.2
Expected behavior
Not corrupting database...
Logs
Screenshots
After reloading integration:
Additional context
I've found there
home-assistant/core#101466
that maybe inserting statistics rows in old format can corrupt database
The text was updated successfully, but these errors were encountered: