11-05-2024 08:36 AM
Hello!
I've originally posted this issue on the nidaqmx-python github (https://github.com/ni/nidaqmx-python/issues/637). I was advised by zhindes to post here.
Here goes the original message:
Hello!
I've been having this problem for some time now, but I finally managed to recreate it reliably. Before, I would get it randomly, with multiple days without it, and then some days getting it multiple times.
Below code runs for a couple of seconds before windows crashes with a blue screen of death:
import nidaqmx
import nidaqmx.stream_readers
import numpy as np
device = nidaqmx.system.System().local().devices[0]
task = nidaqmx.Task("analog_input")
task.ai_channels.add_ai_voltage_chan(
physical_channel=",".join([device.ai_physical_chans.channel_names[0], device.ai_physical_chans.channel_names[1]]),
name_to_assign_to_channel="joystick",
terminal_config=nidaqmx.constants.TerminalConfiguration.DIFF
)
task.ai_channels.add_ai_voltage_chan(
physical_channel=device.ai_physical_chans[3].name,
name_to_assign_to_channel="touch",
terminal_config=nidaqmx.constants.TerminalConfiguration.RSE
)
task.timing.cfg_samp_clk_timing(rate=150, sample_mode=nidaqmx.constants.AcquisitionType.CONTINUOUS)
def _analog_samples_acquired_callback(task_handle, every_n_samples_event_type,
number_of_samples, callback_data):
try:
analog_reader.read_many_sample(np.empty((1, 3)), number_of_samples, timeout=0) # Value not needed for demonstration
except nidaqmx.DaqReadError as daq_read_error:
# Check if task has already been stopped. If not, reraise error (else ignore).
if not task.is_task_done():
raise daq_read_error
return -1 # return value of 1 indicates that error was ignored
return 0
analog_reader = nidaqmx.stream_readers.AnalogMultiChannelReader(task.in_stream)
task.register_every_n_samples_acquired_into_buffer_event(1, _analog_samples_acquired_callback)
try:
while True:
print("START")
task.start()
print("STOP")
task.stop()
finally:
print("DONE!")
task.close()
The BSOD check code is either a 0x00000139 (KERNEL_SECURITY_CHECK_FAILURE) or 0x00000044 (MULTIPLE_IRP_COMPLETE_REQUESTS). Which one it is seems to be random (at least I don't know what causes the difference).
My original code was stopping and immediately restarting the task regularly. This is to ensure synchronization of the recording start time with an external signal, which happens every 4 to 9 seconds.
I'm attaching the contents of my 'C:\Windows\Minidump' folder as zip archive.
Any ideas on what the problem might be?
Thank you!
Suggestions by zhindes that I have tried, to no avail:
Windows is not in a VM. The card is connected to a 'Intel(R) USB 3.1 eXtensible-Hostcontroller - 1.10 (Microsoft)'. A screenshot of the corresponding section in the device manager can be found below.
I have also tried running the same script on another, more powerful computer, with the same outcome. But I've only gotten 'KERNEL_SECURITY_CHECK_FAILED' errors in about 10 tries. I can also give additional info on that machine if needed.
Thank you!