Random crashing issue with Psychtoolbox portaudio and Win7 64 with R2015A

Hi all,


Have been encountering, only on one machine, a random crashing issue of the Matlab apparently caused by the Psychtoolbox portaudio.  I have contacted Mathworks and they pointed me here.


The crash is a Matlab-type violation error and displays a window that terminates Matlab, not all the time, but occasionally without any warning.


Matlab version R2015a is being used on all the machines for this script, but this is the only machine (of about 8) that crashed in this manner.  Of these machines, 5 are exactly the same type and spec.


--------------------------------- ERROR START -----------------------------


MATLAB crash file:C:\Users\CRCHEA~1\AppData\Local\Temp\matlab_crash_dump.3260-1:

------------------------------------------------------------------------
          Access violation detected at Sat Oct 17 16:05:28 2015
------------------------------------------------------------------------

Configuration:
  Crash Decoding      : Disabled
  Crash Mode          : continue (default)
  Current Graphics Driver: Intel Intel(R) HD Graphics 4600 Version 4.2.0 - Build 10.18.10.3412
  Default Encoding    : windows-1252
  Graphics card 1     : Intel Corporation ( 0x8086 ) Intel(R) HD Graphics 4600 Version 10.18.10.3412
  Host Name           : MU00059493
  MATLAB Architecture : win64
  MATLAB Root         : C:\Program Files\MATLAB\R2015a
  MATLAB Version      : 8.5.0.197613 (R2015a)
  OpenGL              : hardware
  Operating System    : Microsoft Windows 7 Enterprise
  Processor ID        : x86 Family 6 Model 60 Stepping 3, GenuineIntel
  Virtual Machine     : Java 1.7.0_60-b19 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
  Window System       : Version 6.1 (Build 7601: Service Pack 1)

Fault Count: 1


Abnormal termination:
Access violation

Register State (from fault):
  RAX = 0000000000000000  RBX = 00000000a58240d0
  RCX = 0000000000000020  RDX = 0000000000000000
  RSP = 00000001d553fda0  RBP = 0000000000000000
  RSI = 0000000000000020  RDI = 000007fef02ab840
 
   R8 = 00000000a58240d0   R9 = 0000000000000000
  R10 = 0000000000000000  R11 = 0000000000000202
  R12 = 0000000000000000  R13 = 0000000000000000
  R14 = 0000000000000000  R15 = 000007fefa35ed00
 
  RIP = 000007fef02ab851  EFL = 00010206
 
   CS = 0033   FS = 0053   GS = 002b

Stack Trace (from fault):
[  0] 0x000007fef02ab851 C:\toolbox\Psychtoolbox\PsychSound\portaudio_x64.dll+00047185 PaAsio_GetOutputChannelName+00012753
[  1] 0x000007fefa332dde                      C:\Windows\system32\WINMM.dll+00011742 DriverCallback+00000110
[  2] 0x000007fefa33a95d                      C:\Windows\system32\WINMM.dll+00043357 timeEndPeriod+00000501
[  3] 0x00000000778559dd                   C:\Windows\system32\kernel32.dll+00088541 BaseThreadInitThunk+00000013
[  4] 0x0000000077a8a651                      C:\Windows\SYSTEM32\ntdll.dll+00173649 RtlUserThreadStart+00000033

--------------------------------


The Matlab Support Team checked the Stack Trace above and saw the portaudio_x64.dll driver mentioned.


--------------------------------- CODE START -----------------------------


The code wrt to the setup of portaudio that is being used is:


%% SOUND STUFF
%% Psychportaudio
wave=sin(1:0.25:1000);
freq=22254; % change this to change freq of tone
nrchannels = size(wave,1);
% Initialize driver, request low-latency preinit:
InitializePsychSound(1)
%
% Default to auto-selected default output device:
%find device index name 'Primary Sound Driver'
devices = PsychPortAudio('GetDevices')
size_devices = size(devices);
devicetarget = 'Speakers / Headphones (Realtek High Definition Audio)';
iLoop = 1;
while iLoop < size_devices(2)
    %%possible use strfind for different search string or partial string
    if strcmp(devices(iLoop).DeviceName, devicetarget)
        break;
    end
    iLoop = iLoop + 1;
end
iLoop
devices(iLoop)
deviceid = devices(iLoop).DeviceIndex
%deviceid = 15
%OLD
%deviceid = -1; %DEFAULT
%%deviceid = 2; %No Roland Connected
%<<
%
% Request latency mode 2, which used to be the best one in our measurement:
reqlatencyclass = 2; % class 2 empirically the best, 3 & 4 == 2
% Open audio device for low-latency output:
%pahandle = PsychPortAudio('Open' [, deviceid][, mode][, reqlatencyclass][, freq][, channels][, buffersize][, suggestedLatency][, selectchannels][, specialFlags=0]);
pahandle = PsychPortAudio('Open', deviceid, [], reqlatencyclass, freq, nrchannels)
%END Setup


------------------------------------

I would be interested to know if others have had similar things working with the Psychtoolbox and ways to get around this random issue.

Cheers,
DaveB





Sounds like a hardware bug to me, if it works just fine on 7 out of 8 machines, and especially 4 out of 5 identical machines. Maybe check to make sure that those 5 machines really have identical software (same versions of audio drivers, graphics drivers etc.). Or run some hardware diagnostic on it (bad RAM? bad power supply? bad cooling? bad audio card?). Maybe swap sound cards between the healthy and bad machine, or reinstall the complete os to make sure nothing is different.

The stack traces you got are completely bogus/impossible, so not of help. Also good to poke on it with our standard scripts like PsychPortAudioTimingtest etc... It looks as if your script isn't making use of a proper ASIO soundcard. MME or Directsound are rather fragile, maybe the script is pushing them too hard, so you get malfunctions on that one machine because it is slightly different in running software/system load and just gets pushed over the edge. Grandmaster Flash had to say a lot of useful things about that in the 80's...

best,
-mario


---In PSYCHTOOLBOX@yahoogroups.com, <dgb_007@...> wrote :

Hi all,


Have been encountering, only on one machine, a random crashing issue of the Matlab apparently caused by the Psychtoolbox portaudio.  I have contacted Mathworks and they pointed me here.


The crash is a Matlab-type violation error and displays a window that terminates Matlab, not all the time, but occasionally without any warning.


Matlab version R2015a is being used on all the machines for this script, but this is the only machine (of about 8) that crashed in this manner.  Of these machines, 5 are exactly the same type and spec.


--------------------------------- ERROR START -----------------------------


MATLAB crash file:C:\Users\CRCHEA~1\AppData\Local\Temp\matlab_crash_dump.3260-1:

------------------------------------------------------------------------
          Access violation detected at Sat Oct 17 16:05:28 2015
------------------------------------------------------------------------

Configuration:
  Crash Decoding      : Disabled
  Crash Mode          : continue (default)
  Current Graphics Driver: Intel Intel(R) HD Graphics 4600 Version 4.2.0 - Build 10.18.10.3412
  Default Encoding    : windows-1252
  Graphics card 1     : Intel Corporation ( 0x8086 ) Intel(R) HD Graphics 4600 Version 10.18.10.3412
  Host Name           : MU00059493
  MATLAB Architecture : win64
  MATLAB Root         : C:\Program Files\MATLAB\R2015a
  MATLAB Version      : 8.5.0.197613 (R2015a)
  OpenGL              : hardware
  Operating System    : Microsoft Windows 7 Enterprise
  Processor ID        : x86 Family 6 Model 60 Stepping 3, GenuineIntel
  Virtual Machine     : Java 1.7.0_60-b19 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
  Window System       : Version 6.1 (Build 7601: Service Pack 1)

Fault Count: 1


Abnormal termination:
Access violation

Register State (from fault):
  RAX = 0000000000000000  RBX = 00000000a58240d0
  RCX = 0000000000000020  RDX = 0000000000000000
  RSP = 00000001d553fda0  RBP = 0000000000000000
  RSI = 0000000000000020  RDI = 000007fef02ab840
 
   R8 = 00000000a58240d0   R9 = 0000000000000000
  R10 = 0000000000000000  R11 = 0000000000000202
  R12 = 0000000000000000  R13 = 0000000000000000
  R14 = 0000000000000000  R15 = 000007fefa35ed00
 
  RIP = 000007fef02ab851  EFL = 00010206
 
   CS = 0033   FS = 0053   GS = 002b

Stack Trace (from fault):
[  0] 0x000007fef02ab851 C:\toolbox\Psychtoolbox\PsychSound\portaudio_x64.dll+00047185 PaAsio_GetOutputChannelName+00012753
[  1] 0x000007fefa332dde                      C:\Windows\system32\WINMM.dll+00011742 DriverCallback+00000110
[  2] 0x000007fefa33a95d                      C:\Windows\system32\WINMM.dll+00043357 timeEndPeriod+00000501
[  3] 0x00000000778559dd                   C:\Windows\system32\kernel32.dll+00088541 BaseThreadInitThunk+00000013
[  4] 0x0000000077a8a651                      C:\Windows\SYSTEM32\ntdll.dll+00173649 RtlUserThreadStart+00000033

--------------------------------


The Matlab Support Team checked the Stack Trace above and saw the portaudio_x64.dll driver mentioned.


--------------------------------- CODE START -----------------------------


The code wrt to the setup of portaudio that is being used is:


%% SOUND STUFF
%% Psychportaudio
wave=sin(1:0.25:1000);
freq=22254; % change this to change freq of tone
nrchannels = size(wave,1);
% Initialize driver, request low-latency preinit:
InitializePsychSound(1)
%
% Default to auto-selected default output device:
%find device index name 'Primary Sound Driver'
devices = PsychPortAudio('GetDevices')
size_devices = size(devices);
devicetarget = 'Speakers / Headphones (Realtek High Definition Audio)';
iLoop = 1;
while iLoop < size_devices(2)
    %%possible use strfind for different search string or partial string
    if strcmp(devices(iLoop).DeviceName, devicetarget)
        break;
    end
    iLoop = iLoop + 1;
end
iLoop
devices(iLoop)
deviceid = devices(iLoop).DeviceIndex
%deviceid = 15
%OLD
%deviceid = -1; %DEFAULT
%%deviceid = 2; %No Roland Connected
%<<
%
% Request latency mode 2, which used to be the best one in our measurement:
reqlatencyclass = 2; % class 2 empirically the best, 3 & 4 == 2
% Open audio device for low-latency output:
%pahandle = PsychPortAudio('Open' [, deviceid][, mode][, reqlatencyclass][, freq][, channels][, buffersize][, suggestedLatency][, selectchannels][, specialFlags=0]);
pahandle = PsychPortAudio('Open', deviceid, [], reqlatencyclass, freq, nrchannels)
%END Setup


------------------------------------

I would be interested to know if others have had similar things working with the Psychtoolbox and ways to get around this random issue.

Cheers,
DaveB





Thanks, that was one of my thoughts too.  Alas unable to swap sound cards as they are inbuilt.  They are using an external Roland audio device on three of the machines though, although I doubt this is the issue.
The machines are all DELL type - yes, many would say that this alone is an issue in itself. ;)

Will also put in a contingency to save data during the test as this test runs for 10 minutes and any data is better than none.

DaveB


---In PSYCHTOOLBOX@yahoogroups.com, <mario.kleiner@...> wrote :

Sounds like a hardware bug to me, if it works just fine on 7 out of 8 machines, and especially 4 out of 5 identical machines. Maybe check to make sure that those 5 machines really have identical software (same versions of audio drivers, graphics drivers etc.). Or run some hardware diagnostic on it (bad RAM? bad power supply? bad cooling? bad audio card?). Maybe swap sound cards between the healthy and bad machine, or reinstall the complete os to make sure nothing is different.

The stack traces you got are completely bogus/impossible, so not of help. Also good to poke on it with our standard scripts like PsychPortAudioTimingtest etc... It looks as if your script isn't making use of a proper ASIO soundcard. MME or Directsound are rather fragile, maybe the script is pushing them too hard, so you get malfunctions on that one machine because it is slightly different in running software/system load and just gets pushed over the edge. Grandmaster Flash had to say a lot of useful things about that in the 80's...

best,
-mario


---In PSYCHTOOLBOX@yahoogroups.com, <dgb_007@...> wrote :

Hi all,


Have been encountering, only on one machine, a random crashing issue of the Matlab apparently caused by the Psychtoolbox portaudio.  I have contacted Mathworks and they pointed me here.


The crash is a Matlab-type violation error and displays a window that terminates Matlab, not all the time, but occasionally without any warning.


Matlab version R2015a is being used on all the machines for this script, but this is the only machine (of about 8) that crashed in this manner.  Of these machines, 5 are exactly the same type and spec.


--------------------------------- ERROR START -----------------------------


MATLAB crash file:C:\Users\CRCHEA~1\AppData\Local\Temp\matlab_crash_dump.3260-1:

------------------------------------------------------------------------
          Access violation detected at Sat Oct 17 16:05:28 2015
------------------------------------------------------------------------

Configuration:
  Crash Decoding      : Disabled
  Crash Mode          : continue (default)
  Current Graphics Driver: Intel Intel(R) HD Graphics 4600 Version 4.2.0 - Build 10.18.10.3412
  Default Encoding    : windows-1252
  Graphics card 1     : Intel Corporation ( 0x8086 ) Intel(R) HD Graphics 4600 Version 10.18.10.3412
  Host Name           : MU00059493
  MATLAB Architecture : win64
  MATLAB Root         : C:\Program Files\MATLAB\R2015a
  MATLAB Version      : 8.5.0.197613 (R2015a)
  OpenGL              : hardware
  Operating System    : Microsoft Windows 7 Enterprise
  Processor ID        : x86 Family 6 Model 60 Stepping 3, GenuineIntel
  Virtual Machine     : Java 1.7.0_60-b19 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
  Window System       : Version 6.1 (Build 7601: Service Pack 1)

Fault Count: 1


Abnormal termination:
Access violation

Register State (from fault):
  RAX = 0000000000000000  RBX = 00000000a58240d0
  RCX = 0000000000000020  RDX = 0000000000000000
  RSP = 00000001d553fda0  RBP = 0000000000000000
  RSI = 0000000000000020  RDI = 000007fef02ab840
 
   R8 = 00000000a58240d0   R9 = 0000000000000000
  R10 = 0000000000000000  R11 = 0000000000000202
  R12 = 0000000000000000  R13 = 0000000000000000
  R14 = 0000000000000000  R15 = 000007fefa35ed00
 
  RIP = 000007fef02ab851  EFL = 00010206
 
   CS = 0033   FS = 0053   GS = 002b

Stack Trace (from fault):
[  0] 0x000007fef02ab851 C:\toolbox\Psychtoolbox\PsychSound\portaudio_x64.dll+00047185 PaAsio_GetOutputChannelName+00012753
[  1] 0x000007fefa332dde                      C:\Windows\system32\WINMM.dll+00011742 DriverCallback+00000110
[  2] 0x000007fefa33a95d                      C:\Windows\system32\WINMM.dll+00043357 timeEndPeriod+00000501
[  3] 0x00000000778559dd                   C:\Windows\system32\kernel32.dll+00088541 BaseThreadInitThunk+00000013
[  4] 0x0000000077a8a651                      C:\Windows\SYSTEM32\ntdll.dll+00173649 RtlUserThreadStart+00000033

--------------------------------


The Matlab Support Team checked the Stack Trace above and saw the portaudio_x64.dll driver mentioned.


--------------------------------- CODE START -----------------------------


The code wrt to the setup of portaudio that is being used is:


%% SOUND STUFF
%% Psychportaudio
wave=sin(1:0.25:1000);
freq=22254; % change this to change freq of tone
nrchannels = size(wave,1);
% Initialize driver, request low-latency preinit:
InitializePsychSound(1)
%
% Default to auto-selected default output device:
%find device index name 'Primary Sound Driver'
devices = PsychPortAudio('GetDevices')
size_devices = size(devices);
devicetarget = 'Speakers / Headphones (Realtek High Definition Audio)';
iLoop = 1;
while iLoop < size_devices(2)
    %%possible use strfind for different search string or partial string
    if strcmp(devices(iLoop).DeviceName, devicetarget)
        break;
    end
    iLoop = iLoop + 1;
end
iLoop
devices(iLoop)
deviceid = devices(iLoop).DeviceIndex
%deviceid = 15
%OLD
%deviceid = -1; %DEFAULT
%%deviceid = 2; %No Roland Connected
%<<
%
% Request latency mode 2, which used to be the best one in our measurement:
reqlatencyclass = 2; % class 2 empirically the best, 3 & 4 == 2
% Open audio device for low-latency output:
%pahandle = PsychPortAudio('Open' [, deviceid][, mode][, reqlatencyclass][, freq][, channels][, buffersize][, suggestedLatency][, selectchannels][, specialFlags=0]);
pahandle = PsychPortAudio('Open', deviceid, [], reqlatencyclass, freq, nrchannels)
%END Setup


------------------------------------

I would be interested to know if others have had similar things working with the Psychtoolbox and ways to get around this random issue.

Cheers,
DaveB