From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Random segmentation fault when linking to nidaqmxbase under Linux (CentOS 7)

Hi,

It seems that a simple C application that links to nidaqmxbase will randomly segfault.

 

Here is my setup:

 

C test app:

 

#include <stdio.h>
#include <stdlib.h>
int main (int argc, char **argv)
{
exit(0);
}

 

Now if I compile the above using 'gcc test.c' and then run a.out in a loop, it never segaults.  All good.

 

But if I compile the above using 'gcc ./test.c -lnidaqmxbase' then running the generated a.out in a loop will randomly segfault.

 

I found a topic in the forums that describes similar behavior (http://208.74.204.114/t5/Multifunction-DAQ/Segmentation-Fault-when-linking-with-NIDAQmx-Base-2-0-in-...) but the thread is pretty old so I figure this problem has probably been fixed by now.

 

Am I the only one having these segmentation fault issues?  Maybe someone is able to reproduce this?

 

Here is my setup:

CentOS Linux release 7.2.1511 (Core)

Linux Nrc-006933.ds.nrc.ca 3.10.0-327.22.2.el7.x86_64 #1 SMP Thu Jun 23 17:05:11 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4)

 

Product: NI USB-6501

Driver installed from: http://ftp.ni.com/support/softlib/multifunction_daq/nidaqmxbase/15.0/linux/nidaqmxbase-15.0.0.iso

(Device firmware successfully updated after driver installation.)

 

Thanks!

  Andre

0 Kudos
Message 1 of 5
(3,927 Views)

And here is the info I get when I run the app in gdb:

 

 

(gdb) run
Starting program: /home/andre/work/nrc-rc/tictool/src/./a.out
Missing separate debuginfo for /usr/local/lib64/libnidaqmxbase.so.15
Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/6c/1972b3a293c1e198d3913da1e19f2da8c39959.debug
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Missing separate debuginfo for /usr/local/lib64/liblvrtdark.so.15.0
Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/74/fec2cc7ef569afda9ad86e1a2b9e745a8af622.debug
[New Thread 0x7fffef324700 (LWP 31312)]
[New Thread 0x7fffeeb23700 (LWP 31313)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffef324700 (LWP 31312)]
0x00007ffff6974ad1 in ?? () from /usr/local/lib64/liblvrtdark.so.15.0
Missing separate debuginfos, use: debuginfo-install glibc-2.17-106.el7_2.6.x86_64 labview-2015-rte-15.0.0-2.x86_64 libgcc-4.8.5-4.el7.x86_64 libstdc++-4.8.5-4.el7.x86_64

0 Kudos
Message 2 of 5
(3,918 Views)

Hello charbonneaua,

 

You can find in the known issues the following information:

 

Security-Enhanced Linux:

Red Hat Enterprise Linux WS 6 has Security-Enhanced Linux enabled by
default. While Security-Enhanced Linux is enabled, the utilities distributed
with NI-DAQmx Base 15.0.0 receive a segmentation fault signal. To
use the utilities distributed with NI-DAQmx Base 15.0.0, including the
"nidatalogger" and "FWUpdate" utilities, turn on the "allow_execheap" boolean.

 

Give it a try

0 Kudos
Message 3 of 5
(3,877 Views)

Thanks for the suggestion.

However, this does not seem to make any difference in my case.

 

For example, I set the selinux boolean :

 

# setsebool allow_execheap on

# getsebool allow_execheap
selinuxuser_execheap --> on

 

And then I run the code again and it will randomly segfault.  (On my last 10 invocation, it segfaulted 3 times...).

 

Sometimes, running the program I also get the following error message:

 

Error Message =Internal Warning 0x0037C03D : "MemoryManager.cpp", line 1425
LabVIEW version 15.0f1
For assistance in resolving this problem, please contact National Instruments Support.
Aborted (core dumped)

 

 

This seems like a memory allocation/deallocation bug and I'm not sure what I can do about this.  I would be curious if other people are able to reproduce this error or not.

 

0 Kudos
Message 4 of 5
(3,872 Views)

You may be running into the kernel stack size limit. By default, Red Hat/CentOS (at least with CentOS 6) uses a default of 4K. Can you try to recompile your kernel with a larger kernel stack size?

 

If you have more than 4 GB of RAM, you may also be running into addressing issues above the 4 GB boundary.

 

Please see instructions at https://forums.ni.com/t5/Linux-Users/How-to-install-DAQmx-8-0-2-and-LabVIEW-2011-under-RHEL-CentOS-6...

Tobias
Principal Software Engineer
Driver Software
National Instruments
0 Kudos
Message 5 of 5
(3,858 Views)