Homeassistant needs a locking mechanism

That would be super easy to implement and would make running two containers of home assistant in parallel impossible.

Which totally f*cks up the statistics recorder. Ask me how I know…

Bonus: since these types of errors are self propagating, you end up with a destroyed database.

Anyways: a simple check_lockfile() method in the startup code would prevent those problems.