Skip to content

Conversation

@SimonDanisch
Copy link
Member

I notice the other operations on font.lock are more fine grained, not sure if that's worth for the cache as well ;)

@SimonDanisch SimonDanisch requested a review from jkrumbiegel May 29, 2025 11:40
@codecov
Copy link

codecov bot commented May 29, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.56%. Comparing base (a018db8) to head (db3fc03).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #95      +/-   ##
==========================================
+ Coverage   94.55%   94.56%   +0.01%     
==========================================
  Files           6        6              
  Lines         312      313       +1     
==========================================
+ Hits          295      296       +1     
  Misses         17       17              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@SimonDanisch
Copy link
Member Author

SimonDanisch commented May 29, 2025

MWE:

using GLMakie, StableTasks
@assert Threads.nthreads() > 10
folder = "thread_test"
mkdir(folder)

Threads.@threads :dynamic for k in 1:100
    f = GLMakie.Figure()
    a = GLMakie.Axis(f[1,1];
        xlabel = "x",
        ylabel = "y",
        title = "This Plot Is From k=$k",
    )
    x = collect(1. : 20.)
    y = x.^2
    GLMakie.lines!(a, x, y)
    StableTasks.@spawnat 1 GLMakie.save(joinpath(folder, "figure-$k.png"), f)
    nothing
end

Stacktrace:

ERROR: TaskFailedException

    nested task error: AssertionError: Multiple concurrent writes to Dict detected!

    Stacktrace:

      [1] rehash!(h::Dict{UInt64, FreeTypeAbstraction.FontExtent{Float32}}, newsz::Int64)

        @ Base ./dict.jl:208

      [2] _setindex!

        @ ./dict.jl:355 [inlined]

      [3] get!(default::FreeTypeAbstraction.var"#9#10"{FreeTypeAbstraction.FTFont, UInt64}, h::Dict{UInt64, FreeTypeAbstraction.FontExtent{Float32}}, key::UInt64)

        @ Base ./dict.jl:477

      [4] get_extent

        @ ~/.julia/packages/FreeTypeAbstraction/B5Khh/src/types.jl:206 [inlined]

      [5] Makie.GlyphExtent(font::FreeTypeAbstraction.FTFont, char::Char)

        @ Makie ~/.julia/packages/Makie/Y3ABD/src/types.jl:404

      [6] (::Makie.var"#1014#1025"{Float64})(char::Char, font::FreeTypeAbstraction.FTFont, scale::Float32)

        @ Makie ~/.julia/packages/Makie/Y3ABD/src/layouting/text_layouting.jl:81

      [7] _broadcast_getindex_evalf

        @ ./broadcast.jl:683 [inlined]

      [8] _broadcast_getindex

        @ ./broadcast.jl:656 [inlined]

      [9] getindex

        @ ./broadcast.jl:610 [inlined]

     [10] macro expansion

        @ ./broadcast.jl:974 [inlined]

     [11] macro expansion

        @ ./simdloop.jl:77 [inlined]

     [12] copyto!

        @ ./broadcast.jl:973 [inlined]

     [13] copyto!

        @ ./broadcast.jl:926 [inlined]

     [14] copy

        @ ./broadcast.jl:898 [inlined]

     [15] materialize

        @ ./broadcast.jl:873 [inlined]

     [16] broadcast(::Makie.var"#1014#1025"{Float64}, ::Base.Generator{String, typeof(identity)}, ::Vector{FreeTypeAbstraction.FTFont}, ::Float32)

        @ Base.Broadcast ./broadcast.jl:811

     [17] glyph_collection(str::String, font_per_char::Vector{FreeTypeAbstraction.FTFont}, fontscale_px::Float32, halign::Symbol, valign::Symbol, lineheight_factor::Float64, justification::MakieCore.Automatic, rotation::Makie.Quaternionf, color::ColorTypes.RGBA{Float32}, strokecolor::ColorTypes.RGBA{Float32}, strokewidth::Int64, word_wrap_width::Int64)

        @ Makie ~/.julia/packages/Makie/Y3ABD/src/layouting/text_layouting.jl:80

     [18] layout_text

        @ ~/.julia/packages/Makie/Y3ABD/src/layouting/text_layouting.jl:55 [inlined]

     [19] _get_glyphcollection_and_linesegments(str::String, index::Int64, ts::Float32, f::FreeTypeAbstraction.FTFont, fs::MakieCore.Attributes, al::Tuple{Symbol, Symbol}, rot::Makie.Quaternion{Float64}, jus::MakieCore.Automatic, lh::Float64, col::ColorTypes.RGBA{Float32}, scol::ColorTypes.RGBA{Float32}, swi::Int64, www::Int64, offs::GeometryBasics.Vec{2, Float32})

        @ Makie ~/.julia/packages/Makie/Y3ABD/src/basic_recipes/text.jl:111

     [20] (::Makie.var"#push_args#2369"{Vector{Int64}, Vector{ColorTypes.RGBA{Float32}}, Vector{Float32}, Vector{GeometryBasics.Point{2, Float32}}, Vector{Makie.GlyphCollection}})(::String, ::Vararg{Any})

        @ Makie ~/.julia/packages/Makie/Y3ABD/src/basic_recipes/text.jl:51

     [21] (::Makie.var"#2365#2368"{MakieCore.Text{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}, Base.RefValue{Vector{Int64}}, Observables.Observable{Vector{ColorTypes.RGBA{Float32}}}, Observables.Observable{Vector{Float32}}, Observables.Observable{Vector{GeometryBasics.Point{2, Float32}}}, Observables.Observable{Vector{Makie.GlyphCollection}}})(str::String, ts::Float64, f::Symbol, fs::MakieCore.Attributes, al::Tuple{Symbol, Symbol}, rot::Float64, jus::MakieCore.Automatic, lh::Float64, cs::ColorTypes.RGBA{Float32}, cmap::Symbol, scol::Tuple{Symbol, Float64}, swi::Int64, www::Int64, offs::Tuple{Float64, Float64})

        @ Makie ~/.julia/packages/Makie/Y3ABD/src/basic_recipes/text.jl:66

     [22] invokelatest(::Any, ::Any, ::Vararg{Any}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})

        @ Base ./essentials.jl:819

     [23] invokelatest(::Any, ::Any, ::Vararg{Any})

        @ Base ./essentials.jl:816

     [24] (::Observables.OnAny)(value::Any)

        @ Observables ~/.julia/packages/Observables/YdEbO/src/Observables.jl:420

     [25] #invokelatest#2

        @ ./essentials.jl:819 [inlined]

     [26] invokelatest

        @ ./essentials.jl:816 [inlined]

     [27] notify(observable::Observables.AbstractObservable)

        @ Observables ~/.julia/packages/Observables/YdEbO/src/Observables.jl:206

     [28] plot!(plot::MakieCore.Text{Tuple{Vector{GeometryBasics.Point{2, Float32}}}})

        @ Makie ~/.julia/packages/Makie/Y3ABD/src/basic_recipes/text.jl:88

     [29] connect_plot!(parent::Makie.Scene, plot::MakieCore.Text{Tuple{Vector{GeometryBasics.Point{2, Float32}}}})

        @ Makie ~/.julia/packages/Makie/Y3ABD/src/interfaces.jl:395

     [30] plot!(scene::Makie.Scene, plot::MakieCore.Text{Tuple{Vector{GeometryBasics.Point{2, Float32}}}})

        @ Makie ~/.julia/packages/Makie/Y3ABD/src/interfaces.jl:412

     [31] _create_plot!(F::Function, attributes::Dict{Symbol, Any}, scene::Makie.Scene, args::Observables.Observable{GeometryBasics.Point{2, Float32}})

        @ Makie ~/.julia/packages/Makie/Y3ABD/src/figureplotting.jl:391

     [32] #text!#59

        @ ~/.julia/packages/MakieCore/EU17Y/src/recipes.jl:514 [inlined]

     [33] text!

        @ ~/.julia/packages/MakieCore/EU17Y/src/recipes.jl:512 [inlined]

     [34] initialize_block!(ax::Makie.Axis; palette::Nothing)

        @ Makie ~/.julia/packages/Makie/Y3ABD/src/makielayout/blocks/axis.jl:467

     [35] initialize_block!(ax::Makie.Axis)

        @ Makie ~/.julia/packages/Makie/Y3ABD/src/makielayout/blocks/axis.jl:151

     [36] _block(T::Type{Makie.Axis}, fig_or_scene::Makie.Figure, args::Vector{Any}, kwdict::Dict{Symbol, Any}, bbox::Nothing; kwdict_complete::Bool)

        @ Makie ~/.julia/packages/Makie/Y3ABD/src/makielayout/blocks.jl:398

     [37] _block

        @ ~/.julia/packages/Makie/Y3ABD/src/makielayout/blocks.jl:317 [inlined]

     [38] #_block#1442

        @ ~/.julia/packages/Makie/Y3ABD/src/makielayout/blocks.jl:262 [inlined]

     [39] _block(::Type{Makie.Axis}, ::GridLayoutBase.GridPosition; kwargs::Base.Pairs{Symbol, Any, NTuple{5, Symbol}, NamedTuple{(:title, :xlabel, :xtickformat, :xticklabelrotation, :ylabel), Tuple{String, String, typeof(ModelsMakieExt.label_time), Float64, String}}})

        @ Makie ~/.julia/packages/Makie/Y3ABD/src/makielayout/blocks.jl:256

     [40] _block

        @ ~/.julia/packages/Makie/Y3ABD/src/makielayout/blocks.jl:249 [inlined]

     [41] #_#1440

        @ ~/.julia/packages/Makie/Y3ABD/src/makielayout/blocks.jl:240 [inlined]

     [42] Block

        @ ~/.julia/packages/Makie/Y3ABD/src/makielayout/blocks.jl:239 [inlined]

     [43] #time_series_axis#9

        @ ~/Dev/Models.jl/ext/ModelsMakieExt/time-series.jl:65 [inlined]

I didn't get this MWE to break on my linux PC, but this got reported to fail on osx.

@SimonDanisch SimonDanisch merged commit fe61188 into master May 29, 2025
11 checks passed
@SimonDanisch SimonDanisch deleted the sd/lock-cache branch May 29, 2025 13:07
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

Successfully merging this pull request may close these issues.

3 participants