sfeakes / AqualinkD

Daemon to control Jandy Aqualink RS pool equipment from any home automation hub (Alexa, Homekit & Siri, Home Assistant, smartthings, domoticz etc) or web browser.
Other
176 stars 48 forks source link

segfault when enabling SERIAL_DEBUG #64

Closed agprimatic closed 5 years ago

agprimatic commented 5 years ago

I was having some issues with timeouts so I set log_level=DEBUG_SERIAL in /etc/aqualinkd.conf. When I restarted the daemon, I got this output:

Jun 07 19:05:17 Upboard systemd[1]: Stopped Aqualink RS daemon.
Jun 07 19:05:17 Upboard systemd[1]: Starting Aqualink RS daemon...
Jun 07 19:05:17 Upboard aqualinkd[3290]: Aqualink Daemon v1.3.2b
Jun 07 19:05:17 Upboard aqualinkd[3290]: Config log_level         = 8
Jun 07 19:05:17 Upboard aqualinkd[3290]: Config socket_port       = 80
Jun 07 19:05:17 Upboard aqualinkd[3290]: Config serial_port       = /dev/ttyUSB0
Jun 07 19:05:17 Upboard aqualinkd[3290]: Config web_directory     = /var/www/aqualinkd/
Jun 07 19:05:17 Upboard aqualinkd[3290]: Config device_id         = 0x0a
Jun 07 19:05:17 Upboard aqualinkd[3290]: Config read_all_devices  = YES
Jun 07 19:05:17 Upboard aqualinkd[3290]: Config use_aux_labels    = NO
Jun 07 19:05:17 Upboard aqualinkd[3290]: Config override frz prot = NO
Jun 07 19:05:17 Upboard systemd[1]: Started Aqualink RS daemon.
Jun 07 19:05:17 Upboard aqualinkd[3290]: Config mqtt_server       = (null)
Jun 07 19:05:17 Upboard aqualinkd[3290]: Config mqtt_dz_sub_topic = (null)
Jun 07 19:05:17 Upboard aqualinkd[3290]: Config mqtt_dz_pub_topic = (null)
Jun 07 19:05:17 Upboard aqualinkd[3290]: Config mqtt_aq_topic     = (null)
Jun 07 19:05:17 Upboard aqualinkd[3290]: Config mqtt_user         = (null)
Jun 07 19:05:17 Upboard aqualinkd[3290]: Config mqtt_passwd       = (null)
Jun 07 19:05:17 Upboard aqualinkd[3290]: Config mqtt_ID           = aqualinkd_0007324b
Jun 07 19:05:17 Upboard aqualinkd[3290]: Config idx water temp    = 0
Jun 07 19:05:17 Upboard aqualinkd[3290]: Config idx pool temp     = 0
Jun 07 19:05:17 Upboard aqualinkd[3290]: Config idx spa temp      = 0
Jun 07 19:05:17 Upboard aqualinkd[3290]: Config idx SWG Percent   = 0
Jun 07 19:05:17 Upboard aqualinkd[3290]: Config idx SWG PPM       = 0
Jun 07 19:05:17 Upboard aqualinkd[3290]: Config PDA Mode          = NO
Jun 07 19:05:17 Upboard aqualinkd[3290]: Config PDA Sleep Mode    = NO
Jun 07 19:05:17 Upboard aqualinkd[3290]: Config force SWG         = NO
Jun 07 19:05:17 Upboard aqualinkd[3290]: Config deamonize         = YES
Jun 07 19:05:17 Upboard aqualinkd[3290]: Config log_file          = (null)
Jun 07 19:05:17 Upboard aqualinkd[3290]: Config light_pgm_mode    = 0.00
Jun 07 19:05:17 Upboard aqualinkd[3290]: Debug RS485 protocol     = NO
Jun 07 19:05:17 Upboard aqualinkd[3290]: Read Pentair Packets     = NO
Jun 07 19:05:17 Upboard aqualinkd[3290]: Config BTN Filter_Pump   = label Filter Pump     | PDAlabel FILTER PUMP     | dzidx 0
Jun 07 19:05:17 Upboard aqualinkd[3290]: Config BTN Spa_Mode      = label Spa Mode        | PDAlabel SPA             | dzidx 0
Jun 07 19:05:17 Upboard aqualinkd[3290]: Config BTN Aux_1         = label Cleaner         | PDAlabel AUX1            | dzidx 0
Jun 07 19:05:17 Upboard aqualinkd[3290]: Config BTN Aux_2         = label Waterfall       | PDAlabel AUX2            | dzidx 0
Jun 07 19:05:17 Upboard aqualinkd[3290]: Config BTN Aux_3         = label Spa Blower      | PDAlabel AUX3            | dzidx 0
Jun 07 19:05:17 Upboard aqualinkd[3290]: Config BTN Aux_4         = label Pool Light      | PDAlabel AUX4            | dzidx 0
Jun 07 19:05:17 Upboard aqualinkd[3290]: Config BTN Aux_5         = label Spa Light       | PDAlabel AUX5            | dzidx 0
Jun 07 19:05:17 Upboard aqualinkd[3290]: Config BTN Aux_6         = label Landscape Lights | PDAlabel AUX6            | dzidx 0
Jun 07 19:05:17 Upboard aqualinkd[3290]: Config BTN Aux_7         = label Music           | PDAlabel AUX7            | dzidx 0
Jun 07 19:05:17 Upboard aqualinkd[3290]: Config BTN Pool_Heater   = label Pool Heater     | PDAlabel POOL HEAT       | dzidx 0
Jun 07 19:05:17 Upboard aqualinkd[3290]: Config BTN Spa_Heater    = label Spa Heater      | PDAlabel SPA HEAT        | dzidx 0
Jun 07 19:05:17 Upboard aqualinkd[3290]: Config BTN Solar_Heater  = label Solar Heater    | PDAlabel EXTRA AUX       | dzidx 0
Jun 07 19:05:17 Upboard aqualinkd[3296]: Starting web server on port 80
Jun 07 19:05:17 Upboard aqualinkd[3296]: Starting MQTT client to (null)
Jun 07 19:05:17 Upboard aqualinkd[3296]: Listening to Aqualink RS8 on serial port: /dev/ttyUSB0
Jun 07 19:05:25 Upboard kernel: aqualinkd[3296]: segfault at 431888 ip 00007fae119a467b sp 00007fff59e8a3f0 error 7 in libc-2.23.so[7fae11929000+1c0000]
Jun 07 19:05:25 Upboard systemd[1]: aqualinkd.service: Main process exited, code=dumped, status=11/SEGV
Jun 07 19:05:25 Upboard systemd[1]: aqualinkd.service: Unit entered failed state.
Jun 07 19:05:25 Upboard systemd[1]: aqualinkd.service: Failed with result 'core-dump'.

If I run with just log_level=DEBUG, the daemon doesn't segafult but I can only seem to get status. I can't control anything.

Jun 07 19:01:26 Upboard aqualinkd[3206]: Listening to Aqualink RS8 on serial port: /dev/ttyUSB0
Jun 07 19:01:30 Upboard aqualinkd[3206]: Control Panel 8157 REV K
Jun 07 19:01:30 Upboard aqualinkd[3206]: Getting freeze protection setpoints
Jun 07 19:02:41 Upboard aqualinkd[3206]: Control Panel 8157 REV K
Jun 07 19:02:55 Upboard aqualinkd[3206]: RS time is NOT accurate '9:48 AM 02/19/03 WED', re-setting on controller!
Jun 07 19:03:03 Upboard aqualinkd[3206]: Could not select REVIEW menu
Jun 07 19:03:04 Upboard aqualinkd[3206]: Setting time on aqualink
Jun 07 19:03:31 Upboard aqualinkd[3206]: Thread -1619929344 timeout waiting, ending

I'm running this on Ubuntu 16.04.6 LTS.

sfeakes commented 5 years ago

Sorry, stupid mistake. Fixed in 1.3.2c being posted in a few mins. But you may want to try just setting DEBUG (not SERIAL_DEBUG) from the command line to figure out why it can't read the information from the control panel. Since it got the version it looks like the serial connection is working, it just doesn't understand the return from the control panel. If your syslog is just set to debug / error then you won't see all aqualinkd messages, so either change syslog, or run from command line. Command line would be something like ./release/aqualinkd -d -c ./release/aqualinkd.conf

-d stops it demonizing and runs it in the shell and posts all output.