crash of PsychPortAudio

Dear colleagues,
I am experiencing problem with PsychPortAudio now. When I typed devices = PsychPortAudio('GetDevices'); the Matlab crashes and give me the following error log. This happens even after I update my psychtoolbox. There is no problem with all visual stimuli. I checked the memory through Matlab and there is still plenty of memory:
Maximum possible array: 670 MB (7.028e+008 bytes) *
Memory available for all arrays: 1487 MB (1.559e+009 bytes) **
Memory used by MATLAB: 313 MB (3.279e+008 bytes)
Physical Memory (RAM): 2046 MB (2.145e+009 bytes)

Does anyone know how to deal with this? Thanks very much

Mingbo


the following are the error log:

MATLAB crash file:C:\DOCUME~1\mcai\LOCALS~1\Temp\matlab_crash_dump.5720
------------------------------------------------------------------------
Segmentation violation detected at Mon Apr 04 19:17:00 2011
------------------------------------------------------------------------

Configuration:
MATLAB Version: 7.6.0.324 (R2008a)
MATLAB License: 241991
Operating System: Microsoft Windows XP
Window System: Version 5.1 (Build 2600: Service Pack 3)
Processor ID: x86 Family 6 Model 7 Stepping 6, GenuineIntel
Virtual Machine: Java 1.6.0 with Sun Microsystems Inc. Java HotSpot(TM) Client VM mixed mode
Default Encoding: windows-1252

Fault Count: 1

Register State:
EAX = 00d3e300 EBX = 00000000
ECX = 00000000 EDX = 00000000
ESI = 00d3e3c8 EDI = 00000000
EBP = 00d3e350 ESP = 00d3e2fc
EIP = 7c812afb FLG = 00000202

Stack Trace:
[0] kernel32.dll:0x7c812afb(0xc06d007e, 0, 1, 0x00d3e3c4 "tãÃ"")
[1] PsychPortAudio.mexw32:0x14df9b1f(24, 0x00d3e374, 0x14e1423c "Open GetDeviceSettings ", 0)
[2] PsychPortAudio.mexw32:0x14df8bf1(0x1660c688, 0, 0, 0x14e14254 "DeviceIndex")
[3] PsychPortAudio.mexw32:0x14df3a2d(0, 0, 0, 0)
[4] PsychPortAudio.mexw32:0x14de60dc(1, 0x00d3eb64, 1, 0x00d3ebc4)
[5] libmex.dll:_mexRunMexFile(1, 0x00d3eb64, 1, 0x00d3ebc4) + 129 bytes
[6] libmex.dll:private: void __thiscall Mfh_mex::runMexFileWithSignalProtection(int,struct mxArray_tag * *,int,struct mxArray_tag * *)(1, 0x00d3eb64, 1, 0x00d3ebc4) + 73 bytes
[7] libmex.dll:public: virtual void __thiscall Mfh_mex::dispatch_file(int,struct mxArray_tag * *,int,struct mxArray_tag * *)(1, 0x00d3eb64, 1, 0x00d3ebc4) + 220 bytes
[8] m_dispatcher.dll:public: virtual void __thiscall Mfh_file::dispatch_fh(int,struct mxArray_tag * *,int,struct mxArray_tag * *)(1, 0x00d3eb64, 1, 0x00d3ebc4) + 193 bytes
[9] m_interpreter.dll:__catch$?inDispatchFromStack@@YAHHPBDHH@Z$0(575, 0x0421a3cc "PsychPortAudio", 1, 1) + 712 bytes
[10] m_interpreter.dll:enum opcodes __cdecl inDispatchCall(char const *,int,int,int,int *,int *)(0x0421a3cc "PsychPortAudio", 575, 1, 1) + 146 bytes
[11] m_interpreter.dll:int __cdecl inInterp(enum inDebugCheck,int,int,enum opcodes,struct inPcodeNest_tag volatile *,int *)(1, 0, 1, 0) + 2898 bytes
[12] m_interpreter.dll:int __cdecl protected_inInterp(enum inDebugCheck,int,int,enum opcodes,struct inPcodeNest_tag *,int *)(1, 0, 1, 0) + 74 bytes
[13] m_interpreter.dll:int __cdecl inInterPcodeSJ(enum inDebugCheck,int,int,enum opcodes,struct inPcodeNest_tag *,int *)(1, 0, 1, 0) + 254 bytes
[14] m_interpreter.dll:int __cdecl inExecuteMFunctionOrScript(class Mfh_mp *,bool)(0x1a466e60, 0x1a466e01, 0xffffffff, 0x1a466e60) + 1330 bytes
[15] m_interpreter.dll:void __cdecl inRunMfile(int,struct mxArray_tag * *,int,struct mxArray_tag * *,class Mfh_mp *,struct inWorkSpace_tag *)(0, 0x00d3f3cc, 0, 0) + 679 bytes
[16] m_interpreter.dll:public: virtual void __thiscall Mfh_mp::dispatch_file(struct _mdUnknown_workspace *,int,struct mxArray_tag * *,int,struct mxArray_tag * *)(0, 0, 0x00d3f3cc, 0) + 29 bytes
[17] m_interpreter.dll:public: virtual void __thiscall Mfh_mp::dispatch_file(int,struct mxArray_tag * *,int,struct mxArray_tag * *)(0, 0x00d3f3cc, 0, 0) + 28 bytes
[18] m_dispatcher.dll:public: virtual void __thiscall Mfh_file::dispatch_fh(int,struct mxArray_tag * *,int,struct mxArray_tag * *)(0, 0x00d3f3cc, 0, 0) + 193 bytes
[19] m_interpreter.dll:void __cdecl inEvalPcodeHeaderToWord(struct _memory_context *,int,struct mxArray_tag * * const,struct _pcodeheader *,class Mfh_mp *,unsigned long)(0x7ad2e5e4, 0, 0x00d3f3cc, 0x00d3f288) + 201 bytes
[20] m_interpreter.dll:enum inExecutionStatus __cdecl in_local_call_script_function(struct _memory_context *,struct _pcodeheader *,int,struct mxArray_tag * * const,unsigned long,bool)(0x7ad2e5e4, 0x00d3f288, 0, 0x00d3f3cc) + 91 bytes
[21] m_interpreter.dll:enum inExecutionStatus __cdecl inEvalStringWithIsVarFcn(struct _memory_context *,char const *,enum EvalType,int,struct mxArray_tag * * const,enum inDebugCheck,struct _pcodeheader *,int *,bool (__cdecl*)(void *,char const *),void *,bool,bool)(0x7ad2e5e4, 0x041add20 "devices = PsychPortAudio('GetDev..", 0, 0) + 570 bytes
[22] m_interpreter.dll:enum inExecutionStatus __cdecl inEvalCmdWithLocalReturn(char const *,int *,bool,bool,bool (__cdecl*)(void *,char const *))(0x041add20 "devices = PsychPortAudio('GetDev..", 0, 1, 0x79cad700) + 97 bytes
[23] m_interpreter.dll:_inEvalCmdWithLocalReturn(0x041add20 "devices = PsychPortAudio('GetDev..", 0, 0, 1) + 28 bytes
[24] bridge.dll:enum inExecutionStatus __cdecl evalCommandWithLongjmpSafety(char const *)(0x041add20 "devices = PsychPortAudio('GetDev..", 0x01ed3150, 0x01ed31b0, 0x01ed3150) + 67 bytes
[25] bridge.dll:__catch$_mnParser$0(0x01ed3150, 0x16329668, 0x79730101, 0x166a1380) + 294 bytes
[26] mcr.dll:public: void __thiscall mcrInstance::mnParser(void)(0x004043ec, 336696, 0, 0x6d5c3a43) + 51 bytes
[27] MATLAB.exe:_WinMain@16(0x01ed31b0, 0, 336696, 0x01ed3150) + 405 bytes
[28] MATLAB.exe:___tmainCRTStartup(0, 0, 0x7ffd8000, 0x8054b6ed) + 320 bytes
[29] kernel32.dll:0x7c817077(0x00401943, 0, 0x00905a4d, 3)

This error was detected while a MEX-file was running. If the MEX-file
is not an official MathWorks function, please examine its source code
for errors. Please consult the External Interfaces Guide for information
on debugging MEX-files.

If it is an official MathWorks function, please
follow these steps to report this problem to The MathWorks so we
have the best chance of correcting it:

The next time MATLAB is launched under typical usage, a dialog box will
open to help you send the error log to The MathWorks. Alternatively, you
can send an e-mail to segv@... with the following file attached:
C:\DOCUME~1\mcai\LOCALS~1\Temp\matlab_crash_dump.5720

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

A technical support engineer might contact you with further information.

Thank you for your help. MATLAB may attempt to recover, but even if recovery appears successful,
we recommend that you save your workspace and restart MATLAB as soon as possible.

Dear Mario
I too get an occasional fatal error due to the PsychPortAudio driver. (I’m in macOS Mojave, MacBook Pro, latest Psychtoolbox.) My student Ashley Feng shared with me a screenshot of a failure today. This happens roughly once a week to one or another of my students. Once the PsychPortAudio driver fails, this failure occurs every time until we do a “clear all”, and then everything is back to normal. I want to suggest a quick fix that might help a lot in reducing the effect of the bug on users.

The screenshot below shows that the failure occurred in function GetStatus in PsychPortAudio.
Could that code be wrapped in a try-catch with a “clear PsychPortAudio” in the catch block?
Best
Denis

This is not a crash, because Matlab wasn’t crashed, but an error abort with an error message that tells you about the problem. Less drama please.

Most likely somebody did clear PsychPortAudio or clear Snd after some kind of error, or in a script (i see a clear KbWait in that text editor, which hints at this pattern of wrong use). A clear all is what one should do after an error or to reset things. Everything else will just leave various mex files or M-files with some stale state, inconsistent with other M-files or mex files, as various files do cache some state across invocations for performance reasons.

-mario