genielabs / HomeGenie

HomeGenie, the programmable automation intelligence
https://homegenie.it
GNU General Public License v3.0
387 stars 154 forks source link

Segmentation fault #457

Closed tuicemen closed 1 year ago

tuicemen commented 1 year ago

Version homegenie_1.4.0-beta.15_linux-arm64.zip

Describe the bug typing in sudo ./HomGenie or just ./HomeGenie results in tha return of Segmentation fault Code to Reproduce installed a fresh 64 bit rasbian OS on my 3b+ pi then unzipped the zip file opening the homegenie folder and typing in sudo ./HomGenie or just ./HomeGenie results in the fault.

Expected behavior I either expected a confirmation the HG service was started ,running or so sort of confirmation things were OK Screenshots/Stacktrace

pi@64bit-raspberrypi:~ $ cd homegenie pi@64bit-raspberrypi:~/homegenie $ sudo ./HomeGenie Segmentation fault pi@64bit-raspberrypi:~/homegenie $ ./HomeGenie Segmentation fault pi@64bit-raspberrypi:~/homegenie $ cd pi@64bit-raspberrypi:~ $ dir Bookshelf Downloads homegenie_1.4.0-beta.15_linux-arm64.zip Public Desktop ha-bridge Music Templates Documents homegenie Pictures Videos

Additional context @genemars this is my first beta 64 bit install attempt so I may have missed something I did include the additional installs adds for x10 and gpio prior to unzipping HG. Maybe these should have been done after installing HG and from the HG folder?

tuicemen commented 1 year ago

I believe this was caused from a corrupt download as I uninstalled and then installed beta13 without issue then updated to 15. I then uninstalled and redownloaded 15 which installed and ran without issue.

tuicemen commented 1 year ago

well this doesn't appear to be a corrupt download I get this repeatedly trying to run a installed HG on a different SD card even beta 9 usually when attempting setup. I got this line reported prior to the last fault: 2023-01-15 14:56:14.9982 Error System.Threading.ThreadInterruptedException: Thread was interrupted from a waiting state. if this happens during a update I get this when I attempt to restart the service: Error: An assembly specified in the application dependencies manifest (HomeGenie.deps.json) was not found: package: 'runtimepack.Microsoft.NETCore.App.Runtime.linux-arm64', version: '6.0.11' path: 'System.ComponentModel.Primitives.dll'

I have to start over with a fresh install.

tuicemen commented 1 year ago

Segmentation faults are related to memory so I did some playing arround It seemed like this was related to my sd card which although is 32 meg in size appears to possibly have a bad section. It is not HomeGenie code in my case. I used a different card with no issues installing then attempted to use this card again and got the fault doing a apt upgrade. HomeGenie wasn't even installed yet so that confirmed it wasn't a issue with HomeGenie code.

genemars commented 1 year ago

I am also facing this issue on a RPi4 but only when using X10 drivers that use libusb. On my configuration this error can happen after days or just hours. The installed libusb version was 1.0.24

pi@raspberrypi:~/homegenie $ dpkg -l  | grep libusb
ii  libusb-1.0-0:arm64                                          2:1.0.24-3                       arm64        userspace USB programming library
ii  libusb-1.0-0-dev:arm64                                      2:1.0.24-3                       arm64        userspace USB programming library development files
ii  libusb-1.0-doc                                              2:1.0.24-3                       all          documentation for userspace USB programming

I uninstalled it and re-built the latest libusb 1.0.26 from source: https://www.linuxfromscratch.org/blfs/view/svn/general/libusb.html Let's see if this solve the issue.

tuicemen commented 1 year ago

From reading this seems to be more a core issue. I've not experianced this on the 32 bit pi os. I also haven't experianced this since moving things to a 64 gig usb stick. The issues were when running a 32 gig card, experianced this with two cards. I do use X10 though last time I experianced it was prior to installing the x10 drivers or HG.

genemars commented 1 year ago

Yes, it seems more a core libs/framework issue on the 64bit OS. And I confirm that the 32bit Raspbian OS seems to be not affected by this since I haven't seen any error on my other installation on a RPi2 with ZigBee and GPIO devices.

tuicemen commented 1 year ago

What mem does your pi 4 have? And are you running the light Os or with desktop? Everything I've read suggests running the 64 Os on a pi 4 and stats show on a pi 3 it will run but issues developed the more that is running on it. Having the desktop installed leaves little memory for anything else. My p3b+ has the lite Os and only HG installed with just x10, Openweather, and 2 cameras showing using the new video widget enabled. I'll see if I can load HG with more interfaces and options without getting this error. I believe when I was using the smaller card size I had HG setup with all interfaces as well as a old 3.19 stable backup partially installed. I say partially installed because no programs showed up in the programs page.

genemars commented 1 year ago

My RPi4 has got 4GB of memory, the lite version of the latest Raspbian, a 16GB SD card and HG with X10, Z-Wave, a HG mini connected via MQTT, nine GroveRGB leds via I2C, Philips Hue and other programs for automation tasks. Glad to see the video widget is working. This widget doesn't involve HG at all unless you are using the old "IP cameras" program to route camera images through HG. The restore of user's programs from old backup should work now with latest HG, or at least worked last time I tried it :)

tuicemen commented 1 year ago

I attempted a restore again but ran into the same issues(probably due to all the custom widgets. so I'll attempt to add things manually. in an attempt to get this segmentation error again.

genemars commented 1 year ago

My reply to your message disappeared :| (the other one with the screenshot) From what I saw, the problem are the custom widgets, but if you map them to the "sensor" widget it should work because the new sensor widget also displays the status fields. If you can confirm this, I will make all unknown widgets to be mapped to the sensor widget during the backup restore/program import. Anyway, custom widgets can now be added to the new HG, but old custom widgets are not compatible with the new format and they must be converted.

genemars commented 1 year ago

OK I found the "disappeared" reply :D it was in the other issue #458 =))) Using the phone app it confused me, I thought I was replying to this issue.

tuicemen commented 1 year ago

If I add the program with a download it is possible to switch the widget to the HG status module and things work for most custom programs. However if I attempt to change any setting in the problem programs with custom widgets that have been restored from a backup it doesn't work as posted in issue #458

tuicemen commented 1 year ago

Now running beta 24 and I've not experianced this since running my Raspi OS from a larger USB drive (64 gig)
So the trick to resolving this may be using a 64 gig or larger SD card. I'll see if I have 64 gig card laying arround that I can test. In any case this is not a HG issue as I had originally thought.

genemars commented 1 year ago

I found a bug in CM15 and CM19 drivers that causes "Segmentation fault" when trying to disable/enable the X10 interface. I fixed this bug and testing since yesterday with no issues so far. But still there will be this error when a native library is updated in the build (files ending with *.so) and overwritten during the upgrade process of HG. So to solve this last problem I will have to make some modification to the update manager in HG.

tuicemen commented 1 year ago

When I was getting this fault it was never from doing the same things in HG which made it hard for me to nail down. It wasn't till I got this fault prior to installing HG that I realized HG was not be the only thing causing this. Seems the raspi 64 bit OS may also be a factor as I never even had Core installed I was doing a raspberry update/upgrade right after the OS install. I did notice a HG hang up when playing with the X10 disable/enable but a reboot fixed it. Never got the fault though.

tuicemen commented 1 year ago

I decided to do a fresh install of raspi OS and HG 64bit. I also now see the fault with X10 drivers. it is always when I try to add housecode M actually any additional house code

2023-03-04 15:37:44.3622 Trace HomeAutomation.X10: HouseCodes=A,M 2023-03-04 15:37:44.3622 Debug 9B-2C-25-07-3E-40-09-02 2023-03-04 15:37:49.3885 Warn Previous command timed out, resending (1) 2023-03-04 15:37:49.3985 Debug BB-41-00-05-00-14-20-28-24-29 2023-03-04 15:37:49.4354 Debug 55 2023-03-04 15:37:49.4354 Debug Command succesfull 2023-03-04 15:37:49.4371 Debug 8B 2023-03-04 15:37:49.4467 Info HomeAutomation.X10 2023-03-04 15:37:49.4529 Debug 80-00-2C-25-07-3E-40-02 2023-03-04 15:37:49.4529 Debug 00 Segmentation fault