Issue 1:
xref jump-dev/MathOptInterface.jl#1294

also looks similar to #39465

I'm not sure how to properly reduce this, sorry for the dependency. On Julia master, if I run:

using Hypatia
const MOI = Hypatia.MOI
model = Hypatia.Optimizer()
cache = MOI.Utilities.Model{Float64}()
MOI.copy_to(model, cache)

I get :

Internal error: encountered unexpected error in runtime:
StackOverflowError()
intersect at /home/thoth/julia/src/subtype.c:2944
intersect at /home/thoth/julia/src/subtype.c:3044
intersect at /home/thoth/julia/src/subtype.c:3060
intersect_unionall_ at /home/thoth/julia/src/subtype.c:2538
intersect_unionall at /home/thoth/julia/src/subtype.c:2587
intersect at /home/thoth/julia/src/subtype.c:3096
intersect_all at /home/thoth/julia/src/subtype.c:3186
intersect_aside at /home/thoth/julia/src/subtype.c:2092 [inlined]
intersect_aside at /home/thoth/julia/src/subtype.c:2079 [inlined]
intersect_var at /home/thoth/julia/src/subtype.c:2306
intersect at /home/thoth/julia/src/subtype.c:3044
intersect at /home/thoth/julia/src/subtype.c:3044
intersect at /home/thoth/julia/src/subtype.c:3044
intersect at /home/thoth/julia/src/subtype.c:3044
intersect at /home/thoth/julia/src/subtype.c:3060
intersect_unionall_ at /home/thoth/julia/src/subtype.c:2538
intersect_unionall at /home/thoth/julia/src/subtype.c:2587
intersect at /home/thoth/julia/src/subtype.c:3096
intersect_all at /home/thoth/julia/src/subtype.c:3186
intersect_aside at /home/thoth/julia/src/subtype.c:2092 [inlined]
intersect_aside at /home/thoth/julia/src/subtype.c:2079 [inlined]
intersect_var at /home/thoth/julia/src/subtype.c:2306
intersect at /home/thoth/julia/src/subtype.c:3044
intersect at /home/thoth/julia/src/subtype.c:3044
intersect at /home/thoth/julia/src/subtype.c:3044
intersect at /home/thoth/julia/src/subtype.c:3044
intersect at /home/thoth/julia/src/subtype.c:3060
intersect_unionall_ at /home/thoth/julia/src/subtype.c:2538
intersect_unionall at /home/thoth/julia/src/subtype.c:2587
intersect at /home/thoth/julia/src/subtype.c:3096
intersect_all at /home/thoth/julia/src/subtype.c:3186
intersect_aside at /home/thoth/julia/src/subtype.c:2092 [inlined]
intersect_aside at /home/thoth/julia/src/subtype.c:2079 [inlined]
intersect_var at /home/thoth/julia/src/subtype.c:2306
intersect at /home/thoth/julia/src/subtype.c:3044
intersect at /home/thoth/julia/src/subtype.c:3044
intersect at /home/thoth/julia/src/subtype.c:3044
intersect at /home/thoth/julia/src/subtype.c:3044
intersect at /home/thoth/julia/src/subtype.c:3060
...etc

This is with Hypatia master on Ubuntu (but also seen on Windows).

Issue 2:
MWE (sorry that it involves a heavyweight dependency)

using Pkg; Pkg.add("MixedModels")
using MixedModels
using MixedModels: dataset

cbpp = dataset(:cbpp)
form = @formula((incid/hsz) ~ 1 + period + (1|herd))
# fails
glmm = GeneralizedLinearMixedModel(form, cbpp,
Binomial();
wts=float(cbpp.hsz))
#fails
@code_warntype GeneralizedLinearMixedModel(form, cbpp,
Binomial();
wts=float(cbpp.hsz))

On 1.6, we get reasonable behavior:

@code_warntype GeneralizedLinearMixedModel(form, cbpp,
Binomial();
wts=float(cbpp.hsz))
MethodInstance for (::Core.var"#Type##kw")(::NamedTuple{(:wts,), Tuple{Vector{Float64}}}, ::Type{GeneralizedLinearMixedModel}, ::StatsModels.FormulaTerm{StatsModels.FunctionTerm{typeof(/), var"#1#3", (:incid, :hsz)}, Tuple{StatsModels.ConstantTerm{Int64}, StatsModels.Term, StatsModels.FunctionTerm{typeof(|), var"#2#4", (:herd,)}}}, ::Arrow.Table, ::Binomial{Float64})
from (var"#s35"::Core.var"#Type##kw")(::Any, ::Type{GeneralizedLinearMixedModel}, f::StatsModels.FormulaTerm, tbl, d::Distributions.Distribution) in MixedModels at /home/alex/.julia/dev/MixedModels/src/generalizedlinearmixedmodel.jl:325
Arguments
#s35::Core.Const(Core.var"#Type##kw"())
@_2::NamedTuple{(:wts,), Tuple{Vector{Float64}}}
@_3::Type{GeneralizedLinearMixedModel}
f::StatsModels.FormulaTerm{StatsModels.FunctionTerm{typeof(/), var"#1#3", (:incid, :hsz)}, Tuple{StatsModels.ConstantTerm{Int64}, StatsModels.Term, StatsModels.FunctionTerm{typeof(|), var"#2#4", (:herd,)}}}
tbl::Arrow.Table
d::Binomial{Float64}
Body::GeneralizedLinearMixedModel
1 ─ %1 = MixedModels.canonicallink(d)::Core.Const(LogitLink())
│ %2 = (#s35)(@_2, @_3, f, tbl, d, %1)::GeneralizedLinearMixedModel
└── return %2

My environment

julia> versioninfo(verbose=true)
Julia Version 1.7.0-DEV.709
Commit 11016bfcb2 (2021-03-15 14:55 UTC)
Platform Info:
OS: Linux (x86_64-linux-gnu)
Linux Mint 20.1
uname: Linux 5.8.0-44-generic #50~20.04.1-Ubuntu SMP Wed Feb 10 21:07:30 UTC 2021 x86_64 x86_64
CPU: Intel(R) Xeon(R) E-2288G CPU @ 3.70GHz:
speed user nice sys idle irq
#1-16 4781 MHz 3839559 s 18585 s 1265381 s 102100514 s 0 s

Memory: 31.24289321899414 GB (654.33203125 MB free)
Uptime: 676427.0 sec
Load Avg: 2.0 1.49 1.24
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-11.0.1 (ORCJIT, skylake)
Environment:
JULIA_NUM_THREADS = 8
R_LD_LIBRARY_PATH = /usr/local/lib/julia/
XDG_SESSION_PATH = /org/freedesktop/DisplayManager/Session0
MANDATORY_PATH = /usr/share/gconf/cinnamon.mandatory.path
HOMEBREW_PREFIX = /home/linuxbrew/.linuxbrew
MANPATH = /home/linuxbrew/.linuxbrew/share/man:/home/linuxbrew/.linuxbrew/share/man::
HOME = /home/user
XDG_SEAT_PATH = /org/freedesktop/DisplayManager/Seat0
INFOPATH = /home/linuxbrew/.linuxbrew/share/info:/home/linuxbrew/.linuxbrew/share/info:
GEM_HOME = /home/user/gems
TERM = screen-256color
DEFAULTS_PATH = /usr/share/gconf/cinnamon.default.path
HOMEBREW_CELLAR = /home/linuxbrew/.linuxbrew/Cellar
HOMEBREW_REPOSITORY = /home/linuxbrew/.linuxbrew/Homebrew
PATH = /home/user/gems/bin:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:/home/user/.local/bin:/home/user/.bin:/home/user/gems/bin:/home/user/anaconda3/condabin:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:/home/user/.local/bin:/home/user/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/user/.golang/bin:/home/user/.golang/bin
GOPATH = /home/user/.golang

cc @ararslan @dmbates