I freshly installed Control Linux SL to a AMD Ryzen machine with Ubuntu 20.04 via the Codesys Development environment with Tools -> Update Linux.
When I click on the "Runtime - Start" button, I just receive the message "Failed to start codesyscontrol".
When I run codesyscontrol directly from the linux command line, I just get a segmentation fault.
I updated to 4.4.1.0. The error message on the command line changed a little bit, but the result is the same: segmentation fault.
~$ /opt/codesys/bin/codesyscontrol.binCODESYS Control V3.5.17.30 for x86-64Bit - build Mar 18 2022Device type: 4102 id: 0x00000005Device vendor: 3S - Smart Software Solutions GmbHDevice name: CODESYS Control for Linux SLINFO: no config file configured, using defaultSegmentation fault (Core dumped)
~$ /opt/codesys/bin/codesyscontrol.bin -d /etc/CODESYSControl.cfgCODESYS Control V3.5.17.30 for x86-64Bit - build Mar 18 2022Device type: 4102 id: 0x00000005Device vendor: 3S - Smart Software Solutions GmbHDevice name: CODESYS Control for Linux SLINFO: using /etc/CODESYSControl.cfg as config fileSpeicherzugriffsfehler (Speicherabzug geschrieben)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The situation is extremely disappointing for me. That's why I invested the last hour trying to debug the problem and I found a workaround. Conclusion: I think it is a bug in codesyscontrol. When reading /proc/stat, a buffer overflow occurs because I am using a machine with 24 CPU cores and the developer of codesyscontrol apparently did not expect /proc/stat to be so large.
Details:
I tried to run condesyscontrol with gdb to find out why it is crashing:
So it seams, the process crashes while reading something from a file into a buffer, which already contains "cpu22".
Of course, codecontrolsys.bin is a stripped binary, so a stack trace didn't really help me.
(gdb) bt#0 _IO_fgets (buf=0x7fffffffde3a "cpu22", n=6, fp=0x555500000016) at iofgets.c:47#1 0x000055555d7c339c in ?? ()#2 0x000055555d7c1270 in ?? ()#3 0x000055555d5a84da in ?? ()#4 0x000055555d5ab629 in ?? ()#5 0x000055555d5a42c1 in ?? ()#6 0x000055555d6e7a38 in ?? ()#7 0x000055555dad9a42 in ?? ()#8 0x000055555d6e7d43 in ?? ()#9 0x00007ffff7dd30b3 in __libc_start_main (main=0x55555d6e7d00, argc=3, argv=0x7fffffffe3e8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe3d8) at ../csu/libc-start.c:308#10 0x000055555d5a402a in ?? ()
So I tried strace to find out which file codesys reads from when it crashes.
So it looks like the programme is crashing while reading from /proc/stat. I checked that file and it also contains the "cpu22" string I have seen in gdb. I'm using a Ryzen 3900 CPU with many cpu cores.
It looks to me like the buffer that "read" uses is not big enough. My first thought therefore: "How can I make /proc/stat smaller"? Of course: Disable CPU cores
@Codesys team: Can you fix this bug? I bought a Control Linux SL licence because I wanted to implement automation with a machine vision task on a powerful CPU platform. I have to deliver this project to my customer in a few weeks. I look forward to a fix in a timely manner.
π
1
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
you need to add a bug report- https://store.codesys.com/en/#
my question -> bug report /8 add all information/details.
This is the official way how it will work and come hopefully into the product.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I freshly installed Control Linux SL to a AMD Ryzen machine with Ubuntu 20.04 via the Codesys Development environment with Tools -> Update Linux.
When I click on the "Runtime - Start" button, I just receive the message "Failed to start codesyscontrol".
When I run codesyscontrol directly from the linux command line, I just get a segmentation fault.
How can I debug this problem?
BR KRPS
Is your Ubuntu system a 64bit version? check by uname -a
could you use 4.4.1.0 version for a test?
Last edit: eschwellinger 2022-05-23
I will test 4.4.1.0 in the afternoon. Can I download it in the store?
Last edit: krps 2022-05-23
I updated to 4.4.1.0. The error message on the command line changed a little bit, but the result is the same: segmentation fault.
Does anyone have a suggestion for me?
Try instead the command
/opt/codesys/bin/codesyscontrol.bin -d /etc/CODESYSControl.cfg
because CODESYSControl.cfg references CODESYSControl_User.cfg, plus has some additional required settings.
Also try to delete all applications form runtime deploy tool.
Unfortunaetly this also did not help.
sudo? or su -
Also "sudo" does not help.
The situation is extremely disappointing for me. That's why I invested the last hour trying to debug the problem and I found a workaround.
Conclusion: I think it is a bug in codesyscontrol. When reading /proc/stat, a buffer overflow occurs because I am using a machine with 24 CPU cores and the developer of codesyscontrol apparently did not expect /proc/stat to be so large.
Details:
I tried to run condesyscontrol with gdb to find out why it is crashing:
So it seams, the process crashes while reading something from a file into a buffer, which already contains "cpu22".
Of course, codecontrolsys.bin is a stripped binary, so a stack trace didn't really help me.
So I tried strace to find out which file codesys reads from when it crashes.
So it looks like the programme is crashing while reading from /proc/stat. I checked that file and it also contains the "cpu22" string I have seen in gdb. I'm using a Ryzen 3900 CPU with many cpu cores.
It looks to me like the buffer that "read" uses is not big enough. My first thought therefore: "How can I make /proc/stat smaller"? Of course: Disable CPU cores
Now I tried to start codesys again:
Yep, it works.
@Codesys team: Can you fix this bug? I bought a Control Linux SL licence because I wanted to implement automation with a machine vision task on a powerful CPU platform. I have to deliver this project to my customer in a few weeks. I look forward to a fix in a timely manner.
you need to add a bug report- https://store.codesys.com/en/#
my question -> bug report /8 add all information/details.
This is the official way how it will work and come hopefully into the product.
Thanks for the link. I submitted a bug report.