REPL hangs at compile

Hi,

Can anyone else reproduce the below? The following function just hangs the julia REPL.

I’m using 1.11.0-rc3 on Windows 11.

import Hypatia
import SCS
import COSMO
using JuMP

function getjumpmodel(optimizer_name::String)
    @info "Using optimizer $optimizer_name"
    # create JuMP model
     if optimizer_name == "SCS"
          return JuMP.Model(SCS.Optimizer)
     elseif optimizer_name == "COSMO"
          return JuMP.Model(COSMO.Optimizer)
     elseif optimizer_name == "Hypatia"
          return JuMP.Model(Hypatia.Optimizer)
     elseif optimizer_name == "Mosek"
          @error "Can't use Mosek with JuMP since it does not support adding and removing constraints with JuMP.jl currently"
           # model = JuMP.Model(Mosek.Optimizer)
     end

     # defaults to SCS
     return JuMP.Model(SCS.Optimizer)
end

julia> getjumpmodel("SCS")

# returns nothing REPL just hangs here

I don’t have a Windows machine so I can’t test this, but I don’t see anything on the JuMP side that would cause this.

It’s something to do with this line

JuMP.Model(COSMO.Optimizer)

On my system this line will just cause the REPL to hang

I can reproduce this:

(base) oscar@Oscars-MBP /tmp % julia +1.11 --project=cosmo
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.11.0-rc3 (2024-08-26)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> import COSMO

julia> COSMO.Optimizer()
^C^C^C^C^C^C^C^CWARNING: Force throwing a SIGINT
Internal error: during type inference of
(::Type{COSMO.Optimizer{T} where T})()
Encountered unexpected error in runtime:
InterruptException()
^Ctmerge_types_slow at ./compiler/typelimits.jl:790
tmerge at ./compiler/typelimits.jl:704
tmerge at ./compiler/typelimits.jl:688
tmerge at ./compiler/typelimits.jl:676
tmerge at ./compiler/typelimits.jl:518
tmerge at ./compiler/typelimits.jl:478
tmerge at ./compiler/abstractlattice.jl:303
_getfield_tfunc at ./compiler/tfuncs.jl:1214
^C_getfield_tfunc at ./compiler/tfuncs.jl:1133 [inlined]
_getfield_tfunc at ./compiler/tfuncs.jl:1113
_getfield_tfunc at ./compiler/tfuncs.jl:1094 [inlined]
_getfield_tfunc at ./compiler/tfuncs.jl:1087 [inlined]
getfield_tfunc at ./compiler/tfuncs.jl:1053

At least we know the source of the bug now. For me this line just hangs the REPL. Thanks for looking into. Should I open an issue?

This is a bug in the Julia release candidate. I’ve opened an issue: Compiler hang in type inference: regression in Julia v1.11-rc3 · Issue #55809 · JuliaLang/julia · GitHub

1 Like

@gbaraldi fixed this two days ago in Fix hang in tmerge_types_slow by gbaraldi · Pull Request #55757 · JuliaLang/julia · GitHub, so it should be fine in the next release candidate.

1 Like