Project

General

Profile

Actions

Bug #333

closed

Simulink crashes when using genomix port block

Added by Davide Bicego 12 days ago. Updated 10 days ago.

Status:
Closed
Priority:
High

Description

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
Killed
".

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.

Best,
Davide


Files

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 12 days ago

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

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
prefix.

Actions #2

Updated by Davide Bicego 12 days 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
linux-vdso.so.1 (0x00007ffef475f000)
libmex.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmex.so (0x00007fb766cd4000)
libmx.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmx.so (0x00007fb7668eb000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fb7664fa000)
libmwfl.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwfl.so (0x00007fb766142000)
libut.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libut.so (0x00007fb765e61000)
libmwservices.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwservices.so (0x00007fb7658c0000)
libmwfoundation_matlabdata_matlab.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwfoundation_matlabdata_matlab.so (0x00007fb7655ae000)
libmwfoundation_extdata_array.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwfoundation_extdata_array.so (0x00007fb765288000)
libmwmvm.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwmvm.so (0x00007fb764c37000)
libmwmpath.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwmpath.so (0x00007fb764a17000)
libmwm_dispatcher_interfaces.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwm_dispatcher_interfaces.so (0x00007fb764811000)
libmwm_dispatcher.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwm_dispatcher.so (0x00007fb7644d7000)
libmwi18n.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwi18n.so (0x00007fb764182000)
libmwmlutil.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwmlutil.so (0x00007fb7636f5000)
libmwfoundation_usm.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwfoundation_usm.so (0x00007fb7634ca000)
libmwgenerate_diag_message.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwgenerate_diag_message.so (0x00007fb7632c1000)
libmwmcos.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwmcos.so (0x00007fb76305b000)
libmwboost_date_time.so.1.65.1 => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwboost_date_time.so.1.65.1 (0x00007fb762e4b000)
libmwboost_log.so.1.65.1 => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwboost_log.so.1.65.1 (0x00007fb762b74000)
libmwboost_system.so.1.65.1 => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwboost_system.so.1.65.1 (0x00007fb762970000)
libmwboost_thread.so.1.65.1 => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwboost_thread.so.1.65.1 (0x00007fb762748000)
libmwcpp11compat.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwcpp11compat.so (0x00007fb762527000)
libstdc++.so.6 => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6 (0x00007fb7621a6000)
libgcc_s.so.1 => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/../../sys/os/glnxa64/libgcc_s.so.1 (0x00007fb761f8f000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fb761d70000)
libmwmfl_permute.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwmfl_permute.so (0x00007fb761b5d000)
libmwindexingapimethods.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwindexingapimethods.so (0x00007fb761950000)
libicuuc.so.59 => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libicuuc.so.59 (0x00007fb76159d000)
libtbbmalloc.so.2 => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libtbbmalloc.so.2 (0x00007fb761349000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fb76112c000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fb760d8e000)
/lib64/ld-linux-x86-64.so.2 (0x00007fb767199000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fb760b8a000)
libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007fb760952000)
libpam.so.0 => /lib/x86_64-linux-gnu/libpam.so.0 (0x00007fb760744000)
libmwboost_filesystem.so.1.65.1 => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwboost_filesystem.so.1.65.1 (0x00007fb76052a000)
libmwboost_regex.so.1.65.1 => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwboost_regex.so.1.65.1 (0x00007fb760215000)
libmwboost_serialization.so.1.65.1 => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwboost_serialization.so.1.65.1 (0x00007fb75ffd7000)
libunwind.so.8 => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libunwind.so.8 (0x00007fb75fdb9000)
libicuio.so.59 => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libicuio.so.59 (0x00007fb75fbac000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fb75f9a4000)
libmwlivecode.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwlivecode.so (0x00007fb75f75e000)
libmwcppmicroservices.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwcppmicroservices.so (0x00007fb75f531000)
libmwregexp.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwregexp.so (0x00007fb75f2e9000)
libmwsearch_path_utilities.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwsearch_path_utilities.so (0x00007fb75f0c3000)
libmwflstoragevfs.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwflstoragevfs.so (0x00007fb75edd5000)
libmwcwf_interface.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwcwf_interface.so (0x00007fb75eb69000)
libmwsettingscore.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwsettingscore.so (0x00007fb75e70a000)
libmwms.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwms.so (0x00007fb75e1ea000)
libmwopccore.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwopccore.so (0x00007fb75df92000)
libmwopcmodel.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwopcmodel.so (0x00007fb75dcc2000)
libmwopczippackage.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwopczippackage.so (0x00007fb75da9c000)
libmwstring_matrix.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwstring_matrix.so (0x00007fb75d866000)
libmwkeybrd.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwkeybrd.so (0x00007fb75d662000)
libmwboost_chrono.so.1.65.1 => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwboost_chrono.so.1.65.1 (0x00007fb75d45b000)
libmwboost_iostreams.so.1.65.1 => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwboost_iostreams.so.1.65.1 (0x00007fb75d247000)
libCppMicroServices.so.3.3.1 => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libCppMicroServices.so.3.3.1 (0x00007fb75cf3f000)
libtbb.so.2 => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libtbb.so.2 (0x00007fb75cce7000)
libmwfoundation_matlabdata_standalone.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwfoundation_matlabdata_standalone.so (0x00007fb75ca47000)
libmwmst.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwmst.so (0x00007fb75c6e3000)
libmwstartupplugin.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwstartupplugin.so (0x00007fb75c4d3000)
libmwstartup_plugin_initializer.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwstartup_plugin_initializer.so (0x00007fb75c23b000)
libmvmtransportapi.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmvmtransportapi.so (0x00007fb75c034000)
libmwmatlab_toolbox_events.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwmatlab_toolbox_events.so (0x00007fb75bd15000)
libmwexecution_events.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwexecution_events.so (0x00007fb75b7db000)
libxerces-c-3.1.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libxerces-c-3.1.so (0x00007fb75b14f000)
libmwcwf_implementation.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwcwf_implementation.so (0x00007fb75af43000)
libmwmatlabstoragesystem.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwmatlabstoragesystem.so (0x00007fb75ad3d000)
libmwmodule_feature.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwmodule_feature.so (0x00007fb75ab3a000)
libmwsearch_path_events.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwsearch_path_events.so (0x00007fb75a8f4000)
libmwsearch_path_impl.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwsearch_path_impl.so (0x00007fb75a631000)
libmwsearch_path_interfaces.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwsearch_path_interfaces.so (0x00007fb75a429000)
libmwddux.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwddux.so (0x00007fb75a208000)
libmwbuiltin.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwbuiltin.so (0x00007fb75a006000)
libmwresource_core.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwresource_core.so (0x00007fb759e03000)
libexpat.so.1 => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libexpat.so.1 (0x00007fb759bd8000)
libicui18n.so.59 => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libicui18n.so.59 (0x00007fb759758000)
libmwboost_atomic.so.1.65.1 => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwboost_atomic.so.1.65.1 (0x00007fb759556000)
libicudata.so.59 => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libicudata.so.59 (0x00007fb757a41000)
libaudit.so.1 => /lib/x86_64-linux-gnu/libaudit.so.1 (0x00007fb757818000)
libmwopcmwservices.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwopcmwservices.so (0x00007fb7575a7000)
libmwstoragefilefolderobserver.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwstoragefilefolderobserver.so (0x00007fb757327000)
libmwflnetwork.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwflnetwork.so (0x00007fb75707b000)
libmwflstorageprovider.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwflstorageprovider.so (0x00007fb756e32000)
libmwflstorageevents.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwflstorageevents.so (0x00007fb756c15000)
libmwxmlcore.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwxmlcore.so (0x00007fb7569a2000)
libmwflcrypto.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwflcrypto.so (0x00007fb75676c000)
libmwflcryptoutils.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwflcryptoutils.so (0x00007fb75655e000)
libmwflcryptocryptopp.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwflcryptocryptopp.so (0x00007fb7560d1000)
libminizip.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libminizip.so (0x00007fb755ec3000)
libmwmodule_descriptor_implementation.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwmodule_descriptor_implementation.so (0x00007fb755c91000)
libcap-ng.so.0 => /lib/x86_64-linux-gnu/libcap-ng.so.0 (0x00007fb755a8c000)
libmwmodule_descriptor_interface.so => /home/dbicego/Work/opt/MATLAB/R2018b/bin/glnxa64/libmwmodule_descriptor_interface.so (0x00007fb755888000)
dbicego@prometheus:~/Work/openrobots/lib/matlab/simulink/genomix$

Actions #3

Updated by Davide Bicego 12 days 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 12 days 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 11 days 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 127.0.0.1:59048 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 11 days 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
see.

Actions #7

Updated by Davide Bicego 11 days 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.
Cheers,
Davide

Actions #8

Updated by Anthony Mallet 10 days ago

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

Actions #9

Updated by Davide Bicego 10 days 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 10 days 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 :).

Actions

Also available in: Atom PDF