Is there some code that can lock the Home Assistant process completely so it has to be killed?

Without damaging anything in the configuration, please… :wink:

I know it’s a weird request, the reason I need it is to test a Python script that kills the process if a regular stop command doesn’t work. And I won’t know for sure if that works before I can use code that can lock HA completely. So script, automation, anything that can be triggered and locks up the process.

Well, most of the code runs in the main thread as asyncio (i.e., concurrent, cooperative multitasking), so just temporarily modify any async function that you know runs and insert an infinite loop. That should bring it to its knees! :wink:

Thanks for answering! I don’t think I have any code like that. I only use Z-Wave to MQTT functionality and vice versa. But you’re saying something like the BASIC classic (yeah, I was alive and computing back then…):

10 PRINT “HELLO WORLD!”

20 GOTO 10

Do you have a suggestion I could put into an automation or script and trigger from the dashboard?

Sorry, I’m talking about HA’s Python code itself (or maybe the code of a custom component), not an automation or script. If HA could be locked up by a buggy automation or script, then that would be a big problem with HA itself.

Aha, I see! Well, then I guess I’m seriously out of my depth. I can do BASIC well, and I can program Python and LUA scripts and stuff. But that’s about it… I was thinking about something like a Python

import time
time.sleep(60000)

That would make a python script lock up whatever’s running it for a minute if it’s single threaded.

The worst part is that I remember I messed up some code a year or so back that worked in such a way that when HA was restarted, it locked up in the middle of the startup. I just can’t remember what that was!

I suppose you could mess up something in the configuration that would prevent HA from properly starting.

So…any ideas? :wink: I have no idea what I should mess up and how.

Open configuration.yaml and remove the colon from the end of this line:

homeassistant:

That will prevent HA from starting normally.

Thanks! That did not work perfectly. :rofl:

1 Like