JuliaLang / julia

The Julia Programming Language
https://julialang.org/
MIT License
45.84k stars 5.49k forks source link

EXCEPTION_ACCESS_VIOLATION at 0x79e26d8 #55883

Open ehehela opened 1 month ago

ehehela commented 1 month ago

When I ran the following code to plot a contour, Julia stopped working and gave the following prompts. Does anyone know what’s going on?

using LinearAlgebra

abstract type GeoShape{dim} end
struct GSPolyline <: GeoShape{2} end
struct GSPolygon <: GeoShape{2} end

struct Geometry{dim,T,S<:GeoShape{dim}}
    coords::Vector{NTuple{dim,T}}
end
Polyline{T} = Geometry{2,T,GSPolyline}
Polyline(coords::Vector{NTuple{2,T}}) where {T} = Polyline{T}(coords)

function signed_tangentdistance(pline::Polyline, querypt)
    plcoor = pline.coords
    return max(signed_tangentdistance(plcoor[begin], plcoor[begin+1], querypt), signed_tangentdistance(plcoor[end], plcoor[end-1], querypt))
end
function signed_tangentdistance(point1, point2, querypt)
    line_vec = point1 .- point2
    line_vec = line_vec ./ √(sum(line_vec .^ 2))
    point_vec = querypt .- point1
    t = point_vec ⋅ line_vec
    return t
end

using Plots

pline = Polyline{Float64}([(1, 1), (2, 2), (4, 2), (4, 4), (2, 5), (4, 6), (6, 4), (6, 1), (5, 2)])
x = range(0.0, 7.0, length=1000)
p = contour(x, x, (x, y) -> signed_tangentdistance(pline, (x, y)); fill=true, lw=0, color=:RdBu, aspect_ratio=:equal,clabels=true)
display(p)
Crash log ``` Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks. Exception: EXCEPTION_ACCESS_VIOLATION at 0x79e26d8 -- gradient.constprop.1 at C:\Users\dingding.julia\artifacts\09278fa5603af004623baf9d4731c325b0513e44\bin\libGR.dll (unknown line) in expression starting at d:\Users\dingding\OneDrive\CS\JuliaProject\WorkOnVNE\VnFEM.jl\test\testscript.jl:10 gradient.constprop.1 at C:\Users\dingding.julia\artifacts\09278fa5603af004623baf9d4731c325b0513e44\bin\libGR.dll (unknown line) label_line.constprop.0 at C:\Users\dingding.julia\artifacts\09278fa5603af004623baf9d4731c325b0513e44\bin\libGR.dll (unknown line) gr_draw_contours at C:\Users\dingding.julia\artifacts\09278fa5603af004623baf9d4731c325b0513e44\bin\libGR.dll (unknown line) gr_contour at C:\Users\dingding.julia\artifacts\09278fa5603af004623baf9d4731c325b0513e44\bin\libGR.dll (unknown line) gr_draw_contourf at C:\Users\dingding.julia\artifacts\09278fa5603af004623baf9d4731c325b0513e44\bin\libGR.dll (unknown line) gr_contourf at C:\Users\dingding.julia\artifacts\09278fa5603af004623baf9d4731c325b0513e44\bin\libGR.dll (unknown line) contourf at C:\Users\dingding.julia\packages\GR\nDZgF\src\GR.jl:2688 unknown function (ip: 00000214878577e9) gr_draw_contour at C:\Users\dingding.julia\packages\Plots\kLeqV\src\backends\gr.jl:1924 unknown function (ip: 0000021487856126) gr_add_series at C:\Users\dingding.julia\packages\Plots\kLeqV\src\backends\gr.jl:1778 gr_display at C:\Users\dingding.julia\packages\Plots\kLeqV\src\backends\gr.jl:964 #508 at C:\Users\dingding.julia\packages\Plots\kLeqV\src\backends\gr.jl:688 unknown function (ip: 000002148784ca47) foreach at .\abstractarray.jl:3097 jfptr_foreach_61671 at C:\Users\dingding.julia\compiled\v1.10\Plots\ld3vC_jHADs.dll (unknown line) gr_display at C:\Users\dingding.julia\packages\Plots\kLeqV\src\backends\gr.jl:688 #561 at C:\Users\dingding.julia\packages\Plots\kLeqV\src\backends\gr.jl:2086 [inlined] withenv at .\env.jl:257 _show at C:\Users\dingding.julia\packages\Plots\kLeqV\src\backends\gr.jl:2081 jl_apply at C:/workdir/src\julia.h:1982 [inlined] jl_f__call_latest at C:/workdir/src\builtins.c:812 #invokelatest#2 at .\essentials.jl:892 [inlined] invokelatest at .\essentials.jl:889 [inlined] show at C:\Users\dingding.julia\packages\Plots\kLeqV\src\output.jl:232 [inlined] __binrepr at .\multimedia.jl:171 _textrepr at .\multimedia.jl:163 [inlined] #stringmime#8 at C:\workdir\usr\share\julia\stdlib\v1.10\Base64\src\Base64.jl:44 [inlined] stringmime at C:\workdir\usr\share\julia\stdlib\v1.10\Base64\src\Base64.jl:44 unknown function (ip: 000002148783d60c) display at c:\Users\dingding.vscode\extensions\julialang.language-julia-1.124.2\scripts\packages\VSCodeServer\src\display.jl:68 unknown function (ip: 000002148783d37f) display at .\multimedia.jl:228 display at c:\Users\dingding.vscode\extensions\julialang.language-julia-1.124.2\scripts\packages\VSCodeServer\src\display.jl:207 unknown function (ip: 000002148783ccbf) display at .\multimedia.jl:340 unknown function (ip: 000002148781919b) jl_apply at C:/workdir/src\julia.h:1982 [inlined] do_call at C:/workdir/src\interpreter.c:126 eval_value at C:/workdir/src\interpreter.c:223 eval_stmt_value at C:/workdir/src\interpreter.c:174 [inlined] eval_body at C:/workdir/src\interpreter.c:635 jl_interpret_toplevel_thunk at C:/workdir/src\interpreter.c:775 jl_toplevel_eval_flex at C:/workdir/src\toplevel.c:934 jl_eval_module_expr at C:/workdir/src\toplevel.c:215 [inlined] jl_toplevel_eval_flex at C:/workdir/src\toplevel.c:736 jl_toplevel_eval_flex at C:/workdir/src\toplevel.c:877 ijl_toplevel_eval at C:/workdir/src\toplevel.c:943 [inlined] ijl_toplevel_eval_in at C:/workdir/src\toplevel.c:985 eval at .\boot.jl:385 [inlined] include_string at .\loading.jl:2076 include_string at .\loading.jl:2086 jl_apply at C:/workdir/src\julia.h:1982 [inlined] jl_f__call_latest at C:/workdir/src\builtins.c:812 jl_apply at C:/workdir/src\julia.h:1982 [inlined] do_apply at C:/workdir/src\builtins.c:768 #invokelatest#2 at .\essentials.jl:892 jl_apply at C:/workdir/src\julia.h:1982 [inlined] do_apply at C:/workdir/src\builtins.c:768 invokelatest at .\essentials.jl:889 jl_apply at C:/workdir/src\julia.h:1982 [inlined] do_apply at C:/workdir/src\builtins.c:768 #inlineeval#76 at c:\Users\dingding.vscode\extensions\julialang.language-julia-1.124.2\scripts\packages\VSCodeServer\src\eval.jl:271 inlineeval at c:\Users\dingding.vscode\extensions\julialang.language-julia-1.124.2\scripts\packages\VSCodeServer\src\eval.jl:268 #69 at c:\Users\dingding.vscode\extensions\julialang.language-julia-1.124.2\scripts\packages\VSCodeServer\src\eval.jl:181 withpath at c:\Users\dingding.vscode\extensions\julialang.language-julia-1.124.2\scripts\packages\VSCodeServer\src\repl.jl:276 #68 at c:\Users\dingding.vscode\extensions\julialang.language-julia-1.124.2\scripts\packages\VSCodeServer\src\eval.jl:179 hideprompt at c:\Users\dingding.vscode\extensions\julialang.language-julia-1.124.2\scripts\packages\VSCodeServer\src\repl.jl:38 #67 at c:\Users\dingding.vscode\extensions\julialang.language-julia-1.124.2\scripts\packages\VSCodeServer\src\eval.jl:150 unknown function (ip: 00000214878243db) with_logstate at .\logging.jl:515 with_logger at .\logging.jl:627 [inlined] #66 at c:\Users\dingding.vscode\extensions\julialang.language-julia-1.124.2\scripts\packages\VSCodeServer\src\eval.jl:263 unknown function (ip: 0000021487822bdb) jl_apply at C:/workdir/src\julia.h:1982 [inlined] jl_f__call_latest at C:/workdir/src\builtins.c:812 #invokelatest#2 at .\essentials.jl:892 [inlined] invokelatest at .\essentials.jl:889 unknown function (ip: 000002148781783b) jl_apply at C:/workdir/src\julia.h:1982 [inlined] do_apply at C:/workdir/src\builtins.c:768 #64 at c:\Users\dingding.vscode\extensions\julialang.language-julia-1.124.2\scripts\packages\VSCodeServer\src\eval.jl:34 unknown function (ip: 00000214877e8154) jl_apply at C:/workdir/src\julia.h:1982 [inlined] start_task at C:/workdir/src\task.c:1238 Allocations: 18989718 (Pool: 18976024; Big: 13694); GC: 25 ```
versioninfo() ``` julia> versioninfo() Julia Version 1.10.4 Commit 48d4fd4843 (2024-06-04 10:41 UTC) Build Info: Official https://julialang.org/ release Platform Info: OS: Windows (x86_64-w64-mingw32) CPU: 12 × 12th Gen Intel(R) Core(TM) i5-12400F WORD_SIZE: 64 LIBM: libopenlibm LLVM: libLLVM-15.0.7 (ORCJIT, alderlake) Threads: 1 default, 0 interactive, 1 GC (on 12 virtual cores) ```
inkydragon commented 1 month ago

This seems to be a GR backend issue for Plots.jl

using Plots

f(x, y) = x + y
x = range(0.93, 0.94, length=500)

p = contour(x, x, f; clabels=true)
display(p)
Crash log ``` Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks. Exception: EXCEPTION_ACCESS_VIOLATION at 0x7a226af -- gradient.constprop.1 at C:\Users\inkyd\.julia\artifacts\09278fa5603af004623baf9d4731c325b0513e44\bin\libGR.dll (unknown line) in expression starting at d:\jl\julia\.wos\bug-libGR\55883.jl:7 gradient.constprop.1 at C:\Users\inkyd\.julia\artifacts\09278fa5603af004623baf9d4731c325b0513e44\bin\libGR.dll (unknown line) label_line.constprop.0 at C:\Users\inkyd\.julia\artifacts\09278fa5603af004623baf9d4731c325b0513e44\bin\libGR.dll (unknown line) gr_draw_contours at C:\Users\inkyd\.julia\artifacts\09278fa5603af004623baf9d4731c325b0513e44\bin\libGR.dll (unknown line) gr_contour at C:\Users\inkyd\.julia\artifacts\09278fa5603af004623baf9d4731c325b0513e44\bin\libGR.dll (unknown line) contour at C:\Users\inkyd\.julia\packages\GR\nDZgF\src\GR.jl:2638 unknown function (ip: 000002568ccc9039) gr_draw_contour at C:\Users\inkyd\.julia\packages\Plots\kLeqV\src\backends\gr.jl:1928 unknown function (ip: 000002568ccc7ae6) gr_add_series at C:\Users\inkyd\.julia\packages\Plots\kLeqV\src\backends\gr.jl:1778 gr_display at C:\Users\inkyd\.julia\packages\Plots\kLeqV\src\backends\gr.jl:964 #508 at C:\Users\inkyd\.julia\packages\Plots\kLeqV\src\backends\gr.jl:688 jfptr_YY.508_53169 at C:\Users\inkyd\.julia\compiled\v1.10\Plots\ld3vC_pNpxQ.dll (unknown line) foreach at .\abstractarray.jl:3097 jfptr_foreach_61651 at C:\Users\inkyd\.julia\compiled\v1.10\Plots\ld3vC_pNpxQ.dll (unknown line) gr_display at C:\Users\inkyd\.julia\packages\Plots\kLeqV\src\backends\gr.jl:688 gr_display at C:\Users\inkyd\.julia\packages\Plots\kLeqV\src\backends\gr.jl:658 [inlined] #564 at C:\Users\inkyd\.julia\packages\Plots\kLeqV\src\backends\gr.jl:2114 [inlined] withenv at .\env.jl:257 _display at C:\Users\inkyd\.julia\packages\Plots\kLeqV\src\backends\gr.jl:2113 display at C:\Users\inkyd\.julia\packages\Plots\kLeqV\src\output.jl:169 unknown function (ip: 000002568ccc3ea0) display at .\multimedia.jl:340 unknown function (ip: 000002568ccc3deb) jl_apply at C:/workdir/src\julia.h:1982 [inlined] do_call at C:/workdir/src\interpreter.c:126 eval_value at C:/workdir/src\interpreter.c:223 eval_stmt_value at C:/workdir/src\interpreter.c:174 [inlined] eval_body at C:/workdir/src\interpreter.c:635 jl_interpret_toplevel_thunk at C:/workdir/src\interpreter.c:775 jl_toplevel_eval_flex at C:/workdir/src\toplevel.c:934 jl_toplevel_eval_flex at C:/workdir/src\toplevel.c:877 ijl_toplevel_eval at C:/workdir/src\toplevel.c:943 [inlined] ijl_toplevel_eval_in at C:/workdir/src\toplevel.c:985 eval at .\boot.jl:385 [inlined] include_string at .\loading.jl:2076 _include at .\loading.jl:2136 include at .\Base.jl:495 jfptr_include_49789.1 at C:\Users\inkyd\.julia\juliaup\julia-1.10.5+0.x64.w64.mingw32\lib\julia\sys.dll (unknown line) exec_options at .\client.jl:318 _start at .\client.jl:552 jfptr__start_86663.1 at C:\Users\inkyd\.julia\juliaup\julia-1.10.5+0.x64.w64.mingw32\lib\julia\sys.dll (unknown line) jl_apply at C:/workdir/src\julia.h:1982 [inlined] true_main at C:/workdir/src\jlapi.c:582 jl_repl_entrypoint at C:/workdir/src\jlapi.c:731 mainCRTStartup at C:/workdir/cli\loader_exe.c:58 BaseThreadInitThunk at C:\WINDOWS\System32\KERNEL32.DLL (unknown line) RtlUserThreadStart at C:\WINDOWS\SYSTEM32\ntdll.dll (unknown line) Allocations: 1773564 (Pool: 1771857; Big: 1707); GC: 3 ```
ehehela commented 1 month ago

This seems to be a GR backend issue for Plots.jl

Yes, when I switched to using the PythonPlot backend, it worked normally.