HomeKit-Bridge icon indicating copy to clipboard operation
HomeKit-Bridge copied to clipboard

Slow response/Process fails to quit

Open Astroman opened this issue 6 years ago • 13 comments

Quite often, Indigo gets slow in responding to Siri requests and I need to reload the plugin to fix it. In the process of reloading, I get the following error: "process (pid 619) failed to quit after polite request -- forcing it to quit now"

Expected Behavior

Siri requests should be implemented quickly without requiring the plugin to be reloaded

Current Behavior

Process takes a long time to implement requests and gives an error when reload attempts to stop it

Steps to Reproduce (for bugs)

Wait for process to get slow and then reload the plugin. I don't know what causes the process to slow down in the first place.

Versions

1.0.2
  • Plugin: YourVersion

Configuration


Homebridge Log / Command Output

I was not able to retrieve the log since it hung up when trying to display the very long log. If it's relevant, I'll try again after the problem appears the next time.

Device Simulation Report

No particular device at issue

Astroman avatar Feb 19 '19 17:02 Astroman

This is the exact reason there is an acton built into the plugin to allow you to restart one or all of your HKB servers, I suggest you create a schedule that will fire that action off. Personally I restart mine weekly because a plugin that processes this much data on a regular basis is bound to have little bits of memory that collect up over time. As a result of restoring my HKB regularly I never have this issue at all.

Colorado4Wheeler avatar Feb 19 '19 17:02 Colorado4Wheeler

OK, I’ll give that a try. Thanks!

On Feb 19, 2019, at 9:40 AM, Colorado Four Wheeler [email protected] wrote:

This is the exact reason there is an acton built into the plugin to allow you to restart one or all of your HKB servers, I suggest you create a schedule that will fire that action off. Personally I restart mine weekly because a plugin that processes this much data on a regular basis is bound to have little bits of memory that collect up over time. As a result of restoring my HKB regularly I never have this issue at all. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Colorado4Wheeler/HomeKit-Bridge/issues/127#issuecomment-465234937, or mute the thread https://github.com/notifications/unsubscribe-auth/AAhhhAMrQQTPWdjlvHn3zmf1qd8ccMTdks5vPDcdgaJpZM4bDgIZ.

Astroman avatar Feb 19 '19 17:02 Astroman

I restart mine every day at 4:15 am

rehafer avatar Feb 19 '19 18:02 rehafer

C4W - I used to do the same, restarted using the action, but I found more times than not the servers failed to start. Sometimes it was just one of 5, but often all 5 failed to start. They normally then started with no problems when I turned on the device switch from iOS Touch app.

simons-plugins avatar Feb 20 '19 07:02 simons-plugins

I can honestly say I’ve never had that problem one time since maybe the early betas of a server not starting. The fact that they start some time but not others implies other outside factors are at play. I used to restart mine daily and now only do it weekly because daily just wasn’t needed and every server starts every time.

Colorado4Wheeler avatar Feb 20 '19 13:02 Colorado4Wheeler

I recall having a similar issue back in the early days but never since. However one thing that I have found that does make management and issue solving easier is rather than have 2-3 servers chock full of items I now have about 15 different servers with items for a specific room.. then any time something goes awry it’s much easier to track down what’s causing it. Perhaps that may help in your situation?

durosity avatar Feb 20 '19 13:02 durosity

I did a full server mac restart a few days ago, and things are much better overall, not just indigo, but specifically HKB as well . I now have this set to happen once a week, and will check if HKB can now restart with no problems. My server is only 4GB so does struggle a little bit. REgular restarts should help .

On Wed, 20 Feb 2019 at 13:58 Mike [email protected] wrote:

I recall having a similar issue back in the early days but never since. However one thing that I have found that does make management and issue solving easier is rather than have 2-3 servers chock full of items I now have about 15 different servers with items for a specific room.. then any time something goes awry it’s much easier to track down what’s causing it. Perhaps that may help in your situation?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Colorado4Wheeler/HomeKit-Bridge/issues/127#issuecomment-465585308, or mute the thread https://github.com/notifications/unsubscribe-auth/AUAZ3I6EGHH_Rj4gjD7Mod4bjHotVb14ks5vPVSYgaJpZM4bDgIZ .

simons-plugins avatar Feb 20 '19 14:02 simons-plugins

I just looked at the results of using the HKB action to restart my HKB server. (The action is titled "Restart All Accessory Servers", maybe because I have only one server) Oddly, the restart action was triggered in the early morning but the actual action of shutting down and restarting the server was delayed until about an hour and a quarter later. I tried to execute it manually and the same thing happened although I haven't waited long enough to see if the server actually restarted later.

Pending figuring out what is happening, I switched the scheduled action to reloading the plugin which seems to execute reliably.

Astroman avatar Feb 20 '19 14:02 Astroman

I’m with Mike, from the beginning I have always segmented my devices into multiple servers - mostly for my own sanity and redundancy. My servers mirror my rooms in Indigo, a bedroom server, offices server, etc. Also keep all sensors on one, all cameras on one and have one security server that can do all security related things like restart the camera server, unlock doors, open the garage - that I schedule to always turn off each day when I go to bed so that there’s not even the most remote chance that someone can trigger a security device when I don’t want it.

Colorado4Wheeler avatar Feb 20 '19 14:02 Colorado4Wheeler

Hi again C4W. I've been limping along for a while now reloading HKB every night and it almost always gives the "failed to quit after polite request" after polite request error. Lately my server has been overheating and I've isolated the problem to HKB. Its IndigoPluginHost process goes up to about 80% CPU usage (gradually over the course of several hours I think) and eventually overheats the CPU. I've started monitoring the CPU temperature and automatically reloading the plugin when it exceeds a threshold to prevent the crash, but this is obviously not a good solution.

I haven't been able to isolate the cause to any specific device. I think that its memory usage also creeps up over time, possibly related to a memory leak issue that another user reported in the Indigo forum.

So, I was wondering if anything more has been learned about the cause of this problem with a solution other than reloading the plugin. Of course, if there is any further information I can provide or tests I can run, I'd be more than happy to help. I'll also try to break the devices up into even more servers to see if that helps.

And thanks again for this great plugin! It's one of the most important on my server.

--Dave

Astroman avatar Aug 11 '19 17:08 Astroman

I think I may have found what triggers the problem! I have a MagicHome device for a closet LED strip that is controlled via the FluxLED plugin. I noticed a bunch of entries in the HKB log for it so I tried removing the device from HKB. Sure enough, the plugin CPU and memory utilization dropped way down similar to that of other plugins and it has not crept up after a couple of hours now.

Here is an excerpt of the log entries that appear about once per second. No errors, just a lot of entries. FluxLED HKB log.txt

That said, I don't know why this is happening or if it is even the root cause of the memory and CPU utilization issues. It may just cause them to go up much faster than normal and maybe I'll still have to reload the plugin, just not so often. I'll probably have to leave the device off of HKB since I don't know any way to configure it to solve the problem. Of course, I'll also let the FluxLED developer know what's happening in case he can provide some more insight.

Glad to make some progress on this after so many months!

--Dave

Astroman avatar Aug 12 '19 00:08 Astroman

At first blush my guess on this would be that the device is constantly changing and constantly sending status changes back to Indigo non-stop. This is based on you removing that one device and everything settling down.

Colorado4Wheeler avatar Aug 12 '19 00:08 Colorado4Wheeler

Yeah, makes sense and it's probably slowing down my other devices too with so much activity. I'll let you know if I make any progress with the FluxLED developer. Please let me know if you notice anything in the log that sheds more light; I wasn't able to get much out of it. Thanks.

Astroman avatar Aug 12 '19 00:08 Astroman