Menu

#2 Regression segmentation fault

open
5
2014-08-15
2011-02-01
No

The call to the svmlearn function gives a matlab segmentation fault error in the mexsvmlearn. It seems it occurs after the training is complete. This problem does not occur in the case of classification.

mexsvm601 R14 gives this error.

The error was obtained while doing a simple test with this matlab code:
x = [1:10]';y = x*2 + 3 +normrnd(0,1,10,1);
m = svmlearn(x,y,'-t 0 -z r -c 1');

Obtained error and other messages:
Optimizing.................................done. (34 iterations)
Optimization finished (maxdiff=0.00000).
Runtime in cpu-seconds: 0.02
Number of SV: 10 (including 8 at upper bound)
L1 loss: loss=11.92242
Norm of weight vector: |w|=2.00071
Norm of longest example vector: |x|=10.00000
Number of kernel evaluations: 321

------------------------------------------------------------------------
Segmentation violation detected at Tue Feb 01 15:49:34 2011
------------------------------------------------------------------------

Configuration:
MATLAB Version: 7.10.0.499 (R2010a)
MATLAB License: 2537
Operating System: Microsoft Windows 7
Window System: Version 6.1 (Build 7600)
Processor ID: x86 Family 6 Model 7 Stepping 10, GenuineIntel
Virtual Machine: Java 1.6.0_12-b04 with Sun Microsystems Inc. Java HotSpot(TM) Client VM mixed mode
Default Encoding: windows-1252

Fault Count: 1

Register State:
EAX = 09531080 EBX = 00000000
ECX = 00c2ccb8 EDX = fffa5a5a
ESI = 09531080 EDI = 00000000
EBP = 00c2c784 ESP = 00c2c760
EIP = 03e99348 FLG = 00010293

Stack Trace:
[0] mexsvmlearn.mexw32:0x03e99348(0x18301300, 0x03ea0d29, 0xfffa5a5a, 20)
[1] mexsvmlearn.mexw32:0x03e99eef(0x00c2c844, 0x00c2d408, 0x094a75a0, 0)
[2] mexsvmlearn.mexw32:0x03e81744(1, 0x00c2d408, 3, 0x00c2d378)
[3] libmex.dll:_mexRunMexFile(1, 0x00c2d408, 3, 0x00c2d378) + 132 bytes
[4] libmex.dll:private: void __thiscall Mfh_mex::runMexFileWithSignalProtection(int,struct mxArray_tag * *,int,struct mxArray_tag * *)(1, 0x00c2d408, 3, 0x00c2d378) + 73 bytes
[5] libmex.dll:public: virtual void __thiscall Mfh_mex::dispatch_file(int,struct mxArray_tag * *,int,struct mxArray_tag * *)(1, 0x00c2d408, 3, 0x00c2d378) + 321 bytes
[6] m_dispatcher.dll:public: virtual void __thiscall Mfh_file::dispatch_fh(int,struct mxArray_tag * *,int,struct mxArray_tag * *)(1, 0x00c2d408, 3, 0x00c2d378) + 249 bytes
[7] m_dispatcher.dll:public: void __thiscall Mfunction_handle::dispatch(int,struct mxArray_tag * *,int,struct mxArray_tag * *)(1, 0x00c2d408, 3, 0x00c2d378) + 420 bytes
[8] m_interpreter.dll:public: void __thiscall ResolverFunctionDesc::CallFunction(int,struct mxArray_tag * * const,int,struct mxArray_tag * * const)(1, 0x00c2d408, 3, 0x00c2dbd0 "äÞÂ") + 81 bytes
[9] m_interpreter.dll:public: bool __thiscall Resolver::CallMFunction(int,int,class _m_operand * const,union m_operand_storage *,int,class _m_operand * const,union m_operand_storage *,int *)(0x00c2d698, 1, 1, 0x09429a18) + 1209 bytes
[10] m_interpreter.dll:private: bool __thiscall accelImpl::MFunctionCall(struct _accelOp * *)(0x00c2dbe4 "xÑV!", 0xffffffff, 0x09539190, 0xffffffff) + 545 bytes
[11] m_interpreter.dll:public: enum jitReturnFlags __thiscall accelImpl::Exec(void)(0x00c2dbd0 "äÞÂ", 0xffffffff, 0x21572188, 0xffffffff) + 170 bytes
[12] m_interpreter.dll:public: enum jitReturnFlags __thiscall accelCode::Call(enum inMarshalType *,int *)const (0x00c2dea8, 0xffffffff, 0, 0) + 133 bytes
[13] m_interpreter.dll:public: static bool __cdecl inJit::ExecuteHotSegment(struct _inJitAccelInfo *,enum opcodes *,int *,int *)(0x00c2e070 "ØÓP!0áÂ", 0x00c2e1c0, 0x00c2e164, 0x00c2e340) + 2529 bytes
[14] m_interpreter.dll:int __cdecl inInterp(enum inDebugCheck,int,int,enum opcodes,struct inPcodeNest_tag volatile *,int *)(1, 190, 17, 0) + 797 bytes
[15] m_interpreter.dll:int __cdecl protected_inInterp(enum inDebugCheck,int,int,enum opcodes,struct inPcodeNest_tag *,int *)(1, 190, 13, 0) + 39 bytes
[16] m_interpreter.dll:int __cdecl inInterPcodeSJ(enum inDebugCheck,int,int,enum opcodes,struct inPcodeNest_tag *,int *)(1, 190, 13, 0) + 251 bytes
[17] m_interpreter.dll:int __cdecl inExecuteMFunctionOrScript(class Mfh_mp *,bool)(0x21494700, 0xffffffff, 0x2150d3d8, 1) + 876 bytes
[18] m_interpreter.dll:void __cdecl inRunMfile(int,struct mxArray_tag * *,int,struct mxArray_tag * *,class Mfh_mp *,struct inWorkSpace_tag *)(1, 0x00c2e750, 3, 0x00c2e6c0) + 466 bytes
[19] m_interpreter.dll:public: virtual void __thiscall Mfh_mp::dispatch_file(struct _mdUnknown_workspace *,int,struct mxArray_tag * *,int,struct mxArray_tag * *)(0, 1, 0x00c2e750, 3) + 23 bytes
[20] m_interpreter.dll:public: virtual void __thiscall Mfh_mp::dispatch_file(int,struct mxArray_tag * *,int,struct mxArray_tag * *)(1, 0x00c2e750, 3, 0x00c2e6c0) + 25 bytes
[21] m_dispatcher.dll:public: virtual void __thiscall Mfh_file::dispatch_fh(int,struct mxArray_tag * *,int,struct mxArray_tag * *)(1, 0x00c2e750, 3, 0x00c2e6c0) + 249 bytes
[22] m_dispatcher.dll:public: void __thiscall Mfunction_handle::dispatch(int,struct mxArray_tag * *,int,struct mxArray_tag * *)(1, 0x00c2e750, 3, 0x00c2e6c0) + 420 bytes
[23] m_interpreter.dll:public: void __thiscall ResolverFunctionDesc::CallFunction(int,struct mxArray_tag * * const,int,struct mxArray_tag * * const)(1, 0x00c2e750, 3, 0x00c2ef1c "0òÂ") + 81 bytes
[24] m_interpreter.dll:public: bool __thiscall Resolver::CallMFunction(int,int,class _m_operand * const,union m_operand_storage *,int,class _m_operand * const,union m_operand_storage *,int *)(0x00c2e9e0, 1, 1, 0x09428db8) + 1209 bytes
[25] m_interpreter.dll:private: bool __thiscall accelImpl::MFunctionCall(struct _accelOp * *)(0x00c2ef30, 0xffffffff, 0x095385e0, 0xffffffff) + 545 bytes
[26] m_interpreter.dll:public: enum jitReturnFlags __thiscall accelImpl::Exec(void)(0x00c2ef1c "0òÂ", 0xffffffff, 0x215719d8, 0xffffffff) + 170 bytes
[27] m_interpreter.dll:public: enum jitReturnFlags __thiscall accelCode::Call(enum inMarshalType *,int *)const (0x00c2f1f4, 13, 0x21526d28, 0) + 133 bytes
[28] m_interpreter.dll:public: static bool __cdecl inJit::ExecuteHotSegment(struct _inJitAccelInfo *,enum opcodes *,int *,int *)(0x00c2f2e8, 0x00c2f2b0, 0x00c2f2dc, 0x00c2f2d8) + 2529 bytes
[29] m_interpreter.dll:int __cdecl inExecuteMFunctionOrScript(class Mfh_mp *,bool)(0x21493c01, 0xffffffff, 0x2150d210, 0) + 558 bytes
[30] m_interpreter.dll:void __cdecl inRunMfile(int,struct mxArray_tag * *,int,struct mxArray_tag * *,class Mfh_mp *,struct inWorkSpace_tag *)(0, 0x00c2f850, 0, 0) + 466 bytes
[31] m_interpreter.dll:public: virtual void __thiscall Mfh_mp::dispatch_file(struct _mdUnknown_workspace *,int,struct mxArray_tag * *,int,struct mxArray_tag * *)(0, 0, 0x00c2f850, 0) + 23 bytes
[32] m_interpreter.dll:public: virtual void __thiscall Mfh_mp::dispatch_file(int,struct mxArray_tag * *,int,struct mxArray_tag * *)(0, 0x00c2f850, 0, 0) + 25 bytes
[33] m_dispatcher.dll:public: virtual void __thiscall Mfh_file::dispatch_fh(int,struct mxArray_tag * *,int,struct mxArray_tag * *)(0, 0x00c2f850, 0, 0) + 249 bytes
[34] m_dispatcher.dll:public: void __thiscall Mfunction_handle::dispatch(int,struct mxArray_tag * *,int,struct mxArray_tag * *)(0, 0x00c2f850, 0, 0) + 420 bytes
[35] m_interpreter.dll:void __cdecl inEvalPcodeHeaderToWord(struct _memory_context *,int,struct mxArray_tag * * const,struct _pcodeheader *,class Mfh_mp *,unsigned int)(0x7b9dd604, 0, 0x00c2f850, 0x00c2f760) + 73 bytes
[36] m_interpreter.dll:enum inExecutionStatus __cdecl in_local_call_script_function(struct _memory_context *,struct _pcodeheader *,int,struct mxArray_tag * * const,unsigned int,bool)(0x7b9dd604, 0x00c2f760, 0, 0x00c2f850) + 70 bytes
[37] m_interpreter.dll:__catch$?AnonymousFunction@InterpBridge@@UAEXHQAPAUmxArray_tag@@H0@Z$0(0x7b9dd604, 0x2035dc20 "m = svmlearn(x,y,'-t 0 -z r -c 1..", 0, 0) + 10886 bytes
[38] m_interpreter.dll:enum inExecutionStatus __cdecl inEvalCmdWithLocalReturn(char const *,int *,bool,bool,bool (__cdecl*)(void *,char const *))(0x2035dc20 "m = svmlearn(x,y,'-t 0 -z r -c 1..", 0, 0, 1) + 79 bytes
[39] m_interpreter.dll:public: virtual enum inExecutionStatus __thiscall InterpBridge::EvalCmdWithLocalReturn(char const *,int *,bool,bool)(0x2035dc20 "m = svmlearn(x,y,'-t 0 -z r -c 1..", 0, 0, 1) + 25 bytes
[40] m_interpreter.dll:_inEvalCmdWithLocalReturn(0x2035dc20 "m = svmlearn(x,y,'-t 0 -z r -c 1..", 0, 0, 1) + 30 bytes
[41] libmwbridge.dll:enum inExecutionStatus __cdecl evalCommandWithLongjmpSafety(char const *)(0x2035dc20 "m = svmlearn(x,y,'-t 0 -z r -c 1..", 0, 0x1845f090, 0) + 67 bytes
[42] libmwbridge.dll:__catch$_mnParser$0(0x00f02ed0, 0, 0x1af2ce01, 1) + 294 bytes
[43] mcr.dll:private: void __thiscall mcrInstance::mnParser_on_interpreter_thread(void)(0x1845f0c8, 0x0691dfdc, 10, 0x00c2fb98) + 51 bytes
[44] mcr.dll:public: void __thi

The following

Discussion

  • Mick Crosse

    Mick Crosse - 2011-06-21

    I have the very same problem when trying to perform regression. Classification works fine for me also. Can anyone suggest what I might be doing wrong?

     
  • Jason Pacheco

    Jason Pacheco - 2013-06-18

    There is a bug in svm_learn.c. The author created the field model.a to store a[i]*label[i], however the field is only created in svm_learn_classification(). It isn't created in svm_learn_regression(), which causes a segfault when later accessed. I'm not sure whether this field would be meaningful for the regression case, but in any case I've added it to avoid segfaulting. I've submitted the attached patch to the author.

    Jason

     

    Last edit: Jason Pacheco 2013-06-18

Log in to post a comment.