PXI

cancel
Showing results for 
Search instead for 
Did you mean: 

NI-SCOPE driver causes segmentation fault with python module

Hi,

 

Not sure if this is the right location but I have a weird issue using the python module niscope.

 

With a very simple example code here the driver seems to crash.

 

debug_ni.py:

import niscope

resource_name = 'PXI1Slot2'

asd = niscope.Session(resource_name=resource_name, id_query=True, reset_device=True)

 

And the execution

$ python debug_ni.py
Segmentation fault (core dumped)

 

It seems to segfault on exit.

 

I tried running it through gdb to try to underpin the issue. The execution is below

 

$ gdb python
GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from python...
(No debugging symbols found in python)
(gdb) run debug_ni.py
Starting program: /home/amri/.local/share/virtualenvs/nitest-H47v5LJV/bin/python debug_ni.py
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/x86_64-linux-gnu/libthread_db.so.1".
[Detaching after vfork from child process 5344]
[Detaching after vfork from child process 5345]
[Detaching after vfork from child process 5346]
[New Thread 0x7ffff09ff640 (LWP 5347)]
[New Thread 0x7ffff01fe640 (LWP 5348)]
[New Thread 0x7ffff6c7e640 (LWP 5351)]
[New Thread 0x7ffff6c6c640 (LWP 5352)]
[New Thread 0x7ffff6269640 (LWP 5353)]
[New Thread 0x7fffd27ff640 (LWP 5362)]
[New Thread 0x7fffd1ffe640 (LWP 5363)]
[New Thread 0x7fffd17fd640 (LWP 5364)]
[New Thread 0x7fffd0ffc640 (LWP 5365)]
[New Thread 0x7fffc3fff640 (LWP 5369)]
[New Thread 0x7fffc37fe640 (LWP 5370)]
[New Thread 0x7fffc2ffd640 (LWP 5371)]
[New Thread 0x7fffc27fc640 (LWP 5372)]
[New Thread 0x7fffc1ffb640 (LWP 5376)]
[New Thread 0x7fffc17fa640 (LWP 5377)]
[New Thread 0x7fffc0ff9640 (LWP 5378)]
[New Thread 0x7fffabfff640 (LWP 5379)]
[New Thread 0x7fffab7fe640 (LWP 5380)]
[New Thread 0x7fffaaffd640 (LWP 5381)]
[New Thread 0x7fffaa7fc640 (LWP 5382)]
[New Thread 0x7fffa9ffb640 (LWP 5383)]
[New Thread 0x7fffa97fa640 (LWP 5384)]
[New Thread 0x7fffa8ff9640 (LWP 5385)]
[New Thread 0x7fff87fff640 (LWP 5389)]
[New Thread 0x7fff877fe640 (LWP 5390)]
[New Thread 0x7fff86ffd640 (LWP 5391)]
[New Thread 0x7fff867fc640 (LWP 5392)]
[New Thread 0x7fff84fff640 (LWP 5393)]
[Thread 0x7fff84fff640 (LWP 5393) exited]
[Detaching after vfork from child process 5394]
[New Thread 0x7fff84fff640 (LWP 5396)]
[Thread 0x7fff84fff640 (LWP 5396) exited]
[New Thread 0x7ffff5ec1640 (LWP 5400)]
[Detaching after vfork from child process 5419]
[Detaching after vfork from child process 5420]
[Detaching after vfork from child process 5423]
[Thread 0x7ffff6c7e640 (LWP 5351) exited]
[Thread 0x7ffff6c6c640 (LWP 5352) exited]
[Thread 0x7fffd27ff640 (LWP 5362) exited]

Thread 1 "python" received signal SIGSEGV, Segmentation fault.
0x0000555556040031 in ?? ()
(gdb) bt
#0 0x0000555556040031 in ?? ()
#1 0x00007fff8500f345 in ?? () from /opt/ni-ceip/niceipcore.so
#2 0x00007fff8500f3a9 in UDCCoreIsEnabled () from /opt/ni-ceip/niceipcore.so
#3 0x00007ffff69845d6 in ?? () from /usr/lib/x86_64-linux-gnu/libniscope.so.1
#4 0x00007ffff698b699 in ?? () from /usr/lib/x86_64-linux-gnu/libniscope.so.1
#5 0x00007ffff6981c0a in ?? () from /usr/lib/x86_64-linux-gnu/libniscope.so.1
#6 0x00007ffff6981cb5 in ?? () from /usr/lib/x86_64-linux-gnu/libniscope.so.1
#7 0x00007ffff6981d49 in ?? () from /usr/lib/x86_64-linux-gnu/libniscope.so.1
#8 0x00007ffff6921f95 in ?? () from /usr/lib/x86_64-linux-gnu/libniscope.so.1
#9 0x00007ffff6921ff9 in ?? () from /usr/lib/x86_64-linux-gnu/libniscope.so.1
#10 0x00007ffff6920a93 in ?? () from /usr/lib/x86_64-linux-gnu/libniscope.so.1
#11 0x00007ffff683d821 in ?? () from /usr/lib/x86_64-linux-gnu/libniscope.so.1
#12 0x00007ffff7c45495 in __run_exit_handlers (status=0, listp=0x7ffff7e1a838 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true,
run_dtors=run_dtors@entry=true) at ./stdlib/exit.c:113
#13 0x00007ffff7c45610 in __GI_exit (status=<optimized out>) at ./stdlib/exit.c:143
#14 0x00007ffff7c29d97 in __libc_start_call_main (main=main@entry=0x55555577bff0, argc=argc@entry=2, argv=argv@entry=0x7fffffffde48)
at ../sysdeps/nptl/libc_start_call_main.h:74
#15 0x00007ffff7c29e40 in __libc_start_main_impl (main=0x55555577bff0, argc=2, argv=0x7fffffffde48, init=<optimized out>,
fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffde38) at ../csu/libc-start.c:392
#16 0x000055555577bf25 in _start ()

 

This is not a critical issue as the driver works but just very annoying that it crashes on teardown.

 

What could be causing the issue?

 

ni-scope installed on Ubuntu is of version 23.8.0.49304-0+f152

 

Current kernel is

$ cat /proc/version_signature
Ubuntu 6.5.0-21.21~22.04.1-generic 6.5.8

 

0 Kudos
Message 1 of 6
(945 Views)

Hello,

We think that this is similar to a public bug that we have for NI-SCOPE.

That bug is at the bottom of the list on this page:
https://www.ni.com/en/support/documentation/bugs/23/linux-device-drivers-2023-q4-known-issues.html

Text from that page is:

On Linux, some driver function calls may generate a spurious SIGALRM, which may interrupt certain operations (e.g. fetching measurements). For example, niDCPower_FetchMultiple() may return error -1074097127.


Known impacted drivers: NI-DCPower, NI-SCOPE.

 

Workaround:

If you run into this issue and wish to disable it, copy the attached file for the appropriate driver from the Downloads section to

/var/local/natinst/systemsettings/


If this doesn't fix this issue, please let me know and we can do some further investigations into this.

 

Thanks!

0 Kudos
Message 2 of 6
(898 Views)

Please also close your session before exit, and if you still see the crash, then add a 1-2 seconds wait. The theory is that there are threads running on exit that aren't being cleaned up right.

Marcos Kirsch
Chief Software Engineer
NI Driver Software
0 Kudos
Message 3 of 6
(893 Views)

Hi,

 

I tried that with the following code but it still segfaults (note, this is not the same fault that was mentioned earlier).

 

debug_ni.py:

import niscope
import time

resource_name = 'PXI1Slot2'

asd = niscope.Session(resource_name=resource_name, id_query=False, reset_device=False)
del asd
time.sleep(3)

 

$ python debug_ni.py
Segmentation fault (core dumped)

 

0 Kudos
Message 4 of 6
(805 Views)

Workaround:

If you run into this issue and wish to disable it, copy the attached file for the appropriate driver from the Downloads section to


Where can I find the file attachment?

0 Kudos
Message 5 of 6
(804 Views)

Ah, yeah. That is confusing. The attachments are at the very bottom of that page. This is the link to it

NI Scope File 

0 Kudos
Message 6 of 6
(789 Views)