Mantis - ALGLIB
Viewing Issue Advanced Details
813 Optimization minor always 2018-04-24 11:06 2018-04-27 16:06
rmanthorpe  
SergeyB  
normal  
resolved 3.13.0  
fixed  
none    
none 3.14.0  
C++
0000813: FIXED: minlmoptimize enters an infinite loop when fvec throws an exception on Windows x64
In recent versions of MSVC setjmp/longjmp used by ALGLIB internally interferes with throw/catch also used by ALGLIB to catch user exceptions. MSVC does not support longjmp() out of catch() clause (even though jump itself seems to be legitimate). Code starts looping forever.

New version of ALGLIB exception handling code better separates these two strategies, so no eternal loop takes place.

=== ORIGINAL MESSAGE ===================================================

The example below should exit with status 1 but never completes on Windows x64 using Visual Studio 2015 Update 3. It works as expected on Windows x86 and Linux.

test.cpp
---------------------------------------------------------------
#include "optimization.h"

void callback(const alglib::real_1d_array&, alglib::real_1d_array&, void*)
{
    throw 0;
}

int main()
{
    alglib::minlmstate state;
    alglib::real_1d_array x;
    x.setlength(1);
    alglib::minlmcreatev(1, x, 1e-5, state);
    try
    {
        alglib::minlmoptimize(state, &callback);
    }
    catch(...)
    {
        return 1;
    }
    return 0;
}
Issue History
2018-04-24 11:06 rmanthorpe New Issue
2018-04-24 11:06 rmanthorpe Programming language => C++
2018-04-26 15:50 SergeyB Assigned To => SergeyB
2018-04-26 15:50 SergeyB Status new => feedback
2018-04-26 15:51 SergeyB Status feedback => assigned
2018-04-26 15:51 SergeyB Note Added: 0000072
2018-04-26 16:32 SergeyB Target Version => 3.14.0
2018-04-26 18:06 SergeyB Note Added: 0000073
2018-04-27 16:06 SergeyB Summary Minlmoptimize enters an infinite loop when fvec throws an exception on Windows x64 => FIXED: minlmoptimize enters an infinite loop when fvec throws an exception on Windows x64
2018-04-27 16:06 SergeyB Description Updated
2018-04-27 16:06 SergeyB Status assigned => resolved
2018-04-27 16:06 SergeyB Fixed in Version => 3.14.0
2018-04-27 16:06 SergeyB Resolution open => fixed

Notes
(0000072)
SergeyB   
2018-04-26 15:51   
OK, confirmed issue, started to debug
(0000073)
SergeyB   
2018-04-26 18:06   
It turned out to be easy - in recent versions of MSVC setjmp/longjmp used by ALGLIB internally interferes with throw/catch also used by ALGLIB to catch user exceptions. Will be fixed in the upcoming 3.14.0.

Thank you for the report!