# Overnight a ERROR: StackOverflowError: in unchanged code

**URL:** <https://discourse.julialang.org/t/overnight-a-error-stackoverflowerror-in-unchanged-code/50449>\
**Category:** Optimization (Mathematical)\
**Tags:** jump\
**Created:** [November 19, 2020, 4:59pm UTC](https://discourse.julialang.org/t/overnight-a-error-stackoverflowerror-in-unchanged-code/50449 "2020-11-19T16:59:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![GerhardTotschnig](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gerhardtotschnig/32/215516_2.png) [@GerhardTotschnig](https://discourse.julialang.org/u/GerhardTotschnig)\
**Post date:** [November 19, 2020, 4:59pm UTC](https://discourse.julialang.org/t/overnight-a-error-stackoverflowerror-in-unchanged-code/50449/1 "2020-11-19T16:59:34Z")

</div>

Up to yesterday I had no problem with the code:  
[https://github.com/GerhardTotschnig/Seasonal](https://github.com/GerhardTotschnig/Seasonal)  
I think the code is unchanged. And the code still works on other computers.  
Starting from the REPL  
`julia>include("SeasUL.jl")`  
would work. I used two instances of VS-Code at the same time. Maybe something messed up.

The same files still works on other computers with the same installed packages.  
I use:  
(@v1.5) pkg\> status  
Status `C:\Users\user\.julia\environments\v1.5\Project.toml`  
[a076750e] CPLEX v0.7.3  
[4076af6c] JuMP v0.21.5  
[fdbf4ff8] XLSX v0.7.3

I reinstalled also Julia and VS Code but it did not help.  
I do not recall making any software updates.

But today I get on my laptop the following error messages:

````julia
julia> include("SeasUL.jl")
ERROR: StackOverflowError:
Stacktrace:
 [1] next_iterate(::Tuple{var"#1082#1100"{UnitRange{Int64}}}, ::Function, ::Tuple{Int64}, ::Tuple{Tuple{StepRange{Int64,Int64},Int64,Int64}}, ::UnitRange{Int64}, ::Tuple{Int64,Int64}) at C:\Users\totschnigg\.julia\packages\JuMP\qhoVb\src\Containers\nested_iterator.jl:47 (repeats 5662 times)
 [2] first_iterate(::Tuple{var"#1082#1100"{UnitRange{Int64}}}, ::Function, ::Tuple{Int64}, ::Tuple{Tuple{StepRange{Int64,Int64},Int64,Int64}}) at C:\Users\totschnigg\.julia\packages\JuMP\qhoVb\src\Containers\nested_iterator.jl:58
 [3] next_iterate(::Tuple{var"#1081#1099"{StepRange{Int64,Int64}},var"#1082#1100"{UnitRange{Int64}}}, ::Function, ::Tuple{}, ::Tuple{}, ::StepRange{Int64,Int64}, ::Tuple{Int64,Int64}) at C:\Users\totschnigg\.julia\packages\JuMP\qhoVb\src\Containers\nested_iterator.jl:41 [4] first_iterate at C:\Users\totschnigg\.julia\packages\JuMP\qhoVb\src\Containers\nested_iterator.jl:58 [inlined]
 [5] iterate at C:\Users\totschnigg\.julia\packages\JuMP\qhoVb\src\Containers\nested_iterator.jl:69 [inlined]
 [6] iterate at .\generator.jl:44 [inlined]
 [7] grow_to!(::JuMP.Containers.NoDuplicateDict{Any,Any}, ::Base.Generator{JuMP.Containers.NestedIterator{Tuple{var"#1081#1099"{StepRange{Int64,Int64}},var"#1082#1100"{UnitRange{Int64}}},var"#1083#1101"{StepRange{Int64,Int64},Array{Float64,1}}},JuMP.Containers.var"#30#31"{var"#1080#1098"{Model}}}) at .\dict.jl:139
 [8] dict_with_eltype at .\abstractdict.jl:540 [inlined]
 [9] JuMP.Containers.NoDuplicateDict(::Base.Generator{JuMP.Containers.NestedIterator{Tuple{var"#1081#1099"{StepRange{Int64,Int64}},var"#1082#1100"{UnitRange{Int64}}},var"#1083#1101"{StepRange{Int64,Int64},Array{Float64,1}}},JuMP.Containers.var"#30#31"{var"#1080#1098"{Model}}}) at C:\Users\totschnigg\.julia\packages\JuMP\qhoVb\src\Containers\no_duplicate_dict.jl:39
 [10] container(::Function, ::JuMP.Containers.NestedIterator{Tuple{var"#1081#1099"{StepRange{Int64,Int64}},var"#1082#1100"{UnitRange{Int64}}},var"#1083#1101"{StepRange{Int64,Int64},Array{Float64,1}}}, ::Type{JuMP.Containers.SparseAxisArray}) at C:\Users\totschnigg\.julia\packages\JuMP\qhoVb\src\Containers\container.jl:96
 [11] container at C:\Users\totschnigg\.julia\packages\JuMP\qhoVb\src\Containers\container.jl:65 [inlined]
 [12] macro expansion at C:\Users\totschnigg\.julia\packages\JuMP\qhoVb\src\macros.jl:91 [inlined]
 [13] add_cavern_var!(::Model, ::Tuple{String,String}, ::StepRange{Int64,Int64}, ::Array{Float64,1}, ::Float64, ::Float64, ::Float64, ::Array{Float64,1}, ::UnitRange{Int64}) at C:\Gerhard\Model\Julia\SeasonalStorage\SeasUL.jl:117
 [14] buildModel(::Model, ::Tuple{String,String}, ::StepRange{Int64,Int64}, ::StepRange{Int64,Int64}, ::Array{Float64,1}, ::Array{Float64,1}, ::Array{Float64,1}, ::Array{Float64,1}, ::Array{Float64,1}, ::Array{Float64,1}, ::Float64, ::Int64, ::Float64, ::Int64, ::Float64, ::Int64, ::Float64, ::Int64, ::Float64, ::Float64, ::Float64, ::Array{Float64,1}, ::Float64, ::Int64, ::Int64, ::Float64, ::UnitRange{Int64}) at C:\Gerhard\Model\Julia\SeasonalStorage\SeasUL.jl:468
 [15] top-level scope at C:\Gerhard\Model\Julia\SeasonalStorage\SeasUL.jl:613
 [16] include(::String) at .\client.jl:457
 [17] top-level scope at REPL[20]:1```

How can I find out what is the problem with my system? Since the same files work on other computers?
I would need some suggestion how to solve this problem.

After some time I found out, this error orrurs only if I start the code from Visual-Code. If I start the code from the Julia.exe then everything works. Strange.
````

---

<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:** [November 19, 2020, 6:41pm UTC](https://discourse.julialang.org/t/overnight-a-error-stackoverflowerror-in-unchanged-code/50449/2 "2020-11-19T18:41:25Z")

</div>

This looks like it is coming from JuMP. Can you simplify the example?

Edit: I downloaded your code and I cannot reproduce on Mac.

```nohighlight
(Seasonal) pkg> st
Status `~/Documents/People/gerhard/Seasonal/Project.toml`
  [a076750e] CPLEX v0.7.3
  [4076af6c] JuMP v0.21.5
  [fdbf4ff8] XLSX v0.7.3

```

There’s not much we can do without a reproducible example.

---

<div class="post-metadata">

**Author:** ![GerhardTotschnig](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gerhardtotschnig/32/215516_2.png) [@GerhardTotschnig](https://discourse.julialang.org/u/GerhardTotschnig)\
**Post date:** [November 19, 2020, 9:15pm UTC](https://discourse.julialang.org/t/overnight-a-error-stackoverflowerror-in-unchanged-code/50449/3 "2020-11-19T21:15:29Z")

</div>

@odow: You mean on your mac the code is running without a problem? Well on other computers in my office I also have no problem and yesterday it worked for my computer as well. Just today the code does not work on my computer any more! So for me it looks there is somethin on my computer which is corrupted. But I already installed Julia again and also Visual Code.  
How can I make a reproducible example? It seems only my computer has the problem.

---

<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:** [November 19, 2020, 9:22pm UTC](https://discourse.julialang.org/t/overnight-a-error-stackoverflowerror-in-unchanged-code/50449/4 "2020-11-19T21:22:43Z")

</div>

> [@GerhardTotschnig](#):
>
> How can I make a reproducible example? It seems only my computer has the problem.

I suggest simplifying your example by removing as many lines of code as possible while still retaining the error. Try removing CPLEX, and try removing XLSX by hard-coding the necessary data.
