Random crashing with Psychtoolbox portaudio and Win 7 64 with R2015A

Hi all,

I am experiencing a random crash of Matlab with the Psychtoolbox and is seems to be related to the portaudio DLL.  The machine can run the script fine, but when it falls over it is a major crash.

I have contacted Mathworks, and they pointed me here.

This crashing message has been experienced only on one machine of the total of 8 that are running the script.  Of these 8, 5 are the same spec as the problematic machine (i.e. brand, CPU, memory, etc).

The error causes the following Matlab violation error:

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

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


If this problem is reproducible, please submit a Service Request via:
    http://www.mathworks.com/support/contact_us/

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

The Mathworks support noticed the portaudio_x64.dll line and hence were unable to assist further.

The setup code for the portaudio functions we are using is:

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

%% 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)
%
%20150727>>
% 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 there has been other issue with users like this and what methods were used to work around it.

Rgds,
DaveB