# REPL hangs at compile

**URL:** <https://discourse.julialang.org/t/repl-hangs-at-compile/119562>\
**Category:** General Usage\
**Tags:** jump\
**Created:** [September 18, 2024, 4:15pm UTC](https://discourse.julialang.org/t/repl-hangs-at-compile/119562 "2024-09-18T16:15:25Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![AUK1939](https://avatars.discourse-cdn.com/v4/letter/a/c57346/32.png) [@AUK1939](https://discourse.julialang.org/u/AUK1939)\
**Post date:** [September 18, 2024, 4:15pm UTC](https://discourse.julialang.org/t/repl-hangs-at-compile/119562/1 "2024-09-18T16:15:25Z")

</div>

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.

```julia
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

```

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [September 18, 2024, 9:11pm UTC](https://discourse.julialang.org/t/repl-hangs-at-compile/119562/2 "2024-09-18T21:11:33Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![AUK1939](https://avatars.discourse-cdn.com/v4/letter/a/c57346/32.png) [@AUK1939](https://discourse.julialang.org/u/AUK1939)\
**Post date:** [September 18, 2024, 9:22pm UTC](https://discourse.julialang.org/t/repl-hangs-at-compile/119562/3 "2024-09-18T21:22:09Z")

</div>

It’s something to do with this line

`JuMP.Model(COSMO.Optimizer)`

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

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [September 18, 2024, 9:46pm UTC](https://discourse.julialang.org/t/repl-hangs-at-compile/119562/4 "2024-09-18T21:46:02Z")

</div>

I can reproduce this:

```Julia
(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

```

---

<div class="post-metadata">

**Author:** ![AUK1939](https://avatars.discourse-cdn.com/v4/letter/a/c57346/32.png) [@AUK1939](https://discourse.julialang.org/u/AUK1939)\
**Post date:** [September 18, 2024, 9:49pm UTC](https://discourse.julialang.org/t/repl-hangs-at-compile/119562/5 "2024-09-18T21:49:21Z")

</div>

> [@odow](#):
>
> `COSMO.Optimizer()`

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?

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [September 18, 2024, 9:56pm UTC](https://discourse.julialang.org/t/repl-hangs-at-compile/119562/6 "2024-09-18T21:56:32Z")

</div>

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](https://github.com/JuliaLang/julia/issues/55809)

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [September 18, 2024, 10:33pm UTC](https://discourse.julialang.org/t/repl-hangs-at-compile/119562/7 "2024-09-18T22:33:35Z")

</div>

@gbaraldi fixed this two days ago in [Fix hang in tmerge\_types\_slow by gbaraldi · Pull Request #55757 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/pull/55757), so it should be fine in the next release candidate.
