mysgw.service fails with SEGV if ontroller connects



  • I use a raspberry as Gateway and as controller (FHEM). The gateway config looks like this:

    ./configure --my-transport=rf24  --my-rf24-channel=123 --my-rf24-pa-level=RF24_PA_MAX --my-gateway=serial --my-serial-is-pty --my-serial-port=/dev/ttyMySensorsGateway --my-serial-groupname=dialout
    

    If I try to connect the controller the service fails

    pi@raspberrypi:/tmp $ sudo systemctl status  mysgw.service -l
    ● mysgw.service - MySensors Gateway daemon
       Loaded: loaded (/etc/systemd/system/mysgw.service; enabled)
       Active: failed (Result: signal) since Sun 2019-07-21 21:19:12 CEST; 4min 16s ago
      Process: 5078 ExecStart=/usr/local/bin/mysgw -q (code=killed, signal=SEGV)
     Main PID: 5078 (code=killed, signal=SEGV)
    
    Jul 21 21:18:15 raspberrypi systemd[1]: Started MySensors Gateway daemon.
    Jul 21 21:19:12 raspberrypi systemd[1]: mysgw.service: main process exited, code=killed, status=11/SEGV
    Jul 21 21:19:12 raspberrypi systemd[1]: Unit mysgw.service entered failed state.
    
    

    The log mysgw.log is on debug but no message appears at the time of failure.

    FHEM controller looks like this:
    2019.07.21 21:19:12 3: Opening MyGateway_0 device /dev/ttyMySensorsGateway
    2019.07.21 21:19:12 3: MyGateway_0 device opened
    2019.07.21 21:19:12 3: MYSENSORS: ignoring presentation-msg from unknown radioId 0, childId 255, sensorType 18
    2019.07.21 21:19:12 1: /dev/ttyMySensorsGateway disconnected, waiting to reappear (MyGateway_0)

    Any ideas what to try or how to further debug?

    Thanks,
    Dirk


  • Mod

    @dirk120 try starting the gateway manually (not through systemd) as described on https://www.mysensors.org/build/raspberry#test but start the command with strace, i.e.

    sudo strace ./bin/mysgw
    

    and you should get pretty detailed information on what is going on.



  • I started the gateway manually and get this:

    gettimeofday({1563816015, 152499}, NULL) = 0
    gettimeofday({1563816015, 152644}, NULL) = 0
    gettimeofday({1563816015, 152790}, NULL) = 0
    nanosleep({0, 10000000}, NULL)          = 0
    ioctl(5, FIONREAD, [0])                 = 0
    gettimeofday({1563816015, 163378}, NULL) = 0
    gettimeofday({1563816015, 163527}, NULL) = 0
    gettimeofday({1563816015, 163692}, NULL) = 0
    nanosleep({0, 10000000}, NULL)          = 0
    ioctl(5, FIONREAD, [11])                = 0
    read(5, "0", 1)                         = 1
    ioctl(5, FIONREAD, [10])                = 0
    read(5, ";", 1)                         = 1
    ioctl(5, FIONREAD, [9])                 = 0
    read(5, "0", 1)                         = 1
    ioctl(5, FIONREAD, [8])                 = 0
    read(5, ";", 1)                         = 1
    ioctl(5, FIONREAD, [7])                 = 0
    read(5, "3", 1)                         = 1
    ioctl(5, FIONREAD, [6])                 = 0
    read(5, ";", 1)                         = 1
    ioctl(5, FIONREAD, [5])                 = 0
    read(5, "0", 1)                         = 1
    ioctl(5, FIONREAD, [4])                 = 0
    read(5, ";", 1)                         = 1
    ioctl(5, FIONREAD, [3])                 = 0
    read(5, "2", 1)                         = 1
    ioctl(5, FIONREAD, [2])                 = 0
    read(5, ";", 1)                         = 1
    ioctl(5, FIONREAD, [1])                 = 0
    read(5, "\n", 1)                        = 1
    --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0} ---
    +++ killed by SIGSEGV +++
    pi@raspberrypi:~/MySensors $ 
    

    I'm not sure what this means ? Any idea ?

    Thanks,
    Dirk



  • I solved the problem by a complete deinstall of mysensor and reinstall the master branch version (was dev version before).

    Dirk


  • Admin

    @dirk120 what dev version were you on?



  • @tekka I also see this, issue posted on GitHub.



  • Experiencing the same issue here.

    • GW is on Raspberry Pi with NRF24 for comms, current version from git clone master branch
    • Controller is mycontroller.org on Centos linux
    • One node (Arduinio running battery example sketch)

    Running sudo ./mysgw the output is as follows:

    Sep 05 08:30:39 INFO  Protocol version - 2.3.2-beta
    Sep 05 08:30:39 DEBUG MCO:BGN:INIT GW,CP=RNNGL---,FQ=NA,REL=7,VER=2.3.2-beta
    Sep 05 08:30:39 DEBUG TSF:LRT:OK
    Sep 05 08:30:39 DEBUG TSM:INIT
    Sep 05 08:30:39 DEBUG TSF:WUR:MS=0
    Sep 05 08:30:39 DEBUG TSM:INIT:TSP OK
    Sep 05 08:30:39 DEBUG TSM:INIT:GW MODE
    Sep 05 08:30:39 DEBUG TSM:READY:ID=0,PAR=0,DIS=0
    Sep 05 08:30:39 DEBUG MCO:REG:NOT NEEDED
    Sep 05 08:30:39 DEBUG Listening for connections on �e�~:5003
    Sep 05 08:30:39 DEBUG MCO:BGN:STP
    Sep 05 08:30:39 DEBUG MCO:BGN:INIT OK,TSP=1
    Sep 05 08:30:39 DEBUG TSM:READY:NWD REQ
    Sep 05 08:30:39 DEBUG ?TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK:
    Sep 05 08:31:01 DEBUG TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    Sep 05 08:31:01 DEBUG TSF:MSG:BC
    Sep 05 08:31:01 DEBUG TSF:MSG:FPAR REQ,ID=255
    Sep 05 08:31:01 DEBUG TSF:PNG:SEND,TO=0
    Sep 05 08:31:01 DEBUG TSF:CKU:OK
    Sep 05 08:31:01 DEBUG TSF:MSG:GWL OK
    Sep 05 08:31:01 DEBUG ?TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
    Sep 05 08:31:03 DEBUG TSF:MSG:READ,255-255-0,s=174,c=3,t=3,pt=0,l=0,sg=0:
    Sep 05 08:31:05 DEBUG TSF:MSG:READ,255-255-0,s=137,c=3,t=3,pt=0,l=0,sg=0:
    Sep 05 08:31:07 DEBUG TSF:MSG:READ,255-255-0,s=100,c=3,t=3,pt=0,l=0,sg=0:
    Sep 05 08:31:09 DEBUG TSF:MSG:READ,255-255-0,s=64,c=3,t=3,pt=0,l=0,sg=0:
    Sep 05 08:31:46 DEBUG New connection from 10.0.0.157
    Sep 05 08:31:46 DEBUG GWT:TSA:C=0,CONNECTED
    Sep 05 08:31:46 DEBUG GWT:RFC:C=0,MSG=0;255;3;0;2;
    Segmentation fault```
    
    Seg fault as soon as the controller connects.
    
    About to try strace.


  • Have added log + strace output to the issue on Github as well: https://github.com/mysensors/MySensors/issues/1342

    stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=3503, ...}) = 0
    write(4, "Sep 05 09:03:46 DEBUG GWT:RFC:C="..., 51) = 51
    write(2, "Sep 05 09:03:46 \33[36mDEBUG\33[0m ", 31Sep 05 09:03:46 DEBUG ) = 31
    write(2, "GWT:RFC:C=0,MSG=0;255;3;0;2;\n", 29GWT:RFC:C=0,MSG=0;255;3;0;2;
    ) = 29
    --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=NULL} ---
    +++ killed by SIGSEGV +++
    Segmentation fault
    

 

224
Online

8.9k
Users

9.7k
Topics

101.3k
Posts