Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReadOnlyMemoryError() and EXCEPTION_ACCESS_VIOLATION #26

Open
zygmuntszpak opened this issue Sep 29, 2022 · 0 comments
Open

ReadOnlyMemoryError() and EXCEPTION_ACCESS_VIOLATION #26

zygmuntszpak opened this issue Sep 29, 2022 · 0 comments

Comments

@zygmuntszpak
Copy link

I've been running into some crashes, some of which I can reliably reproduce and others which are very elusive and random.

I'm using the following version of Julia

Julia Version 1.8.1
Commit afb6c60d69 (2022-09-06 15:09 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 20 × 12th Gen Intel(R) Core(TM) i7-12700
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, goldmont)
  Threads: 1 on 20 virtual cores
Environment:
  JULIA_EDITOR = code
  JULIA_NUM_THREADS =

with

  [5d785b6c] CImGui v1.79.0
  [e8efc688] ImPlot v0.2.0

The simplest errors to reproduce occur with implot_demo.jl.

Launch the demo with:
include(joinpath(pathof(ImPlot), "..", "..", "demo", "implot_demo.jl"))

Clicking on the collapsing header for 'Custom Data' one obtains the following error:

 Custom Data
   
   julia> ┌ Error: Error in renderloop!
│   exception = ReadOnlyMemoryError()
└ @ Main.Renderer C:\Users\Zyg\.julia\packages\ImPlot\kI3XA\demo\Renderer.jl:85

Stacktrace:
 [1] Spiral(#unused#::Ptr{Nothing}, idx::Int32)
   @ Main.MyImPlot C:\Users\Zyg\.julia\packages\ImPlot\kI3XA\demo\implot_demo.jl:60
 [2] PlotLineG(label_id::String, getter::Ptr{Nothing}, data::Ptr{Nothing}, count::Int64, offset::Int64)
   @ ImPlot.LibCImPlot C:\Users\Zyg\.julia\packages\ImPlot\kI3XA\src\libcimplot.jl:1538
 [3] PlotLineG (repeats 2 times)
   @ C:\Users\Zyg\.julia\packages\ImPlot\kI3XA\src\lines.jl:92 [inlined]
 [4] ShowDemoWindow()
   @ Main C:\Users\Zyg\.julia\packages\ImPlot\kI3XA\demo\implot_demo.jl:1660
 [5] (::var"#11#12")()
   @ Main C:\Users\Zyg\.julia\packages\ImPlot\kI3XA\demo\implot_demo.jl:1940
 [6] #invokelatest#2
   @ .\essentials.jl:729 [inlined]
 [7] invokelatest
   @ .\essentials.jl:726 [inlined]
 [8] renderloop(window::GLFW.Window, ctx::Ptr{CImGui.LibCImGui.ImGuiContext}, ui::var"#11#12", hotloading::Bool)
   @ Main.Renderer C:\Users\Zyg\.julia\packages\ImPlot\kI3XA\demo\Renderer.jl:70
 [9] (::Main.Renderer.var"#4#5"{Bool, var"#11#12", Ptr{CImGui.LibCImGui.ImGuiContext}, GLFW.Window})()
   @ Main.Renderer .\task.jl:484

Clicking on the Realtime Plot collapsing header one obtains the following:

julia> ┌ Error: Error in renderloop!
│   exception = type DataType has no field mutable
└ @ Main.Renderer C:\Users\Zyg\.julia\packages\ImPlot\kI3XA\demo\Renderer.jl:85

Stacktrace:
 [1] getproperty
   @ .\Base.jl:33 [inlined]
 [2] PlotShaded(structvec::Vector{ImVec2}, xfield::Symbol, yfield::Symbol, y_ref::Int64; count::Int64, offset::Int64, stride::Int64, label_id::String)
   @ ImPlot C:\Users\Zyg\.julia\packages\ImPlot\kI3XA\src\shaded.jl:111
 [3] ShowDemoWindow()
   @ Main C:\Users\Zyg\.julia\packages\ImPlot\kI3XA\demo\implot_demo.jl:810
 [4] (::var"#7#8")()
   @ Main C:\Users\Zyg\.julia\packages\ImPlot\kI3XA\demo\implot_demo.jl:1940
 [5] #invokelatest#2
   @ .\essentials.jl:729 [inlined]
 [6] invokelatest
   @ .\essentials.jl:726 [inlined]
 [7] renderloop(window::GLFW.Window, ctx::Ptr{CImGui.LibCImGui.ImGuiContext}, ui::var"#7#8", hotloading::Bool)
   @ Main.Renderer C:\Users\Zyg\.julia\packages\ImPlot\kI3XA\demo\Renderer.jl:70
 [8] (::Main.Renderer.var"#4#5"{Bool, var"#7#8", Ptr{CImGui.LibCImGui.ImGuiContext}, GLFW.Window})()
   @ Main.Renderer .\task.jl:484

The most elusive and difficult to track down bug is an EXCEPTION_ACCESS_VIOLATION which sometimes happens and sometimes not with the exact same code. I have been trying to figure out which ImPlot command is causing it, but when it starts happening it will happen consistently (i.e. restart REPL and run the same code) for even the case of

       CImGui.Begin("Embedding") 
            CImGui.SetWindowFontScale(1.0f0)
            ImPlot.SetNextPlotLimits(-2,2,-2,2, ImGuiCond_Always)
            if ImPlot.BeginPlot("##scatter", "first dimension", "second dimension")
              # Plot points in the first category
              #  ImPlot.PushStyleColor(ImPlotCol_MarkerFill, CImGui.HSV(242/360, 40/100, 90/100))
              #  ImPlot.PushStyleColor(ImPlotCol_MarkerOutline, CImGui.HSV(242/360, 50/100, 90/100))                
              #  ImPlot.PlotScatter(features_all[1, :], features_all[2, :])       
              ImPlot.EndPlot()
            end
        CImGui.End()

where features_all::Matrix{Float64}. The crash happens even if I comment out the lines as above.

The EXCEPTION_ACCESS_VIOLATION crashed the REPL in VS Code, and I am not able to copy and paste the text of the error. I am able to take a screenshot before it crashes however:

access control violation cropped

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant