Bug #333


Simulink crashes when using genomix port block

Added by Davide Bicego over 2 years ago. Updated over 2 years ago.



Dear Anthony,

I am reporting a bug which 100% repeatable on my machine (Ubuntu 18.04) using even two different versions of Matlab, i.e., R2018b, R2020a, both currently installed on my machine.
Whenever the Simulink simulation (file attached) is launched, or even the port block is fetched (using the component name "pom", for example) Matlab always crashes. The terminal from which Matlab was launched says:
"*** buffer overflow detected ***: /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/MATLAB terminated

While also Youssef experiences the same problem (and currently is not using Simulink), the strange thing is that Amr, using a different machine but still with Ubuntu 18.04 and R2020a, does not have problems in doing so.
Attached are the crash reports of Matlab (check the two versions) and the very simple Simulink file we are using.
I hope you can help me with this, as due to this problem, I can not use any controller in Simulink, neither for simulations nor experiments.



matlab_crash_dump.4709-1 (13.2 KB) matlab_crash_dump.4709-1 Davide Bicego, 2021-10-13 15:30
matlab_crash_dump.19190-1 (14.7 KB) matlab_crash_dump.19190-1 Davide Bicego, 2021-10-13 15:30
matlab_crash_dump.29784-1 (13.2 KB) matlab_crash_dump.29784-1 Davide Bicego, 2021-10-13 15:30
visualize_variables_R2018b.slx (28.1 KB) visualize_variables_R2018b.slx Davide Bicego, 2021-10-13 15:30
Screenshot from 2021-10-13 15-34-18.png (105 KB) Screenshot from 2021-10-13 15-34-18.png Davide Bicego, 2021-10-13 15:35
init_genomix.m (4.03 KB) init_genomix.m Davide Bicego, 2021-10-13 15:36
ldd-v.txt (104 KB) ldd-v.txt Davide Bicego, 2021-10-13 17:44
Screenshot from 2021-10-15 13-42-58.png (48.9 KB) Screenshot from 2021-10-15 13-42-58.png Davide Bicego, 2021-10-15 13:43
Screenshot from 2021-10-15 13-55-22.png (53.8 KB) Screenshot from 2021-10-15 13-55-22.png Davide Bicego, 2021-10-15 14:04
Actions #1

Updated by Anthony Mallet over 2 years ago

I can't reproduce this, i.e. it works well for me (matlab-2018b,

First, can you make sure that the genomix_block.mexa64 library is
dynamically linked with the correct libraries?
The genomix_block.mexa64 is located in
<prefix>/lib/matlab/simulink/genomix and you can check with `ldd` that
all dependencies are fetched in the correct matlab installation

Actions #2

Updated by Davide Bicego over 2 years ago

Thanks for your prompt reply.
In the following, the output of the suggested command.
FYI, "/home/dbicego/Work/opt/MATLAB/R2018b/" is indeed the path where my Matlab instance is installed (as well as the other version "/home/dbicego/Work/opt/MATLAB/R2020a/").

dbicego@prometheus:~/Work/openrobots/lib/matlab/simulink/genomix$ ldd genomix_block.mexa64 (0x00007ffef475f000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb766cd4000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb7668eb000) => /lib/x86_64-linux-gnu/ (0x00007fb7664fa000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb766142000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb765e61000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb7658c0000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb7655ae000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb765288000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb764c37000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb764a17000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb764811000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb7644d7000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb764182000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb7636f5000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb7634ca000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb7632c1000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb76305b000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb762e4b000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb762b74000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb762970000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb762748000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb762527000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/../../sys/os/glnxa64/ (0x00007fb7621a6000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/../../sys/os/glnxa64/ (0x00007fb761f8f000) => /lib/x86_64-linux-gnu/ (0x00007fb761d70000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb761b5d000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb761950000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb76159d000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb761349000) => /lib/x86_64-linux-gnu/ (0x00007fb76112c000) => /lib/x86_64-linux-gnu/ (0x00007fb760d8e000)
/lib64/ (0x00007fb767199000) => /lib/x86_64-linux-gnu/ (0x00007fb760b8a000) => /lib/x86_64-linux-gnu/ (0x00007fb760952000) => /lib/x86_64-linux-gnu/ (0x00007fb760744000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb76052a000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb760215000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb75ffd7000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb75fdb9000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb75fbac000) => /lib/x86_64-linux-gnu/ (0x00007fb75f9a4000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb75f75e000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb75f531000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb75f2e9000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb75f0c3000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb75edd5000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb75eb69000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb75e70a000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb75e1ea000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb75df92000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb75dcc2000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb75da9c000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb75d866000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb75d662000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb75d45b000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb75d247000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb75cf3f000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb75cce7000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb75ca47000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb75c6e3000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb75c4d3000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb75c23b000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb75c034000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb75bd15000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb75b7db000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb75b14f000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb75af43000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb75ad3d000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb75ab3a000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb75a8f4000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb75a631000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb75a429000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb75a208000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb75a006000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb759e03000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb759bd8000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb759758000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb759556000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb757a41000) => /lib/x86_64-linux-gnu/ (0x00007fb757818000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb7575a7000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb757327000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb75707b000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb756e32000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb756c15000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb7569a2000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb75676c000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb75655e000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb7560d1000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb755ec3000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb755c91000) => /lib/x86_64-linux-gnu/ (0x00007fb755a8c000) => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/ (0x00007fb755888000)

Actions #3

Updated by Davide Bicego over 2 years ago

Adding the outcome of "ldd" with the verbose option in a text file (ldd-v.txt), if it can help.

Actions #4

Updated by Anthony Mallet over 2 years ago

OK, this looks fine (as long as you are effectively using
matlab-2018b, of course).

Next step is to run in debugging mode to help me confirm a potential
issue. Can you :

- update matlab-genomix code with the very last commit (6dd3d26), and
install that (it has some new useful debugging info)
- run matlab with "export GENOMIX_DEBUG=1" set (in the same
terminal were you run matlab)

In the simulink diagnostic window, you should see information like
"DEBUG: new connection 0 at 0x7f61a40f135c, fd [874, 875]"
when you start the simulation.

I'm interrested in the "fd" number, 874 & 875 in the example above. If
they are greater than 1024 then we found the reason of the crash.

Actions #5

Updated by Davide Bicego over 2 years ago

Thanks for your prompt reply.

What I did:
  • updated matlab-genomix code with the very last commit (using "make checkout" inside "/robotpkg/supervision/matlab-genomix" and then make update)
  • ran matlab with "export GENOMIX_DEBUG=1" set (same terminal)
  • when I call "client = genomix.client(host_remote);" from matlab, I receive (Matlab command history) the following:
    INFO: loading matlab-genomix 1.8.4 at 0x7fdfaf63426c
    DEBUG: new connection 0 at 0x7fdfaf63426c, fd [943, 963]
    INFO: locking matlab-genomix 1.8.4
  • Just to make it more clear, I only got these messages in the Matlab command history, while on the Simulink Diagnostic Viewer we just got:
    INFO: loading matlab-genomix 1.8.4 at 0x7fdf21f5835c
  • when I ran the simulink file, or just tried to fetch the port block, Simulink crashes, as expected

More details from the terminal when I launched the components:
11:16:27.664282:genomixd: sock56264eb12550: get /version
11:16:27.664379:genomixd: sock56264eb12550: status 200 OK
11:16:27.664514:genomixd: sock56264eb12550: get /session/start s=
11:16:27.664589:genomixd: sock56264eb12550: new session s1
11:16:27.664628:genomixd: sock56264eb12550: status 200 OK
11:16:27.664796:genomixd: connection from on sock56264e65c430
11:16:27.664925:genomixd: sock56264e65c430: get /session/listen s=s1
11:16:27.664989:genomixd: sock56264e65c430: listening session s1
11:17:07.990559:genomixd: sock56264eb12550: get /rpath//home/dbicego/Work/openrobots/lib/genom/pocolibs/plugins s=s1
11:17:07.990893:genomixd: sock56264eb12550: status 200 OK

Actions #6

Updated by Anthony Mallet over 2 years ago

Unfortunately, what matters is the logs before the crash, and
apparently matlab does have the time to print them before crashing,
since the simulink windows does not show the new connections.

I will anyway fix what I think is the cause of the issue and we'll

Actions #7

Updated by Davide Bicego over 2 years ago

I was fearing so :/
Thanks a lot for your support.
IF you believe that it could be of any help, I am available tomorrow or next week to have a video call in which I can share my screen.
In that case, we can arrange that via email.

Actions #8

Updated by Anthony Mallet over 2 years ago

If you can test the latest commit in matlab-genomix (795123d), this
would help!

Updated by Davide Bicego over 2 years ago

Hi Anthony, good news, it wooorks!! :)

We tried several times and now Matlab doesn't crash (we fetched several times, using both port and request blocks, closing, and re-opening simulink, etc.).
Below, some screenshots; indeed, the fd numbers are higher than 1024 on different occasions.

Out of curiosity, what was the issue?

Simulink Diagnostic Viewer using one port:

Simulink Diagnostic Viewer using one port:

We will test with another machine (that was experiencing the same issues) and will keep you updated.

Thanks a lot!!! :)

Actions #10

Updated by Anthony Mallet over 2 years ago

  • Status changed from New to Closed

Thanks for testing! I'm closing the issue. I will make a new release soon.

The issue is explained in the commit log message. Basically you were
hitting the FD_SETSIZE limit of select(2), which is 1024 by
default. Long time ago, I had to replace all the poll(2) calls by
select(2) because Windows was lacking a poll() system call. I didn't
expect matlab to have so many open file descriptors ...

Nowadays, it seems that poll() is available on Windows, so I reverted
the poll -> select change (BTW, if you ever want to test the change on
Windows, you're welcome, because I don't plan to test it myself :).


Also available in: Atom PDF