kizniche / Mycodo

An environmental monitoring and regulation system
http://kylegabriel.com/projects/
GNU General Public License v3.0
2.93k stars 491 forks source link

HTU21D does not start after upgrade #217

Closed zsole2 closed 6 years ago

zsole2 commented 7 years ago

Mycodo Issue Report:

v5.0.8

Problem Description

Upgraded this morning. After a few minutes, I realized that no temp data are collected. As it helped in the past, I rebooted, and the temp readings normalized.

Errors

mycodo.log.txt influxd.log.txt mycodoupgrade.log.txt

Steps to Reproduce the issue:

Additional Notes

Apparently the reboot solved the issue with HTU21D, which as far as I can see is indicated in line 346 of the mycodo log. The upgrade log shows no errors. After reboot, some errors are there, but then everything normalizes, after about 6-7 minutes, which coincides with the influxd log, this is the time needed to start it up on Pi Zero (in line with the issue the other day with the setup script). The stat encoding is still not solved, but it the issue probably lies with the geocoder module. It would help reading the log if a few separator lines were present at the start of the daemon... A timestamp at the finish of the upgrade would be also nice...

kizniche commented 7 years ago

Apparently the reboot solved the issue with HTU21D

I'm not sure what happened there, but it appears it is an issue with the Pi Zero slow bootup and perhaps influxdb hadn't started yet.

The stat encoding is still not solved

Yes, that's a particularly annoying bug because I don't know how many systems it's affecting.

It would help reading the log if a few separator lines were present at the start of the daemon

I'll add these

A timestamp at the finish of the upgrade would be also nice

This was included in 5.0.8, but you'll have to wait fir the next upgrade for it to take effect.

kizniche commented 7 years ago

I created an issue (#218) to track the geocoder issue, but I also just released v5.0.9 that updates geocoder from 1.15.0 to 1.21.0. Can you report back in that issue if it fixes it for you?

kizniche commented 7 years ago

Reading geocoder's changelog, it appears it may have been fixed a few versions ago:

Fixed Python2 encoding issues

zsole2 commented 7 years ago

I'm afraid the reboot issue was not due to the slow start of influxd. The last section of mycodo log show about 7 mins delay, while the next to last section, after upgrade and before the reboot, is about 30 mins in length. Only then I decided to reboot. I'll upgrade soon a see the other stuff...

kizniche commented 7 years ago

I was meaning the demon rebooting. Have you tried restarting the daemon (sudo service mycodo restart) instead of rebooting the whole system?

zsole2 commented 7 years ago

It appears that the upgrade was perfect, without any errors !!!! No encoding error, no influxd error...

n addition, the statistic shows that it detected HU as country, can you check if id No. nhYIezpq8Jxr was sent out around 19:00 Central European time?

kizniche commented 7 years ago

Great! I'll have to check later, as the stats can only be viewed from a specific computer.

kizniche commented 7 years ago

I'm finding some issues with the upgrade process. Hopefully v5.0.11 is a final solution.

kizniche commented 7 years ago

I think everything is in a working state now, but I'm not sure how many databases have been messed up from the issues of previous version upgrade. Let me know if you have any issues.

If you do, you can delete the only row in the alembic_version table (using SQLiteStudio), save the database, and restart the web UI, then the daemon, and it will fix itself.

zsole2 commented 7 years ago

Right now everything looks perfect in my setup with v5.0.10, so I'll wait for all reading to stabilize. Let's see if others follow these new releases and report problems if they have any.

kizniche commented 7 years ago

If you made it to 5.0.10 without issue, you are probably fine. This issue will affect people who are upgrading form an older version, such as 5.0.7. I didn't notice the issue at first because I was upgrading incrementally, and not going multiple versions before upgrading. Upgrades are a headache sometimes, because you have to ensure upgrades work flawlessly from any other minor/subversion.

kizniche commented 7 years ago

Not really sure where to go with this issue. It'd guess it was a one-off event. What do you think?

zsole2 commented 7 years ago

Probably, I have upgraded 3 times since then, without problem....

zsole2 commented 7 years ago

The HTU21D sensor again gave me trouble on upgrade. This time it was from v5.0.10 to v5.0.17. See line 88 of mycodo_log.txt. After realizing the problem, I tried to restart the daemon, but it did not start, and unfortunately I was not at my PC, and did not save the exact failure info. Then I rebooted, and it started OK, except for the 4-5 minutes that was needed for influxd to start. The empty lines are really useful for reading the log, by the way... Could be good to have it when the daemon starts after reboot, too...

kizniche commented 7 years ago

My HTU21D sensors (2) didn't work properly when I first tested them a few months ago. I'll see if I can get them working when I get home. I suspect it was due to using 5 volts instead of 3.3 volts power.

I'm still not sure what the issue is, but I suspect it's influxdb restarting after an influxdb upgrade. Check your upgrade log to see of your influxdb was indeed upgraded with your mycodo upgrade.

kizniche commented 7 years ago

So I may need to add a helper script that checks if influxdb has started before continuing the upgrade process, sort of how the setup script does during an install to ensure it's running to be able to create the database and user.

kizniche commented 6 years ago

I believe this may have been due to an influxdb issue. I'm going to close it since there have been a lot of patches to influxdb to resolve crashing issues. Feel free to reopen if the current version of influxdb still does this.