Qt Warning: *path/to/file.qml*: RangeError: Maximum call stack size exceeded

When runing this

using QML
using Observables

slidervalue = Observable(0.0)

loadqml(
  joinpath(pwd(),"slider.qml"),
  variables = JuliaPropertyMap(
    "slidervalue" => slidervalue
  )
)

exec()

and the content of “slider.qml” being

import QtQuick 2.6
import QtQuick.Controls 2.3
import org.julialang 1.0

ApplicationWindow {
  id: mainWin
  title: "My Application"
  width: 100
  height: 100
  visible: true

  Rectangle {
    anchors.fill: parent
    color: "red"

    Text {
      anchors.centerIn: parent
      text: props.hi + Julia.world()
    }
  }
}

I get the following error

Qt Warning: qrc:/qt-project.org/imports/QtQuick/Controls/Fusion/ApplicationWindow.qml:2134880960: RangeError: Maximum call stack size exceeded. (qrc:/qt-project.org/imports/QtQuick/Controls/Fusion/ApplicationWindow.qml:2134880960, (null))
Qt Warning: path/slider.qml:2134880912: RangeError: Maximum call stack size exceeded. (path/slider.qml:2134880912, (null))
Qt Warning: path/slider.qml:2134880912: RangeError: Maximum call stack size exceeded. (path/slider.qml:2134880912, (null))
Qt Warning: path/slider.qml:2134880912: RangeError: Maximum call stack size exceeded. (path/slider.qml:2134880912, (null))

where I manually replaced the displayed path with path for the purpose of this post.

General informations:

  • Julia v.1.11.1
  • Package status:
    • QML v0.9.1
    • Observables v0.5.5
  • OS: Debian GNU/Linux 12 (bookworm)
  • Processor: Intel Core i7-7500U x4
  • Graphics NV117/Mesa Intel HD Graphics 620 (KBL GT2)

What is the problem and how to solve it ?

For your information, this code example comes from a talk given by Bart Janssens at the JuliaCon 2020 and correspnods to the first example in this video: https://youtu.be/AddbHe05yRg?si=rMqBECxDDAnKFK4I&t=38
If needed, the corresponding source material can be found here GitHub - barche/juliacon2020-qml: Juliacon 2020 slides for the QML.jl talk

Note that I changed the exec_async() from the example to exec() in order for it to run.

I have the same issue and can reproduce it by two means:

  1. Running the code from inside VSCode.
  2. Wrapping code like OP’s into one function and call it from the REPL in a terminal e.g. by prefixing @async or Threads.@spawn,

Running it from the REPL without async/threading is fine in my setup.

Julia 1.11.2, QML 0.9.1, CxxWrap 0.16, Observables 0.5.5, Ubuntu 22.04.5 LTS

1 Like

If you are using Julia 1.11.x, make sure you have in your project file these entries:

CxxWrap = "0.16"
QML = "0.9"

Thanks for the reminder. I double checked and the dependencies are there as indicated by you. Point is, currently I seem not to be able to make QML.jl work from inside VSCode, where with the same code as OP I’m getting the same error messages plus a zombie ApplicationWindow. As I do not know how to properly share my complete VSCode config and project setup, I added another direct method that produces the same error messages without VSCode.

To be more explicit, here are some steps to reproduce:

  • Clone QmlJuliaExamples
  • Make a copy of QmlJuliaExamples/basic/drag.jl and name it QmlJuliaExamples/basic/drag2.jl
  • Modify QmlJuliaExamples/basic/drag2.jl as follows:
using QML

@qmlfunction println

function run()
  loadqml(joinpath(dirname(@__FILE__), "qml", "drag.qml"))
  exec()
end
  • In the terminal, cd <wherever you cloned it>/QmlJuliaExamples/basic/ and run the Julia REPL and type:
  • ]
  • activate .
  • instantiate
  • <backspace>
  • include("drag2.jl")
  • run()

This will run fine and you can play with the dragging example now. However, the following instead will produce OP’s error messages and a dead window:

  • Threads.@spawn run()

To reproduce this in VSCode (I’m using the extension julialang v1.127.2) without explicit Threads.@spawn, do the following steps:

  • Go to File -> Open Folder... and open <wherever you cloned it>/QmlJuliaExamples/basic/
  • In the file explorer, double click on drag2.jl.
  • Click the run button at the upper right of the code window.
  • The terminal should show with the message run (generic function with 1 method) and the Julia prompt.
  • Type run()

These steps will also produce a dead window and the following messages (I have anonymized some file paths):

Qt Warning: qrc:/qt-project.org/imports/QtQuick/Controls/Fusion/ApplicationWindow.qml:794814400: RangeError: Maximum call stack size exceeded. (qrc:/qt-project.org/imports/QtQuick/Controls/Fusion/ApplicationWindow.qml:794814400, (null))
Qt Warning: file:///***/QmlJuliaExamples/basic/qml/drag.qml:794814352: RangeError: Maximum call stack size exceeded. (file:///***/QmlJuliaExamples/basic/qml/drag.qml:794814352, (null))
Qt Warning: file:///***/QmlJuliaExamples/basic/qml/drag.qml:794814352: RangeError: Maximum call stack size exceeded. (file:///***/QmlJuliaExamples/basic/qml/drag.qml:794814352, (null))
Qt Warning: file:///***/QmlJuliaExamples/basic/qml/drag.qml:794814352: RangeError: Maximum call stack size exceeded. (file:///***/QmlJuliaExamples/basic/qml/drag.qml:794814352, (null))
Qt Warning: file:///***/QmlJuliaExamples/basic/qml/drag.qml:794814352: RangeError: Maximum call stack size exceeded. (file:///***/QmlJuliaExamples/basic/qml/drag.qml:794814352, (null))
Qt Warning: file:///***/QmlJuliaExamples/basic/qml/drag.qml:794814352: RangeError: Maximum call stack size exceeded. (file:///***/QmlJuliaExamples/basic/qml/drag.qml:794814352, (null))
Qt Warning: file:///***/QmlJuliaExamples/basic/qml/drag.qml:794814352: RangeError: Maximum call stack size exceeded. (file:///***/QmlJuliaExamples/basic/qml/drag.qml:794814352, (null))

Of course, this also happens in VSCode when you try to run the original drag.jl directly.

Well, you could create an issue at GitHub · Where software is built, but the maintainers are overloaded and I would not expect a quick fix.

Myself, I do not use the VSCode Julia terminal. Instead, I launch a normal (Bash) terminal and start julia with the required parameter from there, usually:

julia --project

Then everything should work.

Can you check whether this example works correctly with Julia 1.10?

I currently don’t have a 1.10 installation of Julia, but I tried 1.9 instead.

Same results for drag2.jl in Julia REPL in Ubuntu terminal:

  • run() works fine.
  • ’ Threads.@spawn run()’ throws errors.

I didn’t check running from VSCode.

1 Like