Mysterious `StackOverFlow` error with type constructor when using `PyPlot` in conjunction with `Reduce`

It’s not clear how to resolve this StackOverFlow error, call to mandelbrot calls a Define type constructor:

pkg> dev Fatou

julia> using Fatou

julia> mandelbrot(:(z^3-1))
ERROR: StackOverflowError:
Stacktrace:
 [1] Type at ./none:0 [inlined]
 [2] #mandelbrot#4 at /home/flow/.julia/dev/Fatou/src/Fatou.jl:185 [inlined]
 [3] mandelbrot(::Expr) at /home/flow/.julia/dev/Fatou/src/Fatou.jl:184
 [4] top-level scope at none:0

Can’t figure out what’s the cause of this, it worked fine in 0.6 but not 1.0

It would help to have an MWE, Fatou has quite a few dependencies.

If any of those 17 parameters are removed, the issue is solved? I’m guessing they are important since you included them in MWE.

1 Like

Alright, here is the official minimum working example:

julia> module MWE
       using Reduce,PyPlot
       test(a) = RExpr(a)
       end
Reduce (Free CSL version, revision 4590), 11-May-18 ...
Main.MWE

julia> MWE.test(:(z^3-1))
ERROR: StackOverflowError:
Stacktrace:
 [1] top-level scope at none:0

However, if you remove the PyPlot dependency then

julia> module MWE
       using Reduce
       test(a) = RExpr(a)
       end
Reduce (Free CSL version, revision 4590), 11-May-18 ...
Main.MWE

julia> MWE.test(:(z^3-1))

 3
z  - 1

works without any error.

Therefore, it is now clear that when using Reduce, PyPlot there is a strange issue happening with the RExpr type constructor causing a StackOverFlow error. Is this a Julia language bug or a PyPlot bug?

Anybody know what’s causing this, if it’s julia or PyPlot? @Tamas_Papp @kristoffer.carlsson

This is not really minimal, as it involves two packages, with rather heavy dependencies.

If you weren’t its maintaner, I would recommend opening an issue for Reduce, but in this case your best solution is probably just isolating the problem, eg by deving both packages and then commenting out parts, then making a self-contained MWE which you can use for figuring out a fix or opening an issue.

1 Like

That sure describes the process I had in mind for isolating it down further as well. I’ve got other things to do in life, what I post here is more of a public reminder to myself and others for centering in on the issue. When I’m not worried about other things I might narrow it down further, but since this is a public discussion, others are welcome to provide feedback.

Looks like Julia version 1.0.1 fixes this issue! So it wasn’t an issue with Reduce or PyPlot but Julia itself.