Page 1 of 1

C++ Runtime error - 3rd order app

PostPosted: Mon Jan 12, 2015 11:14 am
by domel_s
Dear colleagues,

I am using Dynare 4.4.2 and Matlab 2014b (the problem also appears for Dynare 4.3.3 and Matlab 2012b). I encountered a problem with solving the model using 3rd order app for some parameters sets. I am receiving Microsoft Visual C++ Runtime error after which Matlab requests to be closed. This is particularly problematic when I am running the loop over some parameter sets and suddenly encounter this error since the loop cannot be continued. The solution that I am looking for would probably involve avoiding closing the Matlab when the loop runs (i.e. try....catch statement). I am ready to send the mod file if necessary.

I would be very thankful for your help!!
Best regards,
Dominik

P.S. I forgot to mention that the model solves (without any error) for 1st and 2nd order app.

The details of the error are as follows:

"This application has requested the Runtime to terminate it in an unusual way"

------------------------------------------------------------------------
std::terminate() detected at Mon Jan 12 12:12:32 2015
------------------------------------------------------------------------

Configuration:
Crash Decoding : Disabled
Default Encoding : windows-1252
Graphics card 1 : Intel Corporation ( 0x8086 ) Intel(R) HD Graphics Family Version 10.18.10.3412
MATLAB Architecture: win64
MATLAB Root : D:\mat_ext\R2014b
MATLAB Version : 8.4.0.150421 (R2014b)
Operating System : Microsoft Windows 7 Enterprise
Processor ID : x86 Family 6 Model 69 Stepping 1, GenuineIntel
Software OpenGL : 0
Virtual Machine : Java 1.7.0_11-b21 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:
std::terminate()

Register State (captured):
RAX = 00000000044eea01 RBX = 0000000004010030
RCX = 000000000400f9f0 RDX = 0000000000000000
RSP = 000000000400f560 RBP = 00000000040107e0
RSI = 00000000044dea60 RDI = 00000000044eeab0

R8 = 000007fffffde000 R9 = 000007fee8c60000
R10 = 00000000044deab0 R11 = 00000000044deab0
R12 = 00000000fd7f3f01 R13 = 00000000040105f8
R14 = 0000000000000000 R15 = 0000000000000000

RIP = 000000000431432a EFL = 00000206

CS = 0033 FS = 0053 GS = 002b

Stack Trace (captured):
[ 0] 0x000000000431432a D:\mat_ext\R2014b\bin\win64\libmwfl.dll+00082730 fl::diag::windows::context_base::capture_data+00000010
[ 1] 0x0000000004310bb4 D:\mat_ext\R2014b\bin\win64\libmwfl.dll+00068532 fl::diag::thread_context::unspecified_bool+00006628
[ 2] 0x00000000043130f6 D:\mat_ext\R2014b\bin\win64\libmwfl.dll+00078070 fl::test::terminate_handler::~terminate_handler+00003510
[ 3] 0x00000000fd0f2e45 D:\mat_ext\R2014b\bin\win64\mcr.dll+00470597 mnShutdownMCR+00026709
[ 4] 0x00000000fd0f25c1 D:\mat_ext\R2014b\bin\win64\mcr.dll+00468417 mnShutdownMCR+00024529
[ 5] 0x00000000fd0f26aa D:\mat_ext\R2014b\bin\win64\mcr.dll+00468650 mnShutdownMCR+00024762
[ 6] 0x00000000fd0ef0ca D:\mat_ext\R2014b\bin\win64\mcr.dll+00454858 mnShutdownMCR+00010970
[ 7] 0x00000000fd0f3938 D:\mat_ext\R2014b\bin\win64\mcr.dll+00473400 mnSetSegvServiceUrl+00000168
[ 8] 0x000007fee8ccd56c D:\mat_ext\R2014b\bin\win64\MSVCR110.dll+00447852 purecall+00000024
[ 9] 0x00000000ec75c827 D:\mat_ext\R2014b\bin\win64\libmwconfig.dll+00378919 QueryMLFcnTable_libmwconfig+00371383
[ 10] 0x00000000ec7646fb D:\mat_ext\R2014b\bin\win64\libmwconfig.dll+00411387 QueryMLFcnTable_libmwconfig+00403851
[ 11] 0x00000000ec767cb3 D:\mat_ext\R2014b\bin\win64\libmwconfig.dll+00425139 QueryMLFcnTable_libmwconfig+00417603
[ 12] 0x0000000005541e90 D:\mat_ext\R2014b\bin\win64\m_dispatcher.dll+00007824 Mlm_MATLAB_fn::reset_license+00000512
[ 13] 0x0000000005554ad3 D:\mat_ext\R2014b\bin\win64\m_dispatcher.dll+00084691 Mdispatcher::cleanupAllFcns+00000147
[ 14] 0x0000000005629c90 D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00040080 inEvalCmd+00008208
[ 15] 0x0000000005623905 D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00014597 MathWorks::interpreter::releaseCurrentMcrContext+00001061
[ 16] 0x00000000fd7411e8 D:\mat_ext\R2014b\bin\win64\mlutil.dll+01249768 mlutil::contextmgr::ContextRegistry::getInstance+00011528
[ 17] 0x00000000fd73a315 D:\mat_ext\R2014b\bin\win64\mlutil.dll+01221397 mlutil::contextmgr::NullResourceException::rethrow+00024917
[ 18] 0x00000000fd7911c6 D:\mat_ext\R2014b\bin\win64\mlutil.dll+01577414 mlutil::ScopedFactoryRegistration::Impl::unregister+00000070
[ 19] 0x00000000fd790eab D:\mat_ext\R2014b\bin\win64\mlutil.dll+01576619 mlutil::ScopedFactoryRegistration::Impl::~Impl+00000027
[ 20] 0x00000000fd73bdb8 D:\mat_ext\R2014b\bin\win64\mlutil.dll+01228216 mlutil::contextmgr::NullResourceException::rethrow+00031736
[ 21] 0x00000000fd6aeaf3 D:\mat_ext\R2014b\bin\win64\mlutil.dll+00649971 mlutil::ScopedFactoryRegistration::~ScopedFactoryRegistration+00000035
[ 22] 0x000000000575a620 D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+01287712 init_cleaner+00003184
[ 23] 0x000000000575a5f0 D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+01287664 init_cleaner+00003136
[ 24] 0x000000000575a5d2 D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+01287634 init_cleaner+00003106
[ 25] 0x0000000005761038 D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+01314872 QueryMLFcnTable_m_interpreter+00019832
[ 26] 0x00000000057612ba D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+01315514 QueryMLFcnTable_m_interpreter+00020474
[ 27] 0x0000000076ce43a1 C:\Windows\SYSTEM32\ntdll.dll+00148385 LdrShutdownProcess+00000465
[ 28] 0x0000000076ce41b0 C:\Windows\SYSTEM32\ntdll.dll+00147888 RtlExitUserProcess+00000144
[ 29] 0x000007fefe3899e2 C:\Windows\system32\msvcrt.dll+00039394 wcstoui64+00000762
[ 30] 0x000007fefe3c541c C:\Windows\system32\msvcrt.dll+00283676 abort+00000160
[ 31] 0x0000000015a4bbd8 D:\models\4.4.2\mex\matlab\win64-7.8-8.2\k_order_perturbation.mexw64+00768984 mexFunction+00762024
[ 32] 0x0000000015a31c82 D:\models\4.4.2\mex\matlab\win64-7.8-8.2\k_order_perturbation.mexw64+00662658 mexFunction+00655698
[ 33] 0x0000000015ace440 D:\models\4.4.2\mex\matlab\win64-7.8-8.2\k_order_perturbation.mexw64+01303616 mexFunction+01296656
[ 34] 0x0000000015a31d16 D:\models\4.4.2\mex\matlab\win64-7.8-8.2\k_order_perturbation.mexw64+00662806 mexFunction+00655846
[ 35] 0x0000000015ad30f2 D:\models\4.4.2\mex\matlab\win64-7.8-8.2\k_order_perturbation.mexw64+01323250 mexFunction+01316290
[ 36] 0x0000000015997d7e D:\models\4.4.2\mex\matlab\win64-7.8-8.2\k_order_perturbation.mexw64+00032126 mexFunction+00025166
[ 37] 0x00000000159a48e5 D:\models\4.4.2\mex\matlab\win64-7.8-8.2\k_order_perturbation.mexw64+00084197 mexFunction+00077237
[ 38] 0x00000000159a54d8 D:\models\4.4.2\mex\matlab\win64-7.8-8.2\k_order_perturbation.mexw64+00087256 mexFunction+00080296
[ 39] 0x0000000015992fa1 D:\models\4.4.2\mex\matlab\win64-7.8-8.2\k_order_perturbation.mexw64+00012193 mexFunction+00005233
[ 40] 0x00000000fc5f3701 D:\mat_ext\R2014b\bin\win64\libmex.dll+00079617 mexRunMexFile+00000129
[ 41] 0x00000000fc5f2762 D:\mat_ext\R2014b\bin\win64\libmex.dll+00075618 inSwapMexfileReader+00000690
[ 42] 0x00000000fc5f2248 D:\mat_ext\R2014b\bin\win64\libmex.dll+00074312 mexUnlock+00006008
[ 43] 0x00000000055505e3 D:\mat_ext\R2014b\bin\win64\m_dispatcher.dll+00067043 Mfh_file::dispatch_fh+00000659
[ 44] 0x0000000005550aee D:\mat_ext\R2014b\bin\win64\m_dispatcher.dll+00068334 Mfunction_handle::dispatch+00000766
[ 45] 0x0000000005662b2f D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00273199 inGetNameInSymbolTable+00017071
[ 46] 0x00000000056640c0 D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00278720 inGetNameInSymbolTable+00022592
[ 47] 0x0000000005661b4f D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00269135 inGetNameInSymbolTable+00013007
[ 48] 0x0000000005661ab1 D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00268977 inGetNameInSymbolTable+00012849
[ 49] 0x000000000568406f D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00409711 inPathNotification::function_delete_notification+00098591
[ 50] 0x00000000056827af D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00403375 inPathNotification::function_delete_notification+00092255
[ 51] 0x0000000005681359 D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00398169 inPathNotification::function_delete_notification+00087049
[ 52] 0x00000000055505e3 D:\mat_ext\R2014b\bin\win64\m_dispatcher.dll+00067043 Mfh_file::dispatch_fh+00000659
[ 53] 0x0000000005550aee D:\mat_ext\R2014b\bin\win64\m_dispatcher.dll+00068334 Mfunction_handle::dispatch+00000766
[ 54] 0x0000000005662b2f D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00273199 inGetNameInSymbolTable+00017071
[ 55] 0x00000000056640c0 D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00278720 inGetNameInSymbolTable+00022592
[ 56] 0x0000000005661b4f D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00269135 inGetNameInSymbolTable+00013007
[ 57] 0x0000000005661ab1 D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00268977 inGetNameInSymbolTable+00012849
[ 58] 0x000000000568406f D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00409711 inPathNotification::function_delete_notification+00098591
[ 59] 0x00000000056827af D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00403375 inPathNotification::function_delete_notification+00092255
[ 60] 0x0000000005681359 D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00398169 inPathNotification::function_delete_notification+00087049
[ 61] 0x00000000055505e3 D:\mat_ext\R2014b\bin\win64\m_dispatcher.dll+00067043 Mfh_file::dispatch_fh+00000659
[ 62] 0x0000000005550aee D:\mat_ext\R2014b\bin\win64\m_dispatcher.dll+00068334 Mfunction_handle::dispatch+00000766
[ 63] 0x0000000005662b2f D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00273199 inGetNameInSymbolTable+00017071
[ 64] 0x00000000056640c0 D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00278720 inGetNameInSymbolTable+00022592
[ 65] 0x0000000005661b4f D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00269135 inGetNameInSymbolTable+00013007
[ 66] 0x0000000005661ab1 D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00268977 inGetNameInSymbolTable+00012849
[ 67] 0x000000000568406f D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00409711 inPathNotification::function_delete_notification+00098591
[ 68] 0x00000000056827af D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00403375 inPathNotification::function_delete_notification+00092255
[ 69] 0x0000000005681359 D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00398169 inPathNotification::function_delete_notification+00087049
[ 70] 0x00000000055505e3 D:\mat_ext\R2014b\bin\win64\m_dispatcher.dll+00067043 Mfh_file::dispatch_fh+00000659
[ 71] 0x0000000005550aee D:\mat_ext\R2014b\bin\win64\m_dispatcher.dll+00068334 Mfunction_handle::dispatch+00000766
[ 72] 0x0000000005662b2f D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00273199 inGetNameInSymbolTable+00017071
[ 73] 0x00000000056640c0 D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00278720 inGetNameInSymbolTable+00022592
[ 74] 0x0000000005661b4f D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00269135 inGetNameInSymbolTable+00013007
[ 75] 0x0000000005661ab1 D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00268977 inGetNameInSymbolTable+00012849
[ 76] 0x000000000568406f D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00409711 inPathNotification::function_delete_notification+00098591
[ 77] 0x00000000056827af D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00403375 inPathNotification::function_delete_notification+00092255
[ 78] 0x0000000005681359 D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00398169 inPathNotification::function_delete_notification+00087049
[ 79] 0x00000000055505e3 D:\mat_ext\R2014b\bin\win64\m_dispatcher.dll+00067043 Mfh_file::dispatch_fh+00000659
[ 80] 0x0000000005550aee D:\mat_ext\R2014b\bin\win64\m_dispatcher.dll+00068334 Mfunction_handle::dispatch+00000766
[ 81] 0x000000000563b606 D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00112134 MathWorks::MException::IMExceptionData::IMExceptionData+00037094
[ 82] 0x000000000563aa20 D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00109088 MathWorks::MException::IMExceptionData::IMExceptionData+00034048
[ 83] 0x0000000005639219 D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00102937 MathWorks::MException::IMExceptionData::IMExceptionData+00027897
[ 84] 0x0000000005638de5 D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00101861 MathWorks::MException::IMExceptionData::IMExceptionData+00026821
[ 85] 0x000000000568b708 D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00440072 inPathNotification::function_delete_notification+00128952
[ 86] 0x0000000005663ea5 D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00278181 inGetNameInSymbolTable+00022053
[ 87] 0x0000000005661b4f D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00269135 inGetNameInSymbolTable+00013007
[ 88] 0x0000000005661ab1 D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00268977 inGetNameInSymbolTable+00012849
[ 89] 0x000000000568406f D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00409711 inPathNotification::function_delete_notification+00098591
[ 90] 0x00000000056827af D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00403375 inPathNotification::function_delete_notification+00092255
[ 91] 0x0000000005681359 D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00398169 inPathNotification::function_delete_notification+00087049
[ 92] 0x00000000055507a4 D:\mat_ext\R2014b\bin\win64\m_dispatcher.dll+00067492 Mfh_file::dispatch_fh+00001108
[ 93] 0x0000000005550aee D:\mat_ext\R2014b\bin\win64\m_dispatcher.dll+00068334 Mfunction_handle::dispatch+00000766
[ 94] 0x0000000005662b2f D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00273199 inGetNameInSymbolTable+00017071
[ 95] 0x000000000574b6f7 D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+01226487 inFullEvalFcn+00011159
[ 96] 0x0000000005665592 D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00284050 inGetNameInSymbolTable+00027922
[ 97] 0x0000000005661b4f D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00269135 inGetNameInSymbolTable+00013007
[ 98] 0x0000000005661ab1 D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00268977 inGetNameInSymbolTable+00012849
[ 99] 0x000000000568406f D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00409711 inPathNotification::function_delete_notification+00098591
[100] 0x00000000056827af D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00403375 inPathNotification::function_delete_notification+00092255
[101] 0x0000000005681359 D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00398169 inPathNotification::function_delete_notification+00087049
[102] 0x00000000055507a4 D:\mat_ext\R2014b\bin\win64\m_dispatcher.dll+00067492 Mfh_file::dispatch_fh+00001108
[103] 0x0000000005550aee D:\mat_ext\R2014b\bin\win64\m_dispatcher.dll+00068334 Mfunction_handle::dispatch+00000766
[104] 0x0000000005662b2f D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00273199 inGetNameInSymbolTable+00017071
[105] 0x000000000574b6f7 D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+01226487 inFullEvalFcn+00011159
[106] 0x0000000005665592 D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00284050 inGetNameInSymbolTable+00027922
[107] 0x0000000005661b4f D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00269135 inGetNameInSymbolTable+00013007
[108] 0x0000000005661ab1 D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00268977 inGetNameInSymbolTable+00012849
[109] 0x000000000568406f D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00409711 inPathNotification::function_delete_notification+00098591
[110] 0x00000000056827af D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00403375 inPathNotification::function_delete_notification+00092255
[111] 0x0000000005681359 D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00398169 inPathNotification::function_delete_notification+00087049
[112] 0x00000000055507a4 D:\mat_ext\R2014b\bin\win64\m_dispatcher.dll+00067492 Mfh_file::dispatch_fh+00001108
[113] 0x0000000005550aee D:\mat_ext\R2014b\bin\win64\m_dispatcher.dll+00068334 Mfunction_handle::dispatch+00000766
[114] 0x00000000056b4a88 D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00608904 inPathNotification::function_delete_notification+00297784
[115] 0x00000000056b4a04 D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00608772 inPathNotification::function_delete_notification+00297652
[116] 0x00000000056b49c5 D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00608709 inPathNotification::function_delete_notification+00297589
[117] 0x00000000056b4992 D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00608658 inPathNotification::function_delete_notification+00297538
[118] 0x00000000056b4947 D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00608583 inPathNotification::function_delete_notification+00297463
[119] 0x000000000562d69d D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+00054941 inEvalExp+00001309
[120] 0x000000000575525d D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+01266269 inEvalCmdWithLocalReturn+00000285
[121] 0x0000000005755181 D:\mat_ext\R2014b\bin\win64\m_interpreter.dll+01266049 inEvalCmdWithLocalReturn+00000065
[122] 0x0000000006bce31d D:\mat_ext\R2014b\bin\win64\libmwbridge.dll+00058141 mnGetPrompt+00001517
[123] 0x0000000006bced09 D:\mat_ext\R2014b\bin\win64\libmwbridge.dll+00060681 mnParser+00000745
[124] 0x00000000fd0dd834 D:\mat_ext\R2014b\bin\win64\mcr.dll+00383028 mcrInstance::mnParser_on_interpreter_thread+00000036
[125] 0x00000000fd0a68e7 D:\mat_ext\R2014b\bin\win64\mcr.dll+00157927 mcr::runtime::setInterpreterThreadToCurrent+00019751
[126] 0x00000000fd0a6923 D:\mat_ext\R2014b\bin\win64\mcr.dll+00157987 mcr::runtime::setInterpreterThreadToCurrent+00019811
[127] 0x00000000fd0a7121 D:\mat_ext\R2014b\bin\win64\mcr.dll+00160033 mcr::runtime::setInterpreterThreadToCurrent+00021857

Re: C++ Runtime error - 3rd order app

PostPosted: Mon Jan 12, 2015 7:57 pm
by jpfeifer
Could you please provide me with a file to replicate the issue.

Re: C++ Runtime error - 3rd order app

PostPosted: Tue Jun 28, 2016 11:50 pm
by hscbsc
Hi,

Even I am facing an error similar to that of Dominik.

When using a windows 10 machine with Dynare 4.4.3 and matlab 2013b, I replicate exact error as he is facing.
When using an Ubuntu 14.04 with Dynare 4.4.3 and matlab 2014a, I get the error copied in the error.txt file.

Rest of the files attached were used when encountered the error. This is a simple example and I am facing the same issue in more developed models.

Please suggest how to move ahead.

Thank you.

Re: C++ Runtime error - 3rd order app

PostPosted: Wed Jun 29, 2016 7:10 am
by jpfeifer
Thank you for reporting this. We will investigate the issue. Unfortunately, this is tricky and might take some time. You can keep track at https://github.com/DynareTeam/dynare/issues/1246

Re: C++ Runtime error - 3rd order app

PostPosted: Wed Jun 29, 2016 4:58 pm
by hscbsc
Hi Johannes,

Thank you again. I will keep a track of the link for updates.

After I reported this, I tried working on it. For now I have been able to resolve the problem, however it will be great if you can review what I am doing is correct. I followed these steps:
1. I captured the value of the parameters where the error was occurring.
2. I ran the mod file standalone, i.e. using the steady, check commands and not resol as in obj fn.
3. In the toy example I reported and other models I am working on, the parameter values gave either of these errors:
- Steady state is complex, or
- Jacobian is Nan, or
- One of the eigenvalues is close to 0/0 ...

This seems to be related to use of options_.k_order_solver=1 (as discussed in the viewtopic.php?f=1&t=6432). When using resol.m in obj fn, after enabling options_.k_order_solver=1 it always call k_order_pert.m (from stochastic_solver.m). However, if a set of parameter values does not generate valid SS, Jacobian or eigenvalues k_order_pert causes the crash.
When using standalone mod file, dynare uses the check where it doesn't set options_.k_order_solver=1 and k_order_pert.m isn't called. For an invalid parameter set, dynare throws an error and stops.

So, instead of using this part of code (checking for info) after resol in obj fn.
if info ~= 0
obj = 10e+6;
return
end

I call check:
options_.k_order_solver=0;
[info] = checkD(M_, options_, oo_);
if info~=0
obj = 10e+6;
disp('Check failed');
return
end

Then use options_.k_order_solver=1; and call resol.
This has helped in resolving the issue. Hopefully this helps in clarifying the problem more. Please let me know if this is fine.

Thank you again.

Re: C++ Runtime error - 3rd order app

PostPosted: Wed Jun 29, 2016 5:40 pm
by jpfeifer
What you report is actually a user error. When you look at the SMM-code to Born/Pfeifer (2014), you will see that error codes returned by resol must be correctly handled. You cannot simply try to solve the model when something went wrong earlier. Thus,
Code: Select all
if info~=0
obj = 10e+6;
disp('Check failed');
return
end

is actually required here. The issue I opened a ticket for is different, though. That's why I did not spot your additional problem.

Re: C++ Runtime error - 3rd order app

PostPosted: Wed Jun 29, 2016 5:52 pm
by hscbsc
Thanks.

Yes, I modified my obj fn to follow SMM code as you mentioned. I just do a prior 'check ' as dynare does in usual case.
Then I follow Born/Pfeifer (2014) code:

[oo_.dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_); %run model solution in Dynare
if info %solution was not successful
info
fval=10e6+sum([xopt(1),xopt(2),xopt(3),log(xopt(4)) ].^2); %return with penalty
else
...

I guess now the error handling is correct.
Though, I will keep track of the ticket :)

Thanks.

Re: C++ Runtime error - 3rd order app

PostPosted: Wed Jul 13, 2016 8:16 pm
by hscbsc
Dear Johannes,

I am facing another issue with Matlab crashing. This time, Matlab crashes but not at k_order_pert(). Surprisingly, I have a laptop with Windows 10 Home and Desktop with Windows 10 Pro. Both have dynare version 4.4.3. It crashes on Desktop and not on Laptop !

I backtraced the info value:
When running check.m, resol() at Line 73 does not return info = 2 16 14 (as it does in laptop), but info=0 . And so dynare doesn't throws an error at print_info and moves to 'eigenvalues_ = dr.eigval' where Matlab crashes.
resol.m Line 137
stochastic_solvers.m Line 217
dyn_first_order_solver Line 216
Here, I am guessing we use mjdgges MEX file.

On Ubuntu dynare distribution / Desktop Dynare all these info=0.
However on a windows laptop dynare 4.4.3, info = 2 16 14.

Since I am using the mod file in optimization I can't really control the parameters.

In fact this problem has troubled me lately. I was using ubuntu 14.04 with dynare 4.4.3 earlier and it kept on crashing. I reinstalled Windows 10 on the system to see if I can get rid of the issue, but the issue persist. I am attaching the mod file, Matlab crash report and the print_info error raised on the laptop when the Matlab doesn't crash.

I am not sure whether this is replicable, I guess one way to check is ' when running check.m, resol() at Line 73 if it returns info = 0, then dynare will not stop at print_info'.

Re: C++ Runtime error - 3rd order app

PostPosted: Thu Jul 14, 2016 10:35 am
by jpfeifer
Thanks for pointing this out. Unfortunately, this issue is complicated. I opened a ticket at https://github.com/DynareTeam/dynare/issues/1250.

Re: C++ Runtime error - 3rd order app

PostPosted: Sun Jul 17, 2016 11:15 am
by jpfeifer
The issue you face is solved in today's snapshot

Re: C++ Runtime error - 3rd order app

PostPosted: Mon Jul 18, 2016 4:18 am
by hscbsc
Thnx a lot for the help.

Re: C++ Runtime error - 3rd order app

PostPosted: Tue Jul 19, 2016 7:11 am
by hscbsc
Hi Johannes,

Thnx again for the help. However, I am still facing the same issue. I reinstalled dynare following the instructions at http://www.dynare.org/DynareWiki/Instal ... anOrUbuntu.
Also, this is just to note (I am not sure whether this makes any difference) when I installed dynare I chose the option to rename Matlab gcc libraries in case of conflict.

Please let me know if I did some error in installations / or when updating dynare.

Re: C++ Runtime error - 3rd order app

PostPosted: Tue Jul 19, 2016 9:21 am
by jpfeifer
AFAIK that only works with the stable version. You need to use the unstable version. See https://github.com/DynareTeam/dynare on how to build Dynare from source.