Search code examples
juliaheap-corruptionjulia-jump

Terminal process terminated with exit code 3221226356 (Julia and VS Code)


I am trying to run the code below in VS Code for Julia (or directly on Julia). It is a simple example that computes the Maximum Likelihood estimator of the mean and the variance of a normal distribution (source):


Random.seed!(1234)

n = 1_000
data = randn(n)

mle = Model(optimizer_with_attributes(Ipopt.Optimizer, "print_level" => 0))
@NLparameter(mle, problem_data[i = 1:n] == data[i])

μ0 = randn()
σ0 = rand() + 1
@info "Starting guess, mean: $μ0, std: $σ0"

@variable(mle, μ, start = μ0)
@variable(mle, σ >= 0.0, start = σ0)

@NLexpression(mle, loglikelihood,
    -(n / 2) * (log(2π) + 2 * log(σ)) - inv(2 * σ^2) * sum((xi - μ)^2 for xi in problem_data)
)

@NLobjective(mle, Max, loglikelihood)

optimize!(mle)

This is a nonlinear optimization problem using JuMP, and when running optimize!(mle) I am getting 'terminal process terminated with exit code 3221226356' in VS Code. Similarly, when I run it directly in Julia, it just shuts down entirely. (I have the latest versions) (I have tried in a different computer and everything works fine). Any help would be greatly appreciated!

P.S. I have seen it might have to do with a 'heap corruption problem', but I have no idea what that means/how to solve it.


Solution

  • This has been cross-posted on the Julia discourse, we'll continue to debug it there: https://discourse.julialang.org/t/cant-run-simple-jump-example/67938

    It's either:

    • An issue in VS-Code (although "when I run it directly in Julia" may rule this out)
    • An issue with Ipopt, which is either due to it installing an old version, or a weird incompatibility with this user's system

    Either way, this is likely hard to debug.