Codesys control stopped unexpectedly

pawel3410
2020-01-19
2020-01-27
  • pawel3410 - 2020-01-19

    After codesys stop working I check is codesyscontrol service is running.
    After command "service codesyscontrol restart" its start working properly.
    I also copy the codesyscontrol log file.

    What could be the reason and how to prevent it in the future?

    IMG: 1.jpg

    codesyscontrol.log.txt [272.81 KiB]

     
  • eschwellinger

    eschwellinger - 2020-01-21

    Hi,

    is your license on an runtime key?
    There is a message in the log .. could you give us a

    dmesg

    on cli?

    BR
    Edwin

     
  • pawel3410 - 2020-01-21

    Yes, license is on runtime key compact. Its connected directly to Raspberry USB port.
    I attach dmesg output but rpi was rebooted after this fault.

    dmesg.txt [17.64 KiB]

     
  • pawel3410 - 2020-01-22

    I attach dmesg output from another raspberry also with license on runtime key. Situation with codesys stop was the same. This rpi was not rebooted, only codesysservice was restarted. This situation was about 17.01.2020. I hope this will help to investigate the problem.

    dmesg_2.txt [18.17 KiB]

     
  • eschwellinger

    eschwellinger - 2020-01-22

    Hi,
    think this is not a licensing problem,
    mem leak or what ever it is...

    how often does this happen, hours, days or week...?

    BR
    Edwin

     
  • pawel3410 - 2020-01-23

    Not so often, once every few weeks. What steps to take next time to diagnose the reason for the codesyscontrol stop?
    I want to create bash script to check if codesyscontrol is running, if not then restart and write message in log, but command
    ```

    systemctl is-active codesyscontrol.service

    ``` return "active" even if codesyscontrol service status is "active (exited)"

     
  • vitovt1877 - 2020-01-25

    Are you running visualization also on this Raspberry PI? I had a similar problem also and figured out that Chromium was crashing and stopping CodeSys. It was crashing every 2-4 weeks. I updated Chromium to the latest version and never saw it crashing again. What is interesting, that I had an Raspberry PI with earlier version of Raspbian/Chromium and it was working without problems. As I think it was a problem with specific version of Chromium. May be will be useful for somebody if it is not your case.

     
  • i-campbell

    i-campbell - 2020-01-25

    Have you made your webvisu 8080 directly accessible to the internet? Some of your log messages looks like it might be the case.

     
  • pawel3410 - 2020-01-25

    Visu is running on both raspberry. On both webvisu is accessible from internet on port 8080, on first one on main page is only button to login (more ofter codesyscontrol was stopping), on second one visu is without login requirements (only one time codesyscontrol was stop).

     
  • i-campbell

    i-campbell - 2020-01-25

    I suspect that's the cause. Either a well intentioned vulnerability scanner, or a malicious actor is DoS attacking your webvisu.

    So that's the cause sorted, now what's the fix?

    My first thought is a hardened proxy server that only forwards valid requests to the pi.

    But you mentioned you are happy just to reset the CODESYS service. Maybe:

    pgrep -x codesyscontrol >/dev/null

     
  • pawel3410 - 2020-01-25

    Automatic restart codesyscontrol service is not a good solution but better than none.
    For this I create this script started from cron on every minute and log to file. It seems to work:

    S1="(running)"
    info=$(systemctl status codesyscontrol.service | awk 'NR==3' | awk '{print $3}')
    if [ $info != $S1 ]
    then 
    Β  Β sudo service codesyscontrol restart
    Β  Β  echo `date +%d-%m-%y/%H:%M:%S` " Codesyscontrol restarting... "
    Β  Β exit 1
    else 
    Β  Β #echo `date +%d-%m-%y/%H:%M:%S` " Codesyscontrol running "
    Β  Β exit 1
    fi
    

    I there any way to log or count every connection to webvisu?

     
  • i-campbell

    i-campbell - 2020-01-27

    Your log file shows CODESYS 3.5.15.10.
    There was a vulnerability reported in this version fixed in V3.5.15.20. You should definitely update to the latest version (now 3.5.15.30).
    https://www.codesys.com/security/security-reports.html

    About logging, maybe wireshark?

     

Log in to post a comment.