Re: [mh] Lock-up diagnosis
Stephen Switzer <[email protected]>
| Newsgroups | gmane.comp.misc.misterhouse.user |
|---|---|
| Message-ID | <CALSXUc0BVmUfdEVNBaK8VEs35fHm8oxMnmC2Dno_c9TMwOhN=Q@mail.gmail.com> |
Separately from this list, H Plato reached out to help, which eventually
led to what I think is the root cause - or at least a major contributor.
This is the code:
print_log("[CADDX_MONITOR] Before: The following doors were open:
> ".join(", ",@Door_Open_Array));
> if($state eq 'on') {
> push(@Door_Open_Array,$theobjname) unless grep{$_ eq $theobjname}
> @Door_Open_Array;
> }
> if($state eq 'off') {
> my $index = 0;
> $index++ until $Door_Open_Array[$index] eq $theobjname;
> splice(@Door_Open_Array, $index, 1);
> }
> $Save{door_open_count} = scalar(@Door_Open_Array);
> print_log("[CADDX_MONITOR] The following door are open: ".join(",
> ",@Door_Open_Array));
> print_log "[CADDX_MONITOR] New door_open_count:
> $Save{door_open_count}" if $Debug{caddx};
>
The problem is the until line. When the door opens, I push the name of the
door into the array. When it closes, it's removed from the array. If I get
2 Insteon messages (Yes, I have some Insteon devices that monitor doors and
shares this event code) then on the second pass the entry is no longer in
the array and perl searches endlessly past the bounds of the array
tirelessly looking for a match. So, poorly coded. I modified it to this:
for my $index (0 .. $#Door_Open_Array) {
> splice(@Door_Open_Array, $index, 1) if $Door_Open_Array[$index] eq
> $theobjname;
> }
>
Maybe this will help someone else?
Thanks!
Steve
On Sat, Oct 31, 2020 at 3:47 PM Stephen Switzer <[email protected]> wrote:
> I need some help figuring out what's happening here if anyone has a moment.
>
> BACKGROUND: My MH server's HD seized up and I didn't have everything
> backed up that I thought I did. I had my own code checked in to a git
> repository and pushed to my NAS every night, so I have that, but I made a
> lot of changes to the common code directory and even bin/mh itself - which
> I don't have. So, I've rebuilt the system with Ubuntu Server 20.04 and I
> have all the udev rules for the USB serial devices, sound working, etc...
> but it locks up now. I then decided that if I was diagnosing all of this
> and having to re-do my changes, I might as well do it on the latest MH. So,
> I checked it out of git and tried again. It still locked up.
>
> MH was locking up every 60-90 seconds when I first started working on
> this. I went through and pulled all my code out of my local directory and
> one at a time added one file in and reloaded MH. It seemed to be stable
> until I added code that uses File::Tail to monitor /var/log/syslog. I
> pulled it out, and it stabilized. So, I've left it out of the code
> directory. However, it's still locking up pretty tightly every few hours,
> days? I don't have a pattern yet, since it has only been a couple days.
>
> Right now as I write this, MH is locked up. I'm running it manually inside
> of screen as I don't have startup scripts yet:
>
> 10/31/20 01:18:56 PM [INSTEON] Door frontscreen = closed
>> 10/31/20 01:18:56 PM [CADDX] DB $idoor_frontscreen: off
>> 10/31/20 01:18:56 PM [HVAC] hvac_monitor_check_state_changes...
>> 10/31/20 01:18:57 PM [CADDX_MONITOR] Zone: $idoor_frontscreen / State: off
>> 10/31/20 01:18:57 PM [CADDX_MONITOR] Before: The following doors were
>> open: Front
>>
>> ^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C
>>
>
> I hit Ctrl-C repeatedly and it will not exit. I also ran lsof and stored
> it in a text file so I can look later if need be. To kill it, I have to:
> Crtl-Z; bg; kill -9 <PID>; fg
>
> I have a feeling that MH is waiting for something, but I don't know what.
> How can I track this? Will my lsof capture help?
>
> Thanks!
>
> --
>
> Best regards,
> Steve Switzer
>
> ---
> Get world-class business I.T. services and a phone system with awesome features that won't challenge your budget!http://www.sbsROC.com
>
>
--
Best regards,
Steve Switzer
---
Get world-class business I.T. services and a phone system with awesome
features that won't challenge your budget!http://www.sbsROC.com
________________________________________________________
To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users